import org.apache.iceberg.*; import org.apache.iceberg.types.Types; Schema schema = new Schema( Types.NestedField.optional(1, "id", Types.IntegerType.get()), Types.NestedField.optional(2, "name", Types.StringType.get()), Types.NestedField.optional(3, "age", Types.IntegerType.get()) ); Table table = new HadoopTables(hadoopConf).create(schema, tableLocation); table.updateProperties() .set(TableProperties.DEFAULT_FILE_FORMAT, "parquet") .set(TableProperties.WRITE_DISTRIBUTION_MODE, "hash") .set(TableProperties.HASH_PARTITIONING_EXPRESSION, "age % 10") .commit(); table.updateProperties() .set(TableProperties.DEFAULT_FILE_FORMAT, "parquet") .set(TableProperties.PARQUET_COMPRESSION, "snappy") .commit(); table.updateProperties() .set(TableProperties.DEFAULT_FILE_FORMAT, "parquet") .set(TableProperties.WRITE_STATISTICS_ENABLED, "true") .commit(); import org.apache.iceberg.*; import org.apache.iceberg.types.Types; public class IcebergExample { public static void main(String[] args) { Schema schema = new Schema( Types.NestedField.optional(1, "id", Types.IntegerType.get()), Types.NestedField.optional(2, "name", Types.StringType.get()), Types.NestedField.optional(3, "age", Types.IntegerType.get()) ); Table table = new HadoopTables(hadoopConf).create(schema, tableLocation); table.updateProperties() .set(TableProperties.DEFAULT_FILE_FORMAT, "parquet") .set(TableProperties.WRITE_DISTRIBUTION_MODE, "hash") .set(TableProperties.HASH_PARTITIONING_EXPRESSION, "age % 10") .commit(); table.updateProperties() .set(TableProperties.DEFAULT_FILE_FORMAT, "parquet") .set(TableProperties.PARQUET_COMPRESSION, "snappy") .commit(); table.updateProperties() .set(TableProperties.DEFAULT_FILE_FORMAT, "parquet") .set(TableProperties.WRITE_STATISTICS_ENABLED, "true") .commit(); } }


上一篇:
下一篇:
切换中文