You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by si...@apache.org on 2022/06/13 14:29:38 UTC
[hudi] branch master updated: [HUDI-3863] Add UT for drop partition column in deltastreamer testsuite (#5727)
This is an automated email from the ASF dual-hosted git repository.
sivabalan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new 0d859fe58b [HUDI-3863] Add UT for drop partition column in deltastreamer testsuite (#5727)
0d859fe58b is described below
commit 0d859fe58be8aded257593d9c6e407ce2be71be0
Author: luoyajun <lu...@gmail.com>
AuthorDate: Mon Jun 13 22:29:32 2022 +0800
[HUDI-3863] Add UT for drop partition column in deltastreamer testsuite (#5727)
---
.../functional/TestHoodieDeltaStreamer.java | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/hudi-utilities/src/test/java/org/apache/hudi/utilities/functional/TestHoodieDeltaStreamer.java b/hudi-utilities/src/test/java/org/apache/hudi/utilities/functional/TestHoodieDeltaStreamer.java
index ad94ada59b..ae38968187 100644
--- a/hudi-utilities/src/test/java/org/apache/hudi/utilities/functional/TestHoodieDeltaStreamer.java
+++ b/hudi-utilities/src/test/java/org/apache/hudi/utilities/functional/TestHoodieDeltaStreamer.java
@@ -2142,6 +2142,28 @@ public class TestHoodieDeltaStreamer extends HoodieDeltaStreamerTestBase {
.getCommitsTimeline()).get().getMetadata(CHECKPOINT_KEY), "def");
}
+ @Test
+ public void testDropPartitionColumns() throws Exception {
+ String tableBasePath = dfsBasePath + "/test_drop_partition_columns" + testNum++;
+ // ingest data with dropping partition columns enabled
+ HoodieDeltaStreamer.Config cfg = TestHelpers.makeConfig(tableBasePath, WriteOperationType.UPSERT);
+ cfg.configs.add(String.format("%s=%s", HoodieTableConfig.DROP_PARTITION_COLUMNS.key(), "true"));
+ HoodieDeltaStreamer ds = new HoodieDeltaStreamer(cfg, jsc);
+ ds.sync();
+ // assert ingest successful
+ TestHelpers.assertAtLeastNCommits(1, tableBasePath, dfs);
+
+ TableSchemaResolver tableSchemaResolver = new TableSchemaResolver(
+ HoodieTableMetaClient.builder().setBasePath(tableBasePath).setConf(dfs.getConf()).build());
+ // get schema from data file written in the latest commit
+ Schema tableSchema = tableSchemaResolver.getTableAvroSchemaFromDataFile();
+ assertNotNull(tableSchema);
+
+ List<String> tableFields = tableSchema.getFields().stream().map(Schema.Field::name).collect(Collectors.toList());
+ // now assert that the partition column is not in the target schema
+ assertFalse(tableFields.contains("partition_path"));
+ }
+
class TestDeltaSync extends DeltaSync {
public TestDeltaSync(HoodieDeltaStreamer.Config cfg, SparkSession sparkSession, SchemaProvider schemaProvider, TypedProperties props,