You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/12/27 09:21:49 UTC
[GitHub] [hudi] XuQianJin-Stars opened a new pull request #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
XuQianJin-Stars opened a new pull request #4452:
URL: https://github.com/apache/hudi/pull/4452
## *Tips*
- *Thank you very much for contributing to Apache Hudi.*
- *Please review https://hudi.apache.org/contribute/how-to-contribute before opening a pull request.*
## What is the purpose of the pull request
*Fix HiveSyncTool not sync schema*
link: [HUDI-3106](https://issues.apache.org/jira/browse/HUDI-3106)
## Brief change log
*Fix HiveSyncTool not sync schema*
## Verify this pull request
*(Please pick either of the following options)*
This pull request is a trivial rework / code cleanup without any test coverage.
*(or)*
This pull request is already covered by existing tests, such as *(please describe tests)*.
(or)
This change added tests and can be verified as follows:
*(example:)*
- *Added integration tests for end-to-end.*
- *Added HoodieClientWriteTest to verify the change.*
- *Manually verified the change by running a job locally.*
## Committer checklist
- [ ] Has a corresponding JIRA in PR title & commit
- [ ] Commit message is descriptive of the change
- [ ] CI is green
- [ ] Necessary doc changes done or have another open PR
- [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
--
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] xushiyan commented on a change in pull request #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
xushiyan commented on a change in pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#discussion_r775681342
##########
File path: hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieTimeline.java
##########
@@ -281,6 +290,21 @@
*/
Option<byte[]> getInstantDetails(HoodieInstant instant);
+ /**
+ * Get WriteOperationType for instant.
+ */
+ Option<WriteOperationType> getWriteOperationType(HoodieInstant instant);
Review comment:
It looks weird to have an API like this at HoodieTimeline level; it's done via org.apache.hudi.common.model.HoodieCommitMetadata#getOperationType and the responsibility shouldn't fall on HoodieTimeline. At this stage, can we keep this internal to `isDeletePartitionType()` instead of making an API?
##########
File path: hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieDefaultTimeline.java
##########
@@ -100,6 +102,12 @@ public HoodieTimeline filterCompletedInstants() {
return new HoodieDefaultTimeline(instants.stream().filter(HoodieInstant::isCompleted), details);
}
+ @Override
+ public HoodieTimeline filterCompletedExcludeDeletePartitionInstants() {
Review comment:
Making the API name more explicit helps explain the use case.
```suggestion
public HoodieTimeline filterCompletedInstantsWithSchema() {
```
##########
File path: hudi-common/src/main/java/org/apache/hudi/common/table/timeline/HoodieDefaultTimeline.java
##########
@@ -351,6 +359,28 @@ public boolean isBeforeTimelineStarts(String instant) {
return details.apply(instant);
}
+ @Override
+ public Option<WriteOperationType> getWriteOperationType(HoodieInstant instant) {
+ try {
+ HoodieCommitMetadata commitMetadata = HoodieCommitMetadata
+ .fromBytes(getInstantDetails(instant).get(), HoodieCommitMetadata.class);
+ return Option.of(commitMetadata.getOperationType());
+ } catch (Exception e) {
+ return Option.empty();
+ }
+ }
+
+ @Override
+ public boolean isDeletePartitionType(HoodieInstant instant) {
+ Option<WriteOperationType> operationType = getWriteOperationType(instant);
+ return operationType.isPresent() && WriteOperationType.DELETE_PARTITION.equals(operationType.get());
+ }
+
+ @Override
+ public boolean isNotDeletePartitionType(HoodieInstant instant) {
Review comment:
this API looks redundant; you can simply negate the filter condtion?
--
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] xushiyan merged pull request #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
xushiyan merged pull request #4452:
URL: https://github.com/apache/hudi/pull/4452
--
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 removed a comment on pull request #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
hudi-bot removed a comment on pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#issuecomment-1001836715
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b26eba514128017238dfecbd883e875b63083c44",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b26eba514128017238dfecbd883e875b63083c44",
"triggerType" : "PUSH"
}, {
"hash" : "8d815ae5619af1df289cfb186766984b1283a51e",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "8d815ae5619af1df289cfb186766984b1283a51e",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b26eba514128017238dfecbd883e875b63083c44 UNKNOWN
* 8d815ae5619af1df289cfb186766984b1283a51e 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 #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
hudi-bot commented on pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#issuecomment-1001842850
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b26eba514128017238dfecbd883e875b63083c44",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b26eba514128017238dfecbd883e875b63083c44",
"triggerType" : "PUSH"
}, {
"hash" : "8d815ae5619af1df289cfb186766984b1283a51e",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "8d815ae5619af1df289cfb186766984b1283a51e",
"triggerType" : "PUSH"
}, {
"hash" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=4756",
"triggerID" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b26eba514128017238dfecbd883e875b63083c44 UNKNOWN
* 8d815ae5619af1df289cfb186766984b1283a51e UNKNOWN
* 3634b6e4aa78cb856ff3652e6c10eb889c2085da Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=4756)
<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] xushiyan commented on a change in pull request #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
xushiyan commented on a change in pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#discussion_r775699815
##########
File path: hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
##########
@@ -169,25 +168,24 @@ protected void syncHoodieTable(String tableName, boolean useRealtimeInputFormat,
boolean isDropPartition = hoodieHiveClient.isDropPartition();
// check if schemaChanged
- boolean schemaChanged = false;
-
- if (!isDropPartition) {
- // Get the parquet schema for this table looking at the latest commit
- MessageType schema = hoodieHiveClient.getDataSchema();
-
- // Currently HoodieBootstrapRelation does support reading bootstrap MOR rt table,
- // so we disable the syncAsSparkDataSourceTable here to avoid read such kind table
- // by the data source way (which will use the HoodieBootstrapRelation).
- // TODO after we support bootstrap MOR rt table in HoodieBootstrapRelation[HUDI-2071], we can remove this logical.
- if (hoodieHiveClient.isBootstrap()
- && hoodieHiveClient.getTableType() == HoodieTableType.MERGE_ON_READ
- && !readAsOptimized) {
- cfg.syncAsSparkDataSourceTable = false;
- }
- // Sync schema if needed
- schemaChanged = syncSchema(tableName, tableExists, useRealtimeInputFormat, readAsOptimized, schema);
+ boolean schemaChanged;
Review comment:
this declaration is redundant now.
--
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 #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
hudi-bot commented on pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#issuecomment-1001836715
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b26eba514128017238dfecbd883e875b63083c44",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b26eba514128017238dfecbd883e875b63083c44",
"triggerType" : "PUSH"
}, {
"hash" : "8d815ae5619af1df289cfb186766984b1283a51e",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "8d815ae5619af1df289cfb186766984b1283a51e",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b26eba514128017238dfecbd883e875b63083c44 UNKNOWN
* 8d815ae5619af1df289cfb186766984b1283a51e 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 removed a comment on pull request #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
hudi-bot removed a comment on pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#issuecomment-1001842850
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b26eba514128017238dfecbd883e875b63083c44",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b26eba514128017238dfecbd883e875b63083c44",
"triggerType" : "PUSH"
}, {
"hash" : "8d815ae5619af1df289cfb186766984b1283a51e",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "8d815ae5619af1df289cfb186766984b1283a51e",
"triggerType" : "PUSH"
}, {
"hash" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=4756",
"triggerID" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b26eba514128017238dfecbd883e875b63083c44 UNKNOWN
* 8d815ae5619af1df289cfb186766984b1283a51e UNKNOWN
* 3634b6e4aa78cb856ff3652e6c10eb889c2085da Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=4756)
<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 removed a comment on pull request #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
hudi-bot removed a comment on pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#issuecomment-1001462645
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b26eba514128017238dfecbd883e875b63083c44",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b26eba514128017238dfecbd883e875b63083c44",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b26eba514128017238dfecbd883e875b63083c44 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 #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
hudi-bot commented on pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#issuecomment-1001841527
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b26eba514128017238dfecbd883e875b63083c44",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b26eba514128017238dfecbd883e875b63083c44",
"triggerType" : "PUSH"
}, {
"hash" : "8d815ae5619af1df289cfb186766984b1283a51e",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "8d815ae5619af1df289cfb186766984b1283a51e",
"triggerType" : "PUSH"
}, {
"hash" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b26eba514128017238dfecbd883e875b63083c44 UNKNOWN
* 8d815ae5619af1df289cfb186766984b1283a51e UNKNOWN
* 3634b6e4aa78cb856ff3652e6c10eb889c2085da 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] XuQianJin-Stars commented on a change in pull request #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
XuQianJin-Stars commented on a change in pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#discussion_r775414082
##########
File path: hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java
##########
@@ -169,25 +168,24 @@ protected void syncHoodieTable(String tableName, boolean useRealtimeInputFormat,
boolean isDropPartition = hoodieHiveClient.isDropPartition();
// check if schemaChanged
- boolean schemaChanged = false;
-
- if (!isDropPartition) {
Review comment:
This judgment is the reason that the manual execution of HiveSyncTool does not update the schema.
--
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 #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
hudi-bot commented on pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#issuecomment-1001855156
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b26eba514128017238dfecbd883e875b63083c44",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b26eba514128017238dfecbd883e875b63083c44",
"triggerType" : "PUSH"
}, {
"hash" : "8d815ae5619af1df289cfb186766984b1283a51e",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "8d815ae5619af1df289cfb186766984b1283a51e",
"triggerType" : "PUSH"
}, {
"hash" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=4756",
"triggerID" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b26eba514128017238dfecbd883e875b63083c44 UNKNOWN
* 8d815ae5619af1df289cfb186766984b1283a51e UNKNOWN
* 3634b6e4aa78cb856ff3652e6c10eb889c2085da Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=4756)
<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 #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
hudi-bot commented on pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#issuecomment-1001462645
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b26eba514128017238dfecbd883e875b63083c44",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b26eba514128017238dfecbd883e875b63083c44",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b26eba514128017238dfecbd883e875b63083c44 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 removed a comment on pull request #4452: [HUDI-3106] Fix HiveSyncTool not sync schema
Posted by GitBox <gi...@apache.org>.
hudi-bot removed a comment on pull request #4452:
URL: https://github.com/apache/hudi/pull/4452#issuecomment-1001841527
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "b26eba514128017238dfecbd883e875b63083c44",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "b26eba514128017238dfecbd883e875b63083c44",
"triggerType" : "PUSH"
}, {
"hash" : "8d815ae5619af1df289cfb186766984b1283a51e",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "8d815ae5619af1df289cfb186766984b1283a51e",
"triggerType" : "PUSH"
}, {
"hash" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "3634b6e4aa78cb856ff3652e6c10eb889c2085da",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* b26eba514128017238dfecbd883e875b63083c44 UNKNOWN
* 8d815ae5619af1df289cfb186766984b1283a51e UNKNOWN
* 3634b6e4aa78cb856ff3652e6c10eb889c2085da 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