You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "bhat-vinay (via GitHub)" <gi...@apache.org> on 2023/12/07 12:45:14 UTC
[PR] [WIP] [HUDI-7040] Handle dropping of partition columns [hudi]
bhat-vinay opened a new pull request, #10272:
URL: https://github.com/apache/hudi/pull/10272
Issue:
There are two configs which when set in a certain manner throws exceptions or asserts
1. Configs to disable populating metadata fields (for each row)
2. Configs to drop partition columns (to save storage space) from a row
With #1 and #2, partition paths cannot be deduced using partition columns (as the partition columns are dropped higher up the stack. BulkInsertDataInternalWriterHelper::write(...) relied on metadata fields to extract partition path in such cases. But with #1 it is not possible resulting in asserts/exceptions.
The fix is to push down the dropping of partition columns down the stack after partition path is computed. The fix manipulates the raw 'InternalRow' row structure by only copying the relevent fields into a new 'InternalRow' structure. Each row is processed individually to drop the partition columns and copy it a to new 'InternalRow'
### Change Logs
Issue:
There are two configs which when set in a certain manner throws exceptions or asserts
1. Configs to disable populating metadata fields (for each row)
2. Configs to drop partition columns (to save storage space) from a row
With #1 and #2, partition paths cannot be deduced using partition columns (as the partition columns are dropped higher up the stack. BulkInsertDataInternalWriterHelper::write(...) relied on metadata fields to extract partition path in such cases. But with #1 it is not possible resulting in asserts/exceptions.
The fix is to push down the dropping of partition columns down the stack after partition path is computed. The fix manipulates the raw 'InternalRow' row structure by only copying the relevent fields into a new 'InternalRow' structure. Each row is processed individually to drop the partition columns and copy it a to new 'InternalRow'
### Impact
No piblic API or user facing changes. However, each InternalRow structure is processed and copied individually when
the config is set.
### Risk level (write none, low medium or high below)
None
### Documentation Update
None
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10272:
URL: https://github.com/apache/hudi/pull/10272#issuecomment-1850426262
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3827b7baca7d98831820df752b641afd5ab81f0a UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10272:
URL: https://github.com/apache/hudi/pull/10272#issuecomment-1849540641
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21434",
"triggerID" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"triggerType" : "PUSH"
}, {
"hash" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21436",
"triggerID" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21434)
* 3827b7baca7d98831820df752b641afd5ab81f0a Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21436)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [WIP] [HUDI-7040] Handle dropping of partition columns [hudi]
Posted by "bhat-vinay (via GitHub)" <gi...@apache.org>.
bhat-vinay commented on code in PR #10272:
URL: https://github.com/apache/hudi/pull/10272#discussion_r1421924315
##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/HoodieDatasetBulkInsertHelper.scala:
##########
@@ -243,21 +238,17 @@ object HoodieDatasetBulkInsertHelper
}
}
- private def dropPartitionColumns(df: DataFrame, config: HoodieWriteConfig): DataFrame = {
- val partitionPathFields = getPartitionPathFields(config).toSet
- val nestedPartitionPathFields = partitionPathFields.filter(f => f.contains('.'))
- if (nestedPartitionPathFields.nonEmpty) {
- logWarning(s"Can not drop nested partition path fields: $nestedPartitionPathFields")
- }
-
- val partitionPathCols = (partitionPathFields -- nestedPartitionPathFields).toSeq
-
- df.drop(partitionPathCols: _*)
- }
-
private def getPartitionPathFields(config: HoodieWriteConfig): Seq[String] = {
val keyGeneratorClassName = config.getString(HoodieWriteConfig.KEYGENERATOR_CLASS_NAME)
val keyGenerator = ReflectionUtils.loadClass(keyGeneratorClassName, new TypedProperties(config.getProps)).asInstanceOf[BuiltinKeyGenerator]
keyGenerator.getPartitionPathFields.asScala
}
+
+ def getPartitionPathCols(config: HoodieWriteConfig): Seq[String] = {
+ val partitionPathFields = getPartitionPathFields(config).toSet
+ val nestedPartitionPathFields = partitionPathFields.filter(f => f.contains('.'))
+
+ return (partitionPathFields -- nestedPartitionPathFields).toSeq
Review Comment:
Preserving the existing [behaviour](https://github.com/apache/hudi/blob/a7c01f6874b20ebebb24399995ed8e8aba09cb2a/hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/HoodieDatasetBulkInsertHelper.scala#L248).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #10272:
URL: https://github.com/apache/hudi/pull/10272#discussion_r1747946464
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieSparkSqlWriter.scala:
##########
@@ -365,6 +365,52 @@ class TestHoodieSparkSqlWriter {
testBulkInsertWithSortMode(BulkInsertSortMode.NONE, populateMetaFields)
}
+@Test
+def testBulkInsertForDropPartitionColumn(): Unit = {
+ //create a new table
+ val tableName = "trips_table"
+ val basePath = "file:///tmp/trips_table"
Review Comment:
bad miss! Fixing in https://github.com/apache/hudi/pull/11912
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #10272:
URL: https://github.com/apache/hudi/pull/10272#discussion_r1421929085
##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/HoodieDatasetBulkInsertHelper.scala:
##########
@@ -186,7 +179,9 @@ object HoodieDatasetBulkInsertHelper
}
try {
- iter.foreach(writer.write)
+ iter.foreach(row => {
+ writer.write(row)
+ })
Review Comment:
how about reverting this change?
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieSparkSqlWriter.scala:
##########
@@ -365,6 +365,40 @@ class TestHoodieSparkSqlWriter {
testBulkInsertWithSortMode(BulkInsertSortMode.NONE, populateMetaFields)
}
+@Test
+def testBulkInsertForDropPartitionColumn(): Unit = {
+ //create a new table
+ val tableName = "trips_table"
+ val basePath = "file:///tmp/trips_table"
+ val columns = Seq("ts", "uuid", "rider", "driver", "fare", "city")
+ val data =
+ Seq((1695159649087L, "334e26e9-8355-45cc-97c6-c31daf0df330", "rider-A", "driver-K", 19.10, "san_francisco"),
+ (1695091554788L, "e96c4396-3fad-413a-a942-4cb36106d721", "rider-C", "driver-M", 27.70, "san_francisco"),
+ (1695046462179L, "9909a8b1-2d15-4d3d-8ec9-efc48c536a00", "rider-D", "driver-L", 33.90, "san_francisco"),
+ (1695516137016L, "e3cf430c-889d-4015-bc98-59bdce1e530c", "rider-F", "driver-P", 34.15, "sao_paulo"),
+ (1695115999911L, "c8abbe79-8d89-47ea-b4ce-4d224bae5bfa", "rider-J", "driver-T", 17.85, "chennai"));
+
+ var inserts = spark.createDataFrame(data).toDF(columns: _*)
+ inserts.write.format("hudi").
+ option(DataSourceWriteOptions.PARTITIONPATH_FIELD.key(), "city").
+ option(HoodieWriteConfig.TABLE_NAME, tableName).
+ option("hoodie.datasource.write.recordkey.field", "uuid").
+ option("hoodie.datasource.write.precombine.field", "rider").
+ option("hoodie.datasource.write.operation", "bulk_insert").
+ option("hoodie.datasource.write.hive_style_partitioning", "true").
+ option("hoodie.populate.meta.fields", "false").
+ option("hoodie.datasource.write.drop.partition.columns", "true").
+ mode(SaveMode.Overwrite).
+ save(basePath)
+
+ // Ensure the partition column (i.e 'city') can be read back
+ val tripsDF = spark.read.format("hudi").load(basePath)
+ tripsDF.createOrReplaceTempView("trips_table")
+ spark.sql("SELECT uuid, fare, ts, rider, driver, city FROM trips_table").show()
+
+ // TODO: Peek into the raw parquet file and ensure city column is not written to the file
Review Comment:
Could you also add test for the TODO comment here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "vinothchandar (via GitHub)" <gi...@apache.org>.
vinothchandar commented on code in PR #10272:
URL: https://github.com/apache/hudi/pull/10272#discussion_r1747771322
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieSparkSqlWriter.scala:
##########
@@ -365,6 +365,52 @@ class TestHoodieSparkSqlWriter {
testBulkInsertWithSortMode(BulkInsertSortMode.NONE, populateMetaFields)
}
+@Test
+def testBulkInsertForDropPartitionColumn(): Unit = {
+ //create a new table
+ val tableName = "trips_table"
+ val basePath = "file:///tmp/trips_table"
Review Comment:
cannot do this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [WIP] [HUDI-7040] Handle dropping of partition columns [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #10272:
URL: https://github.com/apache/hudi/pull/10272#discussion_r1419165609
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java:
##########
@@ -1390,6 +1390,10 @@ public boolean shouldAllowMultiWriteOnSameInstant() {
return getBoolean(ALLOW_MULTI_WRITE_ON_SAME_INSTANT_ENABLE);
}
+ public boolean shouldDropPartitionColumns() {
Review Comment:
why is this needed? Isn't there aleady a getter for this config?
##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/HoodieDatasetBulkInsertHelper.scala:
##########
@@ -243,21 +238,17 @@ object HoodieDatasetBulkInsertHelper
}
}
- private def dropPartitionColumns(df: DataFrame, config: HoodieWriteConfig): DataFrame = {
- val partitionPathFields = getPartitionPathFields(config).toSet
- val nestedPartitionPathFields = partitionPathFields.filter(f => f.contains('.'))
- if (nestedPartitionPathFields.nonEmpty) {
- logWarning(s"Can not drop nested partition path fields: $nestedPartitionPathFields")
- }
-
- val partitionPathCols = (partitionPathFields -- nestedPartitionPathFields).toSeq
-
- df.drop(partitionPathCols: _*)
- }
-
private def getPartitionPathFields(config: HoodieWriteConfig): Seq[String] = {
val keyGeneratorClassName = config.getString(HoodieWriteConfig.KEYGENERATOR_CLASS_NAME)
val keyGenerator = ReflectionUtils.loadClass(keyGeneratorClassName, new TypedProperties(config.getProps)).asInstanceOf[BuiltinKeyGenerator]
keyGenerator.getPartitionPathFields.asScala
}
+
+ def getPartitionPathCols(config: HoodieWriteConfig): Seq[String] = {
+ val partitionPathFields = getPartitionPathFields(config).toSet
+ val nestedPartitionPathFields = partitionPathFields.filter(f => f.contains('.'))
+
+ return (partitionPathFields -- nestedPartitionPathFields).toSeq
Review Comment:
should we not include `nestedPartitionPathFields`?
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/BulkInsertDataInternalWriterHelper.java:
##########
@@ -124,7 +129,31 @@ public void write(InternalRow row) throws IOException {
lastKnownPartitionPath = partitionPath.clone();
}
- handle.write(row);
+ boolean shouldDropPartitionColumns = writeConfig.shouldDropPartitionColumns();
+ if (shouldDropPartitionColumns) {
+ // Drop the partition columns from the row
+ List<String> partitionCols = JavaConverters.<String>seqAsJavaList(HoodieDatasetBulkInsertHelper.getPartitionPathCols(this.writeConfig));
+ Set<Integer> partitionIdx = new HashSet<Integer>();
+ for (String col : partitionCols) {
+ partitionIdx.add(this.structType.fieldIndex(col));
+ }
+
+ // TODO: Assumes that InternalRow::toSeq(...) preserves the column ordering based on
+ // the supplied schema
Review Comment:
let's ensure that this is indeed the case
##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/HoodieDatasetBulkInsertHelper.scala:
##########
@@ -186,7 +179,9 @@ object HoodieDatasetBulkInsertHelper
}
try {
- iter.foreach(writer.write)
+ iter.foreach(row => {
+ writer.write(row)
+ })
Review Comment:
can keep as before if not doing any manipulation on row
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10272:
URL: https://github.com/apache/hudi/pull/10272#issuecomment-1849312466
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10272:
URL: https://github.com/apache/hudi/pull/10272#issuecomment-1849483356
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21434",
"triggerID" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"triggerType" : "PUSH"
}, {
"hash" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21436",
"triggerID" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21434)
* 3827b7baca7d98831820df752b641afd5ab81f0a Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21436)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope merged PR #10272:
URL: https://github.com/apache/hudi/pull/10272
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [WIP] [HUDI-7040] Handle dropping of partition columns [hudi]
Posted by "bhat-vinay (via GitHub)" <gi...@apache.org>.
bhat-vinay commented on code in PR #10272:
URL: https://github.com/apache/hudi/pull/10272#discussion_r1421922943
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java:
##########
@@ -1390,6 +1390,10 @@ public boolean shouldAllowMultiWriteOnSameInstant() {
return getBoolean(ALLOW_MULTI_WRITE_ON_SAME_INSTANT_ENABLE);
}
+ public boolean shouldDropPartitionColumns() {
Review Comment:
Did not find any in `HoodieWriteConfig`. The usages in other places depends on `DataSourceWriteOptions` which was warning about adding a circular dependency.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10272:
URL: https://github.com/apache/hudi/pull/10272#issuecomment-1849647551
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21434",
"triggerID" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"triggerType" : "PUSH"
}, {
"hash" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21436",
"triggerID" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3827b7baca7d98831820df752b641afd5ab81f0a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21436)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [WIP] [HUDI-7040] Handle dropping of partition columns [hudi]
Posted by "bhat-vinay (via GitHub)" <gi...@apache.org>.
bhat-vinay commented on code in PR #10272:
URL: https://github.com/apache/hudi/pull/10272#discussion_r1421923242
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/BulkInsertDataInternalWriterHelper.java:
##########
@@ -124,7 +129,31 @@ public void write(InternalRow row) throws IOException {
lastKnownPartitionPath = partitionPath.clone();
}
- handle.write(row);
+ boolean shouldDropPartitionColumns = writeConfig.shouldDropPartitionColumns();
+ if (shouldDropPartitionColumns) {
+ // Drop the partition columns from the row
+ List<String> partitionCols = JavaConverters.<String>seqAsJavaList(HoodieDatasetBulkInsertHelper.getPartitionPathCols(this.writeConfig));
+ Set<Integer> partitionIdx = new HashSet<Integer>();
+ for (String col : partitionCols) {
+ partitionIdx.add(this.structType.fieldIndex(col));
+ }
+
+ // TODO: Assumes that InternalRow::toSeq(...) preserves the column ordering based on
+ // the supplied schema
Review Comment:
Tested with a few different sizes and types. It preserved the column ordering.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10272:
URL: https://github.com/apache/hudi/pull/10272#issuecomment-1850443447
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21436",
"triggerID" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 3827b7baca7d98831820df752b641afd5ab81f0a Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21436)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10272:
URL: https://github.com/apache/hudi/pull/10272#issuecomment-1849474384
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21434",
"triggerID" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"triggerType" : "PUSH"
}, {
"hash" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "3827b7baca7d98831820df752b641afd5ab81f0a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21434)
* 3827b7baca7d98831820df752b641afd5ab81f0a UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [WIP] [HUDI-7040] Handle dropping of partition columns [hudi]
Posted by "bhat-vinay (via GitHub)" <gi...@apache.org>.
bhat-vinay commented on PR #10272:
URL: https://github.com/apache/hudi/pull/10272#issuecomment-1849294331
Thanks for the comments @codope. Addressed comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10272:
URL: https://github.com/apache/hudi/pull/10272#issuecomment-1849318007
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21434",
"triggerID" : "9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9e4cc4f0b2c56a589284434c7c9bd1ed12f6d568 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21434)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7040] Handle dropping of partition columns with populate meta fields disabled [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #10272:
URL: https://github.com/apache/hudi/pull/10272#discussion_r1747946464
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieSparkSqlWriter.scala:
##########
@@ -365,6 +365,52 @@ class TestHoodieSparkSqlWriter {
testBulkInsertWithSortMode(BulkInsertSortMode.NONE, populateMetaFields)
}
+@Test
+def testBulkInsertForDropPartitionColumn(): Unit = {
+ //create a new table
+ val tableName = "trips_table"
+ val basePath = "file:///tmp/trips_table"
Review Comment:
bad miss! Fixingin https://github.com/apache/hudi/pull/11912
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org