You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "nsivabalan (via GitHub)" <gi...@apache.org> on 2023/07/05 02:33:51 UTC
[GitHub] [hudi] nsivabalan opened a new pull request, #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
nsivabalan opened a new pull request, #9123:
URL: https://github.com/apache/hudi/pull/9123
### Change Logs
With the intent to simplify different config options with INSERT_INTO spark-sql, we are doing a overhaul. We have 3 to 4 configs with INSERT_INTO like Operation type, insert mode, drop dupes, enable bulk insert configs. Here is what the simplification brings in.
```
- We will introduce a new config named "hoodie.sql.write.operation" which will have 3 values ("insert", "bulk_insert" and "upsert"). Default value will be "insert" for INSERT_INTO.
- Deprecate hoodie.sql.insert.mode and "hoodie.sql.bulk.insert.enable".
- Also, enable "hoodie.merge.allow.duplicate.on.inserts" = true if operation type is "Insert" for both spark-sql and spark-ds. This will maintain duplicates but still help w/ small file management with "insert"s.
- Introduce a new config named "hoodie.datasource.insert.dedupe.policy" whose valid values are "ignore, fail and drop". Make "ignore" as default. "fail" will mimic "STRICT" mode we support as of now.
- Deprecate hoodie.datasource.insert.drop.dups.
```
When both old and new configs are set, new config will take effect.
When only new configs are set, new config will take effect.
When neither is set, new configs and their default will take effect.
When only old configs are set, old configs will take effect. Please do note that we are deprecating the use of these old configs. In 2 releases, we will completely remove these configs. So, would recommend users to migrate to new configs.
Note: old refers to "hoodie.sql.insert.mode" and new config refers to "hoodie.sql.write.operation".
Behavior change:
With this patch, we are also switching the default behavior with INSERT_INTO to use "insert" as the operation underneath. Until 0.13.1, default behavior was "upsert". In other words, if you ingest same batch of records in commit1 and in commit2, hudi will do an upsert and will return only the latest value with snapshot read. But with this patch, we are changing the default behavior to use "insert" as the name (INSERT_INTO) signifies. So, ingesting the same batch of records in commit1 and in commit2 will result in duplicates records with snapshot read. If users override the respective config, we will honor them, but the default behavior where none of the respective configs are overridden explicitly, will see a behavior change.
### Impact
Usability will be improved for spark-sql users as we have deprecated few confusing configs and tried to align with spark datasource writes. Also, this brings in a behavior change as well. With this patch, we are also switching the default behavior with INSERT_INTO to use "insert" as the operation underneath. Until 0.13.1, default behavior was "upsert". In other words, if you ingest same batch of records in commit1 and in commit2, hudi will do an upsert and will return only the latest value with snapshot read. But with this patch, we are changing the default behavior to use "insert" as the name (INSERT_INTO) signifies. So, ingesting the same batch of records in commit1 and in commit2 will result in duplicates records with snapshot read. If users override the respective config, we will honor them, but the default behavior where none of the respective configs are overridden explicitly, will see a behavior change.
### Risk level (write none, low medium or high below)
medium
### Documentation Update
We will have to call out the behavior change as part of our release docs and also update our quick start guide around the same.
### Contributor's checklist
- [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Change Logs and Impact were stated clearly
- [ ] Adequate tests were added if applicable
- [ ] CI passed
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1636223046
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
}, {
"hash" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589",
"triggerID" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* ca05555ec686f26a2786bc350f3dfb1a83baf3bc Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582)
* c4b55caaa515af207aa3ba1bef87cb1568d9b38a Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589)
<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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1636682278
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
}, {
"hash" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589",
"triggerID" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"triggerType" : "PUSH"
}, {
"hash" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18596",
"triggerID" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"triggerType" : "PUSH"
}, {
"hash" : "05554e2e034b32dd56599e1f62408c123888d9cb",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18609",
"triggerID" : "05554e2e034b32dd56599e1f62408c123888d9cb",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 92431edca469088ced64b1d92c7bbdc2e44d47a1 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18596)
* 05554e2e034b32dd56599e1f62408c123888d9cb Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18609)
<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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1634850953
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 5b48833e4d759cf072a3da49f91c7476bbf09b48 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533)
* a930f2ea7876f0336e66308a21a05fcbe7b0f7f5 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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1636607910
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
}, {
"hash" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589",
"triggerID" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"triggerType" : "PUSH"
}, {
"hash" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18596",
"triggerID" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 92431edca469088ced64b1d92c7bbdc2e44d47a1 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18596)
<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
[GitHub] [hudi] nsivabalan commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1253522263
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DataSourceOptions.scala:
##########
@@ -514,6 +520,29 @@ object DataSourceWriteOptions {
val RECONCILE_SCHEMA: ConfigProperty[java.lang.Boolean] = HoodieCommonConfig.RECONCILE_SCHEMA
+ val SQL_WRITE_OPERATION: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.sql.write.operation")
+ .defaultValue("insert")
+ .withDocumentation("Sql write operation to use with INSERT_INTO spark sql command. This comes with 3 possible values, bulk_insert, " +
+ "insert and upsert. bulk_insert is generally meant for initial loads and is known to be performant compared to insert. But bulk_insert may not " +
+ "do small file managmeent. If you prefer hudi to automatically managee small files, then you can go with \"insert\". There is no precombine " +
+ "(if there are duplicates within the same batch being ingested, same dups will be ingested) with bulk_insert and insert and there is no index " +
+ "look up as well. If you may use INSERT_INTO for mutable dataset, then you may have to set this config value to \"upsert\". With upsert, you will " +
+ "get both precombine and updates to existing records on storage is also honored. If not, you may see duplicates. ")
+
+ val NONE_INSERT_DUP_POLICY = "none"
+ val DROP_INSERT_DUP_POLICY = "drop"
+ val FAIL_INSERT_DUP_POLICY = "fail"
+
+ val INSERT_DUP_POLICY: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.datasource.insert.dup.policy")
Review Comment:
dedup kind of overlaps w/ combine.before.insert.
--
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
[GitHub] [hudi] nsivabalan commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1633096348
hey @zhuanshenbsj1 I know we are changing the behavior. But we looked at few other systems in similar space and everywhere INSERT_INTO can result in duplicates. And we are taking a hit on trying to de-dup when compared w/ others.
--
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
[GitHub] [hudi] danny0405 commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1261912747
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
> we do enable hoodie.merge.allow.duplicate.on.inserts
Do you mean disable?
--
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
[GitHub] [hudi] zhuanshenbsj1 commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "zhuanshenbsj1 (via GitHub)" <gi...@apache.org>.
zhuanshenbsj1 commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1624630506
https://github.com/apache/hudi/blob/0ca0999420ca36b777b23fc9cf3998ce8f31481f/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java#L527-L531
Should we directly modify the default value of "hoodie.merge.allow.duplicate.on.inserts" to true ? This parameter only takes effect in insert mode, and usually users don’t want to remove duplicates when using inserts, which will cause trouble for users.
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1636508104
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
}, {
"hash" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589",
"triggerID" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"triggerType" : "PUSH"
}, {
"hash" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* c4b55caaa515af207aa3ba1bef87cb1568d9b38a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589)
* 92431edca469088ced64b1d92c7bbdc2e44d47a1 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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1635042631
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* a930f2ea7876f0336e66308a21a05fcbe7b0f7f5 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564)
<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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1635634401
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* ca05555ec686f26a2786bc350f3dfb1a83baf3bc Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582)
<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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1636212208
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
}, {
"hash" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* ca05555ec686f26a2786bc350f3dfb1a83baf3bc Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582)
* c4b55caaa515af207aa3ba1bef87cb1568d9b38a 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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1621023467
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7708ff75ba467e2156b6396ee2886ec645b7b44f Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325)
<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
[GitHub] [hudi] nsivabalan commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1257548654
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
this is not de-dup. this is actually achieving what you are claiming Danny.
i.e.
if you ingest RK1, val1 in commit and RK1, val2 in commit2 with insert operation type, snapshot will return both values only when you set "MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key" = true.
--
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
[GitHub] [hudi] codope commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1258169165
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -187,29 +218,38 @@ trait ProvidesHoodieConfig extends Logging {
val insertModeOpt = combinedOpts.get(SQL_INSERT_MODE.key)
val insertModeSet = insertModeOpt.nonEmpty
+ val sqlWriteOperationOpt = combinedOpts.get(SQL_WRITE_OPERATION.key())
+ val sqlWriteOperationSet = sqlWriteOperationOpt.nonEmpty
+ val sqlWriteOperation = sqlWriteOperationOpt.getOrElse(SQL_WRITE_OPERATION.defaultValue())
+ val insertDupPolicy = combinedOpts.getOrElse(INSERT_DUP_POLICY.key(), INSERT_DUP_POLICY.defaultValue())
val insertMode = InsertMode.of(insertModeOpt.getOrElse(SQL_INSERT_MODE.defaultValue()))
val isNonStrictMode = insertMode == InsertMode.NON_STRICT
val isPartitionedTable = hoodieCatalogTable.partitionFields.nonEmpty
val combineBeforeInsert = hoodieCatalogTable.preCombineKey.nonEmpty && hoodieCatalogTable.primaryKeys.nonEmpty
- // NOTE: Target operation could be overridden by the user, therefore if it has been provided as an input
- // we'd prefer that value over auto-deduced operation. Otherwise, we deduce target operation type
+ // try to use sql write operation instead of legacy insert mode. If only insert mode is explicitly specified, we will uze
+ // o
+ val useLegacyInsertModeFlow = insertModeSet && !sqlWriteOperationSet
Review Comment:
ok let's make sure to call it out in release notes.
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1634867378
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 5b48833e4d759cf072a3da49f91c7476bbf09b48 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533)
* a930f2ea7876f0336e66308a21a05fcbe7b0f7f5 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564)
<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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1633224365
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* beb523cca98b4b62964c485e464d5eb1ce6e25a2 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432)
* 5b48833e4d759cf072a3da49f91c7476bbf09b48 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
[GitHub] [hudi] codope merged pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope merged PR #9123:
URL: https://github.com/apache/hudi/pull/9123
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1636513735
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
}, {
"hash" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589",
"triggerID" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"triggerType" : "PUSH"
}, {
"hash" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18596",
"triggerID" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* c4b55caaa515af207aa3ba1bef87cb1568d9b38a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589)
* 92431edca469088ced64b1d92c7bbdc2e44d47a1 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18596)
<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
[GitHub] [hudi] codope commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1261929493
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
Then it's alright. Somehow while reviewing this change i thought it's in `ProvidesHoodieConfig`. Only now I realised it's in `HoodieSparkSqlWriter` so should be fine.
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1636680322
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
}, {
"hash" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589",
"triggerID" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"triggerType" : "PUSH"
}, {
"hash" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18596",
"triggerID" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"triggerType" : "PUSH"
}, {
"hash" : "05554e2e034b32dd56599e1f62408c123888d9cb",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "05554e2e034b32dd56599e1f62408c123888d9cb",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 92431edca469088ced64b1d92c7bbdc2e44d47a1 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18596)
* 05554e2e034b32dd56599e1f62408c123888d9cb 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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1620943023
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7708ff75ba467e2156b6396ee2886ec645b7b44f Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325)
<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
[GitHub] [hudi] nsivabalan commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1257549916
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -187,29 +218,38 @@ trait ProvidesHoodieConfig extends Logging {
val insertModeOpt = combinedOpts.get(SQL_INSERT_MODE.key)
val insertModeSet = insertModeOpt.nonEmpty
+ val sqlWriteOperationOpt = combinedOpts.get(SQL_WRITE_OPERATION.key())
+ val sqlWriteOperationSet = sqlWriteOperationOpt.nonEmpty
+ val sqlWriteOperation = sqlWriteOperationOpt.getOrElse(SQL_WRITE_OPERATION.defaultValue())
+ val insertDupPolicy = combinedOpts.getOrElse(INSERT_DUP_POLICY.key(), INSERT_DUP_POLICY.defaultValue())
val insertMode = InsertMode.of(insertModeOpt.getOrElse(SQL_INSERT_MODE.defaultValue()))
val isNonStrictMode = insertMode == InsertMode.NON_STRICT
val isPartitionedTable = hoodieCatalogTable.partitionFields.nonEmpty
val combineBeforeInsert = hoodieCatalogTable.preCombineKey.nonEmpty && hoodieCatalogTable.primaryKeys.nonEmpty
- // NOTE: Target operation could be overridden by the user, therefore if it has been provided as an input
- // we'd prefer that value over auto-deduced operation. Otherwise, we deduce target operation type
+ // try to use sql write operation instead of legacy insert mode. If only insert mode is explicitly specified, we will uze
+ // o
+ val useLegacyInsertModeFlow = insertModeSet && !sqlWriteOperationSet
val operation = combinedOpts.getOrElse(OPERATION.key,
+ if (useLegacyInsertModeFlow) {
+ // NOTE: Target operation could be overridden by the user, therefore if it has been provided as an input
+ // we'd prefer that value over auto-deduced operation. Otherwise, we deduce target operation type
deduceWriteOperationForInsertInfo(isPartitionedTable, isOverwritePartition, isOverwriteTable, insertModeSet, dropDuplicate,
- enableBulkInsert, isInsertInto, isNonStrictMode, combineBeforeInsert))
+ enableBulkInsert, isInsertInto, isNonStrictMode, combineBeforeInsert)
+ } else {
+ deduceSqlWriteOperation(isOverwritePartition, isOverwriteTable, sqlWriteOperation)
+ }
+ )
- val payloadClassName = if (operation == UPSERT_OPERATION_OPT_VAL &&
- tableType == COW_TABLE_TYPE_OPT_VAL && insertMode == InsertMode.STRICT) {
- // Validate duplicate key for COW, for MOR it will do the merge with the DefaultHoodieRecordPayload
- // on reading.
- // TODO use HoodieSparkValidateDuplicateKeyRecordMerger when SparkRecordMerger is default
- classOf[ValidateDuplicateKeyPayload].getCanonicalName
- } else if (operation == INSERT_OPERATION_OPT_VAL && tableType == COW_TABLE_TYPE_OPT_VAL &&
- insertMode == InsertMode.STRICT){
- // Validate duplicate key for inserts to COW table when using strict insert mode.
- classOf[ValidateDuplicateKeyPayload].getCanonicalName
+ val payloadClassName = if (useLegacyInsertModeFlow) {
+ deducePayloadClassNameLegacy(operation, tableType, insertMode)
} else {
- classOf[OverwriteWithLatestAvroPayload].getCanonicalName
+ // should we also consider old way of doing things.
Review Comment:
this is already taken care in deducePayloadClassNameLegacy, none of the downstream methods do anything differently. Its only used to deduce the payload class
--
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-6478] Simplifying INSERT_INTO configs for spark-sql [hudi]
Posted by "TengHuo (via GitHub)" <gi...@apache.org>.
TengHuo commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1502195393
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/TestInsertTable.scala:
##########
@@ -1578,5 +1578,333 @@ class TestInsertTable extends HoodieSparkSqlTestBase {
)
}
}
+ spark.sessionState.conf.unsetConf("hoodie.datasource.write.operation")
+ }
+
+ /**
+ * When neither of strict mode nor sql.write.operation is set, sql write operation takes precedence and default value is chosen.
+ */
+ test("Test sql write operation with INSERT_INTO No explicit configs") {
+ spark.sessionState.conf.unsetConf("hoodie.sql.write.operation")
+ spark.sessionState.conf.unsetConf("hoodie.sql.insert.mode")
+ spark.sessionState.conf.unsetConf("hoodie.datasource.insert.dup.policy")
+ spark.sessionState.conf.unsetConf("hoodie.datasource.write.operation")
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow","mor").foreach {tableType =>
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateData(tableType, tableName, tmp)
+ }
+ }
+ })
+ }
+
+ test("Test sql write operation with INSERT_INTO override both strict mode and sql write operation") {
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow","mor").foreach { tableType =>
+ Seq(WriteOperationType.INSERT, WriteOperationType.BULK_INSERT, WriteOperationType.UPSERT).foreach { operation =>
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateData(tableType, tableName, tmp, operation,
+ List("set hoodie.sql.write.operation = " + operation.value(), "set hoodie.sql.insert.mode = upsert"))
+ }
+ }
+ }
+ })
+ }
+
+ test("Test sql write operation with INSERT_INTO override only sql write operation") {
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow","mor").foreach {tableType =>
+ Seq(WriteOperationType.INSERT, WriteOperationType.BULK_INSERT, WriteOperationType.UPSERT).foreach { operation =>
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateData(tableType, tableName, tmp, operation,
+ List("set hoodie.sql.write.operation = " + operation.value()))
+ }
+ }
+ }
+ })
+ }
+
+ test("Test sql write operation with INSERT_INTO override only strict mode") {
+ spark.sessionState.conf.unsetConf("hoodie.sql.write.operation")
+ spark.sessionState.conf.unsetConf("hoodie.sql.insert.mode")
+ spark.sessionState.conf.unsetConf("hoodie.datasource.insert.dup.policy")
+ spark.sessionState.conf.unsetConf("hoodie.datasource.write.operation")
+ spark.sessionState.conf.unsetConf("hoodie.sql.bulk.insert.enable")
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow","mor").foreach {tableType =>
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateData(tableType, tableName, tmp, WriteOperationType.UPSERT,
+ List("set hoodie.sql.insert.mode = upsert"))
+ }
+ }
+ })
+ }
+
+ def ingestAndValidateData(tableType: String, tableName: String, tmp: File,
+ expectedOperationtype: WriteOperationType = WriteOperationType.INSERT,
+ setOptions: List[String] = List.empty) : Unit = {
+ setOptions.foreach(entry => {
+ spark.sql(entry)
+ })
+
+ spark.sql(
+ s"""
+ |create table $tableName (
+ | id int,
+ | name string,
+ | price double,
+ | dt string
+ |) using hudi
+ | tblproperties (
+ | type = '$tableType',
+ | primaryKey = 'id',
+ | preCombine = 'name'
Review Comment:
The name of this key should be `preCombineField` here.
`keyTableConfigMapping` in `HoodieOptionConfig` ->

--
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
[GitHub] [hudi] danny0405 commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1252496143
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
I feel by default, we should never dedup for INSERT operation. That keeps the behavior in line with regular RDBMS.
--
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
[GitHub] [hudi] nsivabalan commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1627844217
hey @danny0405 @codope : Updated the patch. rebased w/ latest master.
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1627853487
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7708ff75ba467e2156b6396ee2886ec645b7b44f Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325)
* beb523cca98b4b62964c485e464d5eb1ce6e25a2 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
[GitHub] [hudi] codope commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1258171744
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
I think this config is also used for datasource inserts. So, now the behavior of datasource and sql will differ for the insert operation?
--
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
[GitHub] [hudi] nsivabalan commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1257545983
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DataSourceOptions.scala:
##########
@@ -514,6 +520,29 @@ object DataSourceWriteOptions {
val RECONCILE_SCHEMA: ConfigProperty[java.lang.Boolean] = HoodieCommonConfig.RECONCILE_SCHEMA
+ val SQL_WRITE_OPERATION: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.sql.write.operation")
+ .defaultValue("insert")
Review Comment:
this is mainly used w/ INSERT_INTO. So, delete does not make sense.
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DataSourceOptions.scala:
##########
@@ -514,6 +520,29 @@ object DataSourceWriteOptions {
val RECONCILE_SCHEMA: ConfigProperty[java.lang.Boolean] = HoodieCommonConfig.RECONCILE_SCHEMA
+ val SQL_WRITE_OPERATION: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.sql.write.operation")
+ .defaultValue("insert")
+ .withDocumentation("Sql write operation to use with INSERT_INTO spark sql command. This comes with 3 possible values, bulk_insert, " +
+ "insert and upsert. bulk_insert is generally meant for initial loads and is known to be performant compared to insert. But bulk_insert may not " +
+ "do small file managmeent. If you prefer hudi to automatically managee small files, then you can go with \"insert\". There is no precombine " +
+ "(if there are duplicates within the same batch being ingested, same dups will be ingested) with bulk_insert and insert and there is no index " +
+ "look up as well. If you may use INSERT_INTO for mutable dataset, then you may have to set this config value to \"upsert\". With upsert, you will " +
+ "get both precombine and updates to existing records on storage is also honored. If not, you may see duplicates. ")
+
+ val NONE_INSERT_DUP_POLICY = "none"
+ val DROP_INSERT_DUP_POLICY = "drop"
+ val FAIL_INSERT_DUP_POLICY = "fail"
+
+ val INSERT_DUP_POLICY: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.datasource.insert.dup.policy")
+ .defaultValue(NONE_INSERT_DUP_POLICY)
Review Comment:
sure
--
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
[GitHub] [hudi] nsivabalan commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1257546160
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -187,29 +218,38 @@ trait ProvidesHoodieConfig extends Logging {
val insertModeOpt = combinedOpts.get(SQL_INSERT_MODE.key)
val insertModeSet = insertModeOpt.nonEmpty
+ val sqlWriteOperationOpt = combinedOpts.get(SQL_WRITE_OPERATION.key())
+ val sqlWriteOperationSet = sqlWriteOperationOpt.nonEmpty
+ val sqlWriteOperation = sqlWriteOperationOpt.getOrElse(SQL_WRITE_OPERATION.defaultValue())
+ val insertDupPolicy = combinedOpts.getOrElse(INSERT_DUP_POLICY.key(), INSERT_DUP_POLICY.defaultValue())
val insertMode = InsertMode.of(insertModeOpt.getOrElse(SQL_INSERT_MODE.defaultValue()))
val isNonStrictMode = insertMode == InsertMode.NON_STRICT
val isPartitionedTable = hoodieCatalogTable.partitionFields.nonEmpty
val combineBeforeInsert = hoodieCatalogTable.preCombineKey.nonEmpty && hoodieCatalogTable.primaryKeys.nonEmpty
- // NOTE: Target operation could be overridden by the user, therefore if it has been provided as an input
- // we'd prefer that value over auto-deduced operation. Otherwise, we deduce target operation type
+ // try to use sql write operation instead of legacy insert mode. If only insert mode is explicitly specified, we will uze
+ // o
+ val useLegacyInsertModeFlow = insertModeSet && !sqlWriteOperationSet
Review Comment:
Nope, we should call it out in our docs that with spark sql INSERT_INTO, users are expected to set this new config. If DataSourceWriteOperations.OPERATION, it may not be honored
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1627893231
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* beb523cca98b4b62964c485e464d5eb1ce6e25a2 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432)
<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
[GitHub] [hudi] nsivabalan commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1633199465
hey @codope : not sure I understand your question here.
`I think this config is also used for datasource inserts. So, now the behavior of datasource and sql will differ for the insert operation? `
We are aligning the behavior across both w/ this patch. lets sync up f2f and resolve any pending feedback.
--
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
[GitHub] [hudi] danny0405 commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1252497920
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -112,6 +113,36 @@ trait ProvidesHoodieConfig extends Logging {
}
}
+ private def deducePayloadClassNameLegacy(operation: String, tableType: String, insertMode: InsertMode): String = {
+ if (operation == UPSERT_OPERATION_OPT_VAL &&
+ tableType == COW_TABLE_TYPE_OPT_VAL && insertMode == InsertMode.STRICT) {
+ // Validate duplicate key for COW, for MOR it will do the merge with the DefaultHoodieRecordPayload
+ // on reading.
+ // TODO use HoodieSparkValidateDuplicateKeyRecordMerger when SparkRecordMerger is default
+ classOf[ValidateDuplicateKeyPayload].getCanonicalName
+ } else if (operation == INSERT_OPERATION_OPT_VAL && tableType == COW_TABLE_TYPE_OPT_VAL &&
+ insertMode == InsertMode.STRICT){
+ // Validate duplicate key for inserts to COW table when using strict insert mode.
+ classOf[ValidateDuplicateKeyPayload].getCanonicalName
+ } else {
+ classOf[OverwriteWithLatestAvroPayload].getCanonicalName
+ }
Review Comment:
By default, should we use `DefaultHoodieRecordPayload` instead ?
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1635411528
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* a930f2ea7876f0336e66308a21a05fcbe7b0f7f5 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564)
* ca05555ec686f26a2786bc350f3dfb1a83baf3bc 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
[GitHub] [hudi] danny0405 commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1255177050
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
There is no much meaningness to keep backwards compatible if the behavior itself is not correct from user's intuition,
because most of the users that use `INSERT` operation does not need deduplication and they do not want to specify a record key either.
--
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
[GitHub] [hudi] danny0405 commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1257660429
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
Yeah, kind of obscure from the first sight, why not just put the default value `hoodie.merge.allow.duplicate.on.inserts` as true.
--
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
[GitHub] [hudi] codope commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1252918477
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DataSourceOptions.scala:
##########
@@ -430,19 +430,23 @@ object DataSourceWriteOptions {
/**
* Enable the bulk insert for sql insert statement.
*/
+ @Deprecated
Review Comment:
please also mark `.deprecatedAfter("0.14.0")` here and for all below deprecated configs
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DataSourceOptions.scala:
##########
@@ -514,6 +520,29 @@ object DataSourceWriteOptions {
val RECONCILE_SCHEMA: ConfigProperty[java.lang.Boolean] = HoodieCommonConfig.RECONCILE_SCHEMA
+ val SQL_WRITE_OPERATION: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.sql.write.operation")
+ .defaultValue("insert")
+ .withDocumentation("Sql write operation to use with INSERT_INTO spark sql command. This comes with 3 possible values, bulk_insert, " +
+ "insert and upsert. bulk_insert is generally meant for initial loads and is known to be performant compared to insert. But bulk_insert may not " +
+ "do small file managmeent. If you prefer hudi to automatically managee small files, then you can go with \"insert\". There is no precombine " +
+ "(if there are duplicates within the same batch being ingested, same dups will be ingested) with bulk_insert and insert and there is no index " +
+ "look up as well. If you may use INSERT_INTO for mutable dataset, then you may have to set this config value to \"upsert\". With upsert, you will " +
+ "get both precombine and updates to existing records on storage is also honored. If not, you may see duplicates. ")
+
+ val NONE_INSERT_DUP_POLICY = "none"
+ val DROP_INSERT_DUP_POLICY = "drop"
+ val FAIL_INSERT_DUP_POLICY = "fail"
+
+ val INSERT_DUP_POLICY: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.datasource.insert.dup.policy")
Review Comment:
does `hoodie.datasource.insert.dedupe.policy` sounds better?
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DataSourceOptions.scala:
##########
@@ -514,6 +520,29 @@ object DataSourceWriteOptions {
val RECONCILE_SCHEMA: ConfigProperty[java.lang.Boolean] = HoodieCommonConfig.RECONCILE_SCHEMA
+ val SQL_WRITE_OPERATION: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.sql.write.operation")
+ .defaultValue("insert")
Review Comment:
can also add `.withValidValues("insert", "upsert", "bulk_insert")`.
i'm also thinking if we should allow delete as well? ideally, we would want this to be similar to datasource write operations as much as possible.
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DataSourceOptions.scala:
##########
@@ -514,6 +520,29 @@ object DataSourceWriteOptions {
val RECONCILE_SCHEMA: ConfigProperty[java.lang.Boolean] = HoodieCommonConfig.RECONCILE_SCHEMA
+ val SQL_WRITE_OPERATION: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.sql.write.operation")
+ .defaultValue("insert")
+ .withDocumentation("Sql write operation to use with INSERT_INTO spark sql command. This comes with 3 possible values, bulk_insert, " +
+ "insert and upsert. bulk_insert is generally meant for initial loads and is known to be performant compared to insert. But bulk_insert may not " +
+ "do small file managmeent. If you prefer hudi to automatically managee small files, then you can go with \"insert\". There is no precombine " +
+ "(if there are duplicates within the same batch being ingested, same dups will be ingested) with bulk_insert and insert and there is no index " +
+ "look up as well. If you may use INSERT_INTO for mutable dataset, then you may have to set this config value to \"upsert\". With upsert, you will " +
+ "get both precombine and updates to existing records on storage is also honored. If not, you may see duplicates. ")
+
+ val NONE_INSERT_DUP_POLICY = "none"
+ val DROP_INSERT_DUP_POLICY = "drop"
+ val FAIL_INSERT_DUP_POLICY = "fail"
+
+ val INSERT_DUP_POLICY: ConfigProperty[String] = ConfigProperty
+ .key("hoodie.datasource.insert.dup.policy")
+ .defaultValue(NONE_INSERT_DUP_POLICY)
Review Comment:
can also add `.withValidValues(NONE_INSERT_DUP_POLICY, DROP_INSERT_DUP_POLICY, FAIL_INSERT_DUP_POLICY)`
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -187,29 +218,38 @@ trait ProvidesHoodieConfig extends Logging {
val insertModeOpt = combinedOpts.get(SQL_INSERT_MODE.key)
val insertModeSet = insertModeOpt.nonEmpty
+ val sqlWriteOperationOpt = combinedOpts.get(SQL_WRITE_OPERATION.key())
+ val sqlWriteOperationSet = sqlWriteOperationOpt.nonEmpty
+ val sqlWriteOperation = sqlWriteOperationOpt.getOrElse(SQL_WRITE_OPERATION.defaultValue())
+ val insertDupPolicy = combinedOpts.getOrElse(INSERT_DUP_POLICY.key(), INSERT_DUP_POLICY.defaultValue())
val insertMode = InsertMode.of(insertModeOpt.getOrElse(SQL_INSERT_MODE.defaultValue()))
val isNonStrictMode = insertMode == InsertMode.NON_STRICT
val isPartitionedTable = hoodieCatalogTable.partitionFields.nonEmpty
val combineBeforeInsert = hoodieCatalogTable.preCombineKey.nonEmpty && hoodieCatalogTable.primaryKeys.nonEmpty
- // NOTE: Target operation could be overridden by the user, therefore if it has been provided as an input
- // we'd prefer that value over auto-deduced operation. Otherwise, we deduce target operation type
+ // try to use sql write operation instead of legacy insert mode. If only insert mode is explicitly specified, we will uze
+ // o
+ val useLegacyInsertModeFlow = insertModeSet && !sqlWriteOperationSet
Review Comment:
what is user has also set `DataSourceWriteOperations.OPERATION`? i think we may have to reconcile with that.
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -187,29 +218,38 @@ trait ProvidesHoodieConfig extends Logging {
val insertModeOpt = combinedOpts.get(SQL_INSERT_MODE.key)
val insertModeSet = insertModeOpt.nonEmpty
+ val sqlWriteOperationOpt = combinedOpts.get(SQL_WRITE_OPERATION.key())
+ val sqlWriteOperationSet = sqlWriteOperationOpt.nonEmpty
+ val sqlWriteOperation = sqlWriteOperationOpt.getOrElse(SQL_WRITE_OPERATION.defaultValue())
+ val insertDupPolicy = combinedOpts.getOrElse(INSERT_DUP_POLICY.key(), INSERT_DUP_POLICY.defaultValue())
val insertMode = InsertMode.of(insertModeOpt.getOrElse(SQL_INSERT_MODE.defaultValue()))
val isNonStrictMode = insertMode == InsertMode.NON_STRICT
val isPartitionedTable = hoodieCatalogTable.partitionFields.nonEmpty
val combineBeforeInsert = hoodieCatalogTable.preCombineKey.nonEmpty && hoodieCatalogTable.primaryKeys.nonEmpty
- // NOTE: Target operation could be overridden by the user, therefore if it has been provided as an input
- // we'd prefer that value over auto-deduced operation. Otherwise, we deduce target operation type
+ // try to use sql write operation instead of legacy insert mode. If only insert mode is explicitly specified, we will uze
+ // o
Review Comment:
looks incomplete. please fix the comment.
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -112,6 +113,36 @@ trait ProvidesHoodieConfig extends Logging {
}
}
+ private def deducePayloadClassNameLegacy(operation: String, tableType: String, insertMode: InsertMode): String = {
+ if (operation == UPSERT_OPERATION_OPT_VAL &&
+ tableType == COW_TABLE_TYPE_OPT_VAL && insertMode == InsertMode.STRICT) {
+ // Validate duplicate key for COW, for MOR it will do the merge with the DefaultHoodieRecordPayload
+ // on reading.
+ // TODO use HoodieSparkValidateDuplicateKeyRecordMerger when SparkRecordMerger is default
+ classOf[ValidateDuplicateKeyPayload].getCanonicalName
+ } else if (operation == INSERT_OPERATION_OPT_VAL && tableType == COW_TABLE_TYPE_OPT_VAL &&
+ insertMode == InsertMode.STRICT){
+ // Validate duplicate key for inserts to COW table when using strict insert mode.
+ classOf[ValidateDuplicateKeyPayload].getCanonicalName
+ } else {
+ classOf[OverwriteWithLatestAvroPayload].getCanonicalName
+ }
Review Comment:
We can consider that in a separate patch. This is just a refactoring to a separate method.
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
i generally agree with this point but i think we want to keep the default backwards compatible.
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -187,29 +218,38 @@ trait ProvidesHoodieConfig extends Logging {
val insertModeOpt = combinedOpts.get(SQL_INSERT_MODE.key)
val insertModeSet = insertModeOpt.nonEmpty
+ val sqlWriteOperationOpt = combinedOpts.get(SQL_WRITE_OPERATION.key())
+ val sqlWriteOperationSet = sqlWriteOperationOpt.nonEmpty
+ val sqlWriteOperation = sqlWriteOperationOpt.getOrElse(SQL_WRITE_OPERATION.defaultValue())
+ val insertDupPolicy = combinedOpts.getOrElse(INSERT_DUP_POLICY.key(), INSERT_DUP_POLICY.defaultValue())
val insertMode = InsertMode.of(insertModeOpt.getOrElse(SQL_INSERT_MODE.defaultValue()))
val isNonStrictMode = insertMode == InsertMode.NON_STRICT
val isPartitionedTable = hoodieCatalogTable.partitionFields.nonEmpty
val combineBeforeInsert = hoodieCatalogTable.preCombineKey.nonEmpty && hoodieCatalogTable.primaryKeys.nonEmpty
- // NOTE: Target operation could be overridden by the user, therefore if it has been provided as an input
- // we'd prefer that value over auto-deduced operation. Otherwise, we deduce target operation type
+ // try to use sql write operation instead of legacy insert mode. If only insert mode is explicitly specified, we will uze
+ // o
+ val useLegacyInsertModeFlow = insertModeSet && !sqlWriteOperationSet
val operation = combinedOpts.getOrElse(OPERATION.key,
+ if (useLegacyInsertModeFlow) {
+ // NOTE: Target operation could be overridden by the user, therefore if it has been provided as an input
+ // we'd prefer that value over auto-deduced operation. Otherwise, we deduce target operation type
deduceWriteOperationForInsertInfo(isPartitionedTable, isOverwritePartition, isOverwriteTable, insertModeSet, dropDuplicate,
- enableBulkInsert, isInsertInto, isNonStrictMode, combineBeforeInsert))
+ enableBulkInsert, isInsertInto, isNonStrictMode, combineBeforeInsert)
+ } else {
+ deduceSqlWriteOperation(isOverwritePartition, isOverwriteTable, sqlWriteOperation)
+ }
+ )
- val payloadClassName = if (operation == UPSERT_OPERATION_OPT_VAL &&
- tableType == COW_TABLE_TYPE_OPT_VAL && insertMode == InsertMode.STRICT) {
- // Validate duplicate key for COW, for MOR it will do the merge with the DefaultHoodieRecordPayload
- // on reading.
- // TODO use HoodieSparkValidateDuplicateKeyRecordMerger when SparkRecordMerger is default
- classOf[ValidateDuplicateKeyPayload].getCanonicalName
- } else if (operation == INSERT_OPERATION_OPT_VAL && tableType == COW_TABLE_TYPE_OPT_VAL &&
- insertMode == InsertMode.STRICT){
- // Validate duplicate key for inserts to COW table when using strict insert mode.
- classOf[ValidateDuplicateKeyPayload].getCanonicalName
+ val payloadClassName = if (useLegacyInsertModeFlow) {
+ deducePayloadClassNameLegacy(operation, tableType, insertMode)
} else {
- classOf[OverwriteWithLatestAvroPayload].getCanonicalName
+ // should we also consider old way of doing things.
Review Comment:
i think we should. we can change the behavior in 1.x. But, in 0.14.0, we should map the previous config value to the new config value, e.g. `STRICT` is equivalent to `FAIL_INSERT_DUP_POLICY`.
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/TestInsertTable.scala:
##########
@@ -1499,4 +1500,341 @@ class TestInsertTable extends HoodieSparkSqlTestBase {
assertEquals(3, df.select(HoodieRecord.RECORD_KEY_METADATA_FIELD).count())
}
}
+
+ /**
+ * When neither of strict mode nor sql.write.operation is set, sql write operation takes precedence and default value is chosen.
+ */
+ test("Test sql write operation with INSERT_INTO No explicit configs") {
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow","mor").foreach {tableType =>
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateData(tableType, tableName, tmp)
+ }
+ }
+ })
+ }
+
+ test("Test sql write operation with INSERT_INTO override both strict mode and sql write operation") {
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow","mor").foreach { tableType =>
+ Seq(WriteOperationType.INSERT, WriteOperationType.BULK_INSERT, WriteOperationType.UPSERT).foreach { operation =>
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateData(tableType, tableName, tmp, operation,
+ List("set hoodie.sql.write.operation = " + operation.value(), "set hoodie.sql.insert.mode = upsert"))
+ }
+ }
+ }
+ })
+ }
+
+ test("Test sql write operation with INSERT_INTO override only sql write operation") {
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow","mor").foreach {tableType =>
+ Seq(WriteOperationType.INSERT, WriteOperationType.BULK_INSERT, WriteOperationType.UPSERT).foreach { operation =>
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateData(tableType, tableName, tmp, operation,
+ List("set hoodie.sql.write.operation = " + operation.value()))
+ }
+ }
+ }
+ })
+ }
+
+ test("Test sql write operation with INSERT_INTO override only strict mode") {
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow","mor").foreach {tableType =>
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateData(tableType, tableName, tmp, WriteOperationType.UPSERT,
+ List("set hoodie.sql.insert.mode = upsert"))
+ }
+ }
+ })
+ }
+
+ def ingestAndValidateData(tableType: String, tableName: String, tmp: File,
+ expectedOperationtype: WriteOperationType = WriteOperationType.INSERT,
+ setOptions: List[String] = List.empty) : Unit = {
+ spark.sql(
+ s"""
+ |create table $tableName (
+ | id int,
+ | name string,
+ | price double,
+ | dt string
+ |) using hudi
+ | tblproperties (
+ | type = '$tableType',
+ | primaryKey = 'id',
+ | preCombine = 'name'
+ | )
+ | partitioned by (dt)
+ | location '${tmp.getCanonicalPath}/$tableName'
+ """.stripMargin)
+ setOptions.foreach(entry => {
+ spark.sql(entry)
+ })
+
+ spark.sql(s"insert into $tableName values(1, 'a1', 10, '2021-07-18')")
+
+ assertResult(expectedOperationtype) {
+ getLastCommitMetadata(spark, s"${tmp.getCanonicalPath}/$tableName").getOperationType
+ }
+ checkAnswer(s"select id, name, price, dt from $tableName")(
+ Seq(1, "a1", 10.0, "2021-07-18")
+ )
+
+ // insert record again but w/ diff values but same primary key. Since "insert" is chosen as operation type,
+ // dups should be seen w/ snapshot query
+ spark.sql(
+ s"""
+ | insert into $tableName values
+ | (1, 'a1_1', 10, "2021-07-18"),
+ | (2, 'a2', 20, "2021-07-18"),
+ | (2, 'a2_2', 30, "2021-07-18")
+ """.stripMargin)
+
+ assertResult(expectedOperationtype) {
+ getLastCommitMetadata(spark, s"${tmp.getCanonicalPath}/$tableName").getOperationType
+ }
+ if (expectedOperationtype == WriteOperationType.UPSERT) {
+ // dedup should happen within same batch being ingested and existing records on storage should get updated
+ checkAnswer(s"select id, name, price, dt from $tableName order by id")(
+ Seq(1, "a1_1", 10.0, "2021-07-18"),
+ Seq(2, "a2_2", 30.0, "2021-07-18")
+ )
+ } else {
+ // no dedup across batches
+ checkAnswer(s"select id, name, price, dt from $tableName order by id")(
+ Seq(1, "a1", 10.0, "2021-07-18"),
+ Seq(1, "a1_1", 10.0, "2021-07-18"),
+ // Seq(2, "a2", 20.0, "2021-07-18"), // preCombine within same batch kicks in if preCombine is set
+ Seq(2, "a2_2", 30.0, "2021-07-18")
+ )
+ }
+ spark.sessionState.conf.unsetConf("hoodie.sql.write.operation")
+ spark.sessionState.conf.unsetConf("hoodie.sql.insert.mode")
+ }
+
+ test("Test insert dup policy with INSERT_INTO explicit new configs INSERT operation ") {
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow","mor").foreach {tableType =>
+ val operation = WriteOperationType.INSERT
+ Seq(NONE_INSERT_DUP_POLICY, DROP_INSERT_DUP_POLICY).foreach { dupPolicy =>
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateDataDupPolicy(tableType, tableName, tmp, operation,
+ List("set hoodie.sql.write.operation = " + operation.value(), "set " + DataSourceWriteOptions.INSERT_DUP_POLICY.key() + " = " + dupPolicy),
+ dupPolicy)
+ }
+ }
+ }
+ })
+ }
+
+ test("Test insert dup policy with INSERT_INTO explicit new configs BULK_INSERT operation ") {
+ withRecordType()(withTempDir { tmp =>
+ Seq("cow").foreach {tableType =>
+ val operation = WriteOperationType.BULK_INSERT
+ val dupPolicy = NONE_INSERT_DUP_POLICY
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateDataDupPolicy(tableType, tableName, tmp, operation,
+ List("set hoodie.sql.write.operation = " + operation.value(), "set " + DataSourceWriteOptions.INSERT_DUP_POLICY.key() + " = " + dupPolicy),
+ dupPolicy)
+ }
+ }
+ })
+ }
+
+ test("Test DROP insert dup policy with INSERT_INTO explicit new configs BULK INSERT operation") {
+ withRecordType(Seq(HoodieRecordType.AVRO))(withTempDir { tmp =>
+ Seq("cow").foreach {tableType =>
+ val operation = WriteOperationType.BULK_INSERT
+ val dupPolicy = DROP_INSERT_DUP_POLICY
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateDataDupPolicy(tableType, tableName, tmp, operation,
+ List("set hoodie.sql.write.operation = " + operation.value(), "set " + DataSourceWriteOptions.INSERT_DUP_POLICY.key() + " = " + dupPolicy),
+ dupPolicy)
+ }
+ }
+ })
+ }
+
+ test("Test FAIL insert dup policy with INSERT_INTO explicit new configs") {
+ withRecordType(Seq(HoodieRecordType.AVRO))(withTempDir { tmp =>
+ Seq("cow").foreach {tableType =>
+ val operation = WriteOperationType.UPSERT
+ val dupPolicy = FAIL_INSERT_DUP_POLICY
+ withTable(generateTableName) { tableName =>
+ ingestAndValidateDataDupPolicy(tableType, tableName, tmp, operation,
+ List("set hoodie.sql.write.operation = " + operation.value(), "set " + DataSourceWriteOptions.INSERT_DUP_POLICY.key() + " = " + dupPolicy),
+ dupPolicy, true)
+ }
+ }
+ })
+ }
+
+ def ingestAndValidateDataDupPolicy(tableType: String, tableName: String, tmp: File,
+ expectedOperationtype: WriteOperationType = WriteOperationType.INSERT,
+ setOptions: List[String] = List.empty, insertDupPolicy : String = NONE_INSERT_DUP_POLICY,
+ expectExceptionOnSecondBatch: Boolean = false) : Unit = {
+ spark.sql(
+ s"""
+ |create table $tableName (
+ | id int,
+ | name string,
+ | price double,
+ | dt string
+ |) using hudi
+ | tblproperties (
+ | type = '$tableType',
+ | primaryKey = 'id',
+ | preCombine = 'name'
+ | )
+ | partitioned by (dt)
+ | location '${tmp.getCanonicalPath}/$tableName'
+ """.stripMargin)
+ // set additional options
+ setOptions.foreach(entry => {
+ spark.sql(entry)
+ })
+
+ spark.sql(s"insert into $tableName values(1, 'a1', 10, '2021-07-18')")
+
+ assertResult(expectedOperationtype) {
+ getLastCommitMetadata(spark, s"${tmp.getCanonicalPath}/$tableName").getOperationType
+ }
+ checkAnswer(s"select id, name, price, dt from $tableName")(
+ Seq(1, "a1", 10.0, "2021-07-18")
+ )
+
+ if (expectExceptionOnSecondBatch) {
+ assertThrows[HoodieDuplicateKeyException] {
+ try {
+ spark.sql(
+ s"""
+ | insert into $tableName values
+ | (1, 'a1_1', 10, "2021-07-18"),
+ | (2, 'a2', 20, "2021-07-18"),
+ | (2, 'a2_2', 30, "2021-07-18")
+ """.stripMargin)
+ } catch {
+ case e: Exception =>
+ var root: Throwable = e
+ while (root.getCause != null) {
+ root = root.getCause
+ }
+ throw root
+ }
+ }
+ } else {
+
+ // insert record again but w/ diff values but same primary key. Since "insert" is chosen as operation type,
+ // dups should be seen w/ snapshot query
+ spark.sql(
+ s"""
+ | insert into $tableName values
+ | (1, 'a1_1', 10, "2021-07-18"),
+ | (2, 'a2', 20, "2021-07-18"),
+ | (2, 'a2_2', 30, "2021-07-18")
+ """.stripMargin)
+
+ assertResult(expectedOperationtype) {
+ getLastCommitMetadata(spark, s"${tmp.getCanonicalPath}/$tableName").getOperationType
+ }
+
+ if (expectedOperationtype == WriteOperationType.UPSERT) {
+ // dedup should happen within same batch being ingested and existing records on storage should get updated
+ checkAnswer(s"select id, name, price, dt from $tableName order by id")(
+ Seq(1, "a1_1", 10.0, "2021-07-18"),
+ Seq(2, "a2_2", 30.0, "2021-07-18")
+ )
+ } else {
+ if (insertDupPolicy == NONE_INSERT_DUP_POLICY) {
+ // no dedup across batches
+ checkAnswer(s"select id, name, price, dt from $tableName order by id")(
+ Seq(1, "a1", 10.0, "2021-07-18"),
+ Seq(1, "a1_1", 10.0, "2021-07-18"),
+ // Seq(2, "a2", 20.0, "2021-07-18"), // preCombine within same batch kicks in if preCombine is set
+ Seq(2, "a2_2", 30.0, "2021-07-18")
+ )
+ } else if (insertDupPolicy == DROP_INSERT_DUP_POLICY) {
+ checkAnswer(s"select id, name, price, dt from $tableName order by id")(
+ Seq(1, "a1", 10.0, "2021-07-18"),
+ // Seq(2, "a2", 20.0, "2021-07-18"), // preCombine within same batch kicks in if preCombine is set
+ Seq(2, "a2_2", 30.0, "2021-07-18")
+ )
+ }
+ }
+ }
+ spark.sessionState.conf.unsetConf("hoodie.sql.write.operation")
+ spark.sessionState.conf.unsetConf("hoodie.sql.insert.mode")
+ spark.sessionState.conf.unsetConf("hoodie.datasource.insert.dup.policy")
+ }
+
+ def ingestAndValidateExceptionBulkInsertAndDropDupPolicy(tableType: String, tableName: String, tmp: File,
Review Comment:
can remove this method. i don't see it being used.
--
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
[GitHub] [hudi] nsivabalan commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1261637106
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -187,29 +218,38 @@ trait ProvidesHoodieConfig extends Logging {
val insertModeOpt = combinedOpts.get(SQL_INSERT_MODE.key)
val insertModeSet = insertModeOpt.nonEmpty
+ val sqlWriteOperationOpt = combinedOpts.get(SQL_WRITE_OPERATION.key())
+ val sqlWriteOperationSet = sqlWriteOperationOpt.nonEmpty
+ val sqlWriteOperation = sqlWriteOperationOpt.getOrElse(SQL_WRITE_OPERATION.defaultValue())
+ val insertDupPolicy = combinedOpts.getOrElse(INSERT_DUP_POLICY.key(), INSERT_DUP_POLICY.defaultValue())
val insertMode = InsertMode.of(insertModeOpt.getOrElse(SQL_INSERT_MODE.defaultValue()))
val isNonStrictMode = insertMode == InsertMode.NON_STRICT
val isPartitionedTable = hoodieCatalogTable.partitionFields.nonEmpty
val combineBeforeInsert = hoodieCatalogTable.preCombineKey.nonEmpty && hoodieCatalogTable.primaryKeys.nonEmpty
- // NOTE: Target operation could be overridden by the user, therefore if it has been provided as an input
- // we'd prefer that value over auto-deduced operation. Otherwise, we deduce target operation type
+ // try to use sql write operation instead of legacy insert mode. If only insert mode is explicitly specified, we will uze
+ // o
+ val useLegacyInsertModeFlow = insertModeSet && !sqlWriteOperationSet
Review Comment:
yes, sure.
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1635422906
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* a930f2ea7876f0336e66308a21a05fcbe7b0f7f5 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564)
* ca05555ec686f26a2786bc350f3dfb1a83baf3bc Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582)
<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
[GitHub] [hudi] danny0405 commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1259267932
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
yeah, it's better we can keep the strategy in line.
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1633392589
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 5b48833e4d759cf072a3da49f91c7476bbf09b48 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533)
<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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1627855511
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7708ff75ba467e2156b6396ee2886ec645b7b44f Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325)
* beb523cca98b4b62964c485e464d5eb1ce6e25a2 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432)
<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
[GitHub] [hudi] nsivabalan commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1257546507
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##########
@@ -112,6 +113,36 @@ trait ProvidesHoodieConfig extends Logging {
}
}
+ private def deducePayloadClassNameLegacy(operation: String, tableType: String, insertMode: InsertMode): String = {
+ if (operation == UPSERT_OPERATION_OPT_VAL &&
+ tableType == COW_TABLE_TYPE_OPT_VAL && insertMode == InsertMode.STRICT) {
+ // Validate duplicate key for COW, for MOR it will do the merge with the DefaultHoodieRecordPayload
+ // on reading.
+ // TODO use HoodieSparkValidateDuplicateKeyRecordMerger when SparkRecordMerger is default
+ classOf[ValidateDuplicateKeyPayload].getCanonicalName
+ } else if (operation == INSERT_OPERATION_OPT_VAL && tableType == COW_TABLE_TYPE_OPT_VAL &&
+ insertMode == InsertMode.STRICT){
+ // Validate duplicate key for inserts to COW table when using strict insert mode.
+ classOf[ValidateDuplicateKeyPayload].getCanonicalName
+ } else {
+ classOf[OverwriteWithLatestAvroPayload].getCanonicalName
+ }
Review Comment:
yes, thats why I also did not switch
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1636450633
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
}, {
"hash" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589",
"triggerID" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* c4b55caaa515af207aa3ba1bef87cb1568d9b38a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589)
<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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1636717641
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
}, {
"hash" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18564",
"triggerID" : "a930f2ea7876f0336e66308a21a05fcbe7b0f7f5",
"triggerType" : "PUSH"
}, {
"hash" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18582",
"triggerID" : "ca05555ec686f26a2786bc350f3dfb1a83baf3bc",
"triggerType" : "PUSH"
}, {
"hash" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18589",
"triggerID" : "c4b55caaa515af207aa3ba1bef87cb1568d9b38a",
"triggerType" : "PUSH"
}, {
"hash" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18596",
"triggerID" : "92431edca469088ced64b1d92c7bbdc2e44d47a1",
"triggerType" : "PUSH"
}, {
"hash" : "05554e2e034b32dd56599e1f62408c123888d9cb",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18609",
"triggerID" : "05554e2e034b32dd56599e1f62408c123888d9cb",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 05554e2e034b32dd56599e1f62408c123888d9cb Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18609)
<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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1620937715
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7708ff75ba467e2156b6396ee2886ec645b7b44f 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
[GitHub] [hudi] nsivabalan commented on a diff in pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #9123:
URL: https://github.com/apache/hudi/pull/9123#discussion_r1261636806
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1094,6 +1094,11 @@ object HoodieSparkSqlWriter {
if (mergedParams.contains(PRECOMBINE_FIELD.key())) {
mergedParams.put(HoodiePayloadProps.PAYLOAD_ORDERING_FIELD_PROP_KEY, mergedParams(PRECOMBINE_FIELD.key()))
}
+ if (mergedParams.get(OPERATION.key()).get == INSERT_OPERATION_OPT_VAL && mergedParams.contains(DataSourceWriteOptions.INSERT_DUP_POLICY.key())
+ && mergedParams.get(DataSourceWriteOptions.INSERT_DUP_POLICY.key()).get != FAIL_INSERT_DUP_POLICY) {
+ // enable merge allow duplicates when operation type is insert
+ mergedParams.put(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key(), "true")
Review Comment:
nope. we are streamlining across spark-ds and spark-sql.
if operation type is insert, we do enable hoodie.merge.allow.duplicate.on.inserts if user does not explicitly set it.
--
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
[GitHub] [hudi] hudi-bot commented on pull request #9123: [HUDI-6478] Simplifying INSERT_INTO configs for spark-sql
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #9123:
URL: https://github.com/apache/hudi/pull/9123#issuecomment-1633232415
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18325",
"triggerID" : "7708ff75ba467e2156b6396ee2886ec645b7b44f",
"triggerType" : "PUSH"
}, {
"hash" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432",
"triggerID" : "beb523cca98b4b62964c485e464d5eb1ce6e25a2",
"triggerType" : "PUSH"
}, {
"hash" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533",
"triggerID" : "5b48833e4d759cf072a3da49f91c7476bbf09b48",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* beb523cca98b4b62964c485e464d5eb1ce6e25a2 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18432)
* 5b48833e4d759cf072a3da49f91c7476bbf09b48 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18533)
<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