Skip to content
Open
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
74cbc83
First commit on supporting parquet
Feb 15, 2025
79bd222
catch file not found exception
Feb 17, 2025
2143c99
executed mvn spotless:apply
Feb 17, 2025
4f1ea77
added byte_array data type
Feb 18, 2025
f71610b
added ParquetStatsExtractor
Feb 20, 2025
c57a42f
added InternalDataFile population from parquet metadata
Feb 22, 2025
1557ea3
added col stats for parquet
Feb 22, 2025
24c474a
set todos
Feb 22, 2025
e1a3f35
integrated ParquetPartitionExtractor.java
Feb 23, 2025
fbbd1eb
added partitionValues to StatsExtractor builder
Feb 23, 2025
40c5e67
added the parquet conversion source provider
Feb 23, 2025
ec222de
run mvn spotless:apply
Feb 24, 2025
e0fbca8
edited ParquetSchemaExtractor to include some other LogicalTypes and …
Mar 5, 2025
6e2fc66
ParquetSchemaExtractor few fixes
Mar 5, 2025
b4c49b7
ParquetSchemaExtractor NULL type added
Mar 5, 2025
cac552a
ParquetSchemaExtractor Numeric and time types OK, TODO : Arrays and Maps
Mar 5, 2025
004d763
ParquetSchemaExtractor added groupTypes Map and List: TODO: tests
Mar 5, 2025
4b4593b
added -write parquet- to test Parquet types
Mar 6, 2025
9d56c21
added first test for primitive types
Mar 8, 2025
18ef037
cleanups
Mar 9, 2025
bd11c67
added timestamp metadata (millis, micros, nanos)
Mar 11, 2025
0dbedb0
added else type for each switch case
Mar 11, 2025
0233d54
added string type
Mar 11, 2025
8fc6a95
added Time type
Mar 11, 2025
c88fb25
added metadata for ENUM and FIXED
Mar 11, 2025
6c04cc7
adjusted primitive type detection
Mar 11, 2025
9bdd972
adjusted primitive types for fromInternalSchema sync, TODO: ENUM, LIS…
Mar 11, 2025
924db34
logic for partitionFields (from user configuration) and updated Conve…
Mar 14, 2025
271756e
adjusted data class for reading user config
Mar 14, 2025
f7db318
removed unacessary class
Mar 14, 2025
1323f63
added alternative methods for ParquetSchemaExtractor: to test
Mar 14, 2025
5c87799
fixed small error in the previous commit
Mar 14, 2025
c53b7c5
fixed small errors
Mar 14, 2025
80b9300
partitions are read from config
Mar 14, 2025
c54d038
conversion source and schema extractor link fixed, TODO: split into t…
Mar 14, 2025
c49dbaa
Schema Extractor: List and Map and Fixed are converted Avro Types
Mar 14, 2025
f95f87a
read config source bug fix
Mar 15, 2025
9df1c42
FIXED type conversion ok
Mar 15, 2025
60fdc8a
fixed few compilation errors
Mar 16, 2025
eb7f60f
few other compilation errors fixed
Mar 16, 2025
96e91cd
few other compilation errors fixed 2
Mar 16, 2025
f1b7524
code compiling
Mar 17, 2025
a79af62
cleanups for ParquetStatsExtractor and ParquetSchemaExtractor: compil…
Mar 18, 2025
a27e172
cleanups for Parquet partition methods: compiling but not tested
Mar 18, 2025
c58fe53
cleanups for Parquet Conversion Source and adjust StatsExtractor for …
Mar 18, 2025
429581a
ENUM conversion using avro-parquet: compiling but not tested
Mar 19, 2025
0f3c60b
LIST and RECORD for parquet data conversion
Mar 19, 2025
60dced9
Boolean for parquet data conversion, code compiling, not tested
Mar 20, 2025
1b698bd
StatsExtractor adjusted to remove encodings and add min max vals
Mar 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 41 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
</organization>

<modules>
<module>xtable-api</module>
<module>xtable-hudi-support</module>
<module>xtable-api</module>
<!-- <module>xtable-hudi-support</module>-->
<module>xtable-core</module>
<module>xtable-utilities</module>
<module>xtable-aws</module>
<module>xtable-hive-metastore</module>
<!-- <module>xtable-utilities</module>
<module>xtable-aws</module>
<module>xtable-hive-metastore</module>-->
</modules>

<properties>
Expand Down Expand Up @@ -304,6 +304,41 @@
<version>${delta.hive.version}</version>
</dependency>

<!-- Parquet -->
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet</artifactId>
<version>1.13.0</version>
<type>pom</type>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.parquet/parquet-format -->
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-format</artifactId>
<version>2.10.0</version>
</dependency>


<!-- https://mvnrepository.com/artifact/org.apache.parquet/parquet-hadoop -->
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-hadoop</artifactId>
<version>1.13.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.parquet/parquet-column -->
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-column</artifactId>
<version>1.13.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.parquet/parquet-common -->
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-common</artifactId>
<version>1.13.0</version>
</dependency>

<!-- Spark -->
<dependency>
<groupId>org.apache.spark</groupId>
Expand Down Expand Up @@ -794,7 +829,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>${google.java.format.version}</version>
<version>1.19.2</version> <!-- ${google.java.format.version} -->
<style>GOOGLE</style>
<groupArtifact>com.google.googlejavaformat:google-java-format</groupArtifact>
</googleJavaFormat>
Expand Down
6 changes: 6 additions & 0 deletions xtable-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
<name>XTable Project API</name>

<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.parquet/parquet-column -->
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-column</artifactId>
<version>1.13.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import com.google.common.base.Preconditions;

import org.apache.xtable.model.config.InputPartitionFields;
import org.apache.xtable.model.sync.SyncMode;

@Value
Expand All @@ -42,19 +43,23 @@ public class ConversionConfig {
Map<TargetTable, List<TargetCatalogConfig>> targetCatalogs;
// The mode, incremental or snapshot
SyncMode syncMode;
// Input partition config for parquet
InputPartitionFields partitions;

@Builder
ConversionConfig(
@NonNull SourceTable sourceTable,
List<TargetTable> targetTables,
Map<TargetTable, List<TargetCatalogConfig>> targetCatalogs,
SyncMode syncMode) {
SyncMode syncMode,
InputPartitionFields partitions) {
this.sourceTable = sourceTable;
this.targetTables = targetTables;
Preconditions.checkArgument(
targetTables != null && !targetTables.isEmpty(),
"Please provide at-least one format to sync");
this.targetCatalogs = targetCatalogs == null ? Collections.emptyMap() : targetCatalogs;
this.syncMode = syncMode == null ? SyncMode.INCREMENTAL : syncMode;
this.partitions = partitions;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@
class ExternalTable {
/** The name of the table. */
protected final @NonNull String name;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes coming from mvn spotless:apply ? Wondering how latest main branch doesn't reflect these.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding how to get partitionValues, I think it is best to discuss this in our meeting of today, but anyways, can it be asked from the user as YAML configuration?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/** The format of the table (e.g. DELTA, ICEBERG, HUDI) */
protected final @NonNull String formatName;

/** The path to the root of the table or the metadata directory depending on the format */
protected final @NonNull String basePath;

/** Optional namespace for the table */
protected final String[] namespace;

/** The configuration for interacting with the catalog that manages this table */
protected final CatalogConfig catalogConfig;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@
* table names. Some catalogs may omit the catalog name.
*/
public interface HierarchicalTableIdentifier extends CatalogTableIdentifier {
/** @return the catalog name if present, otherwise null */
/**
* @return the catalog name if present, otherwise null
*/
String getCatalogName();

/** @return the database (or schema) name; required */
/**
* @return the database (or schema) name; required
*/
String getDatabaseName();

/** @return the table name; required */
/**
* @return the table name; required
*/
String getTableName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class ThreePartHierarchicalTableIdentifier implements HierarchicalTableId
* name varies depending on the catalogType.
*/
String catalogName;

/**
* Catalogs have the ability to group tables logically, databaseName is the identifier for such
* logical classification. The alternate names for this field include namespace, schemaName etc.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.xtable.model.config;

import lombok.Builder;
import lombok.Data;
import lombok.Value;

import org.apache.xtable.model.schema.PartitionTransformType;

@Data
@Value
@Builder(toBuilder = true)
public class InputPartitionField {
String partitionFieldName;
String partitionValue;
PartitionTransformType transformType;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.xtable.model.config;

import java.util.List;

import lombok.Builder;
import lombok.Data;
import lombok.Value;

@Data
@Value
@Builder(toBuilder = true)
public class InputPartitionFields {
String sourceField;
List<InputPartitionField> partitions;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ public class InternalField {
// The id field for the field. This is used to identify the field in the schema even after
// renames.
Integer fieldId;

// represents the fully qualified path to the field (dot separated)
@Getter(lazy = true)
String path = createPath();

// splits the dot separated path into parts
@Getter(lazy = true)
String[] pathParts = splitPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public enum MetadataKey {

public enum MetadataValue {
MICROS,
MILLIS
MILLIS,
NANOS
}

public static final String XTABLE_LOGICAL_TYPE = "xtableLogicalType";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
*/

package org.apache.xtable.model.stat;

import java.util.Set;
import lombok.Builder;
import lombok.Value;

import org.apache.xtable.model.schema.InternalField;
import org.apache.parquet.column.Encoding;
import org.apache.parquet.column.statistics.Statistics;

/**
* Captures column level statistics for a field.
Expand All @@ -36,4 +38,7 @@ public class ColumnStat {
long numNulls;
long numValues;
long totalSize;
long uncompressedSize;
Set<Encoding> encodings;
Statistics statistics;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to add these since they are not used by the other table formats. This also introduces parquet specific dependencies into the model which we should avoid

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was aware of that, and I was thinking we could select which attributes to use to build a ColumnStat object.

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ public class InternalDataFile {
@Builder.Default @NonNull List<ColumnStat> columnStats = Collections.emptyList();
// last modified time in millis since epoch
long lastModified;

public static InternalDataFileBuilder builderFrom(InternalDataFile dataFile) {
return dataFile.toBuilder();
}
Comment on lines +53 to +55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this static method required when there is already a toBuilder method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did I add this method? I use it nowhere in the current version of my code.

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public class TableFormat {
public static final String HUDI = "HUDI";
public static final String ICEBERG = "ICEBERG";
public static final String DELTA = "DELTA";
public static final String PARQUET = "PARQUET";

public static String[] values() {
return new String[] {"HUDI", "ICEBERG", "DELTA"};
return new String[] {"HUDI", "ICEBERG", "DELTA", "PARQUET"};
}
}
6 changes: 6 additions & 0 deletions xtable-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
</dependency>

<!-- Avro -->
<!-- https://mvnrepository.com/artifact/org.apache.parquet/parquet-avro -->
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-avro</artifactId>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
Expand Down
Loading