You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/10/21 07:55:35 UTC
[GitHub] [hive] lcspinter opened a new pull request, #3695: HIVE-26657: [Iceberg] Filter out the metadata.json file when migrating
lcspinter opened a new pull request, #3695:
URL: https://github.com/apache/hive/pull/3695
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
3. Ensure you have added or run the appropriate tests for your PR:
4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX: Your PR title ...'.
5. Be sure to keep the PR description updated to reflect all changes.
6. Please write your PR title to summarize what this PR proposes.
7. If possible, provide a concise example to reproduce the issue for a faster review.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
Filter out metadata.json when migrating a hive table to iceberg.
### Why are the changes needed?
When migrating a hive table to an iceberg in certain cases a Runtime exception is raised
ERROR : Failed
java.lang.RuntimeException: s3a://dev-nfqe-base/cc-cdw-nfqe-q7wj9a/archive/env-8pt556/parquet/bakeoff/large/pli/metadata/00000-94fffe5c-c307-4341-9ea3-f5fa4863d301.metadata.json is not a Parquet file. Expected magic number at tail, but found [32, 93, 10, 125]
The hive-to-iceberg table migration has the following logic.
1. In order to walk through all the data files we request a file iterator from the filesystem. This iterator will provide all the references to be able to scan the data files.
2. The new iceberg table is created, meaning that a new entry is added to the hive catalog and on the file system level the metadata directory is created together with the first metadata file (*.metadata.json)
3. All the data files are scanned and the manifests are created.
The issue occurs when there are so many data files that it doesn't fit into memory in one go. So in step 3 when we walk through the data files list, the iterator has to run another round of file listing that reads up the content of the metadata directory that was created in step 2.
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
If no, write 'No'.
-->
No
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
Manual test
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] szlta commented on a diff in pull request #3695: HIVE-26657: [Iceberg] Filter out the metadata.json file when migrating
Posted by GitBox <gi...@apache.org>.
szlta commented on code in PR #3695:
URL: https://github.com/apache/hive/pull/3695#discussion_r1002148004
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveTableUtil.java:
##########
@@ -125,7 +125,7 @@ private static List<DataFile> getDataFiles(RemoteIterator<LocatedFileStatus> fil
while (fileStatusIterator.hasNext()) {
LocatedFileStatus fileStatus = fileStatusIterator.next();
String fileName = fileStatus.getPath().getName();
- if (fileName.startsWith(".") || fileName.startsWith("_")) {
+ if (fileName.startsWith(".") || fileName.startsWith("_") || fileName.endsWith("metadata.json")) {
Review Comment:
So metadata files are handled, but are snapshot files (that are avro formatted) going to cause similar issues?
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] lcspinter commented on a diff in pull request #3695: HIVE-26657: [Iceberg] Filter out the metadata.json file when migrating
Posted by GitBox <gi...@apache.org>.
lcspinter commented on code in PR #3695:
URL: https://github.com/apache/hive/pull/3695#discussion_r1002951455
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveTableUtil.java:
##########
@@ -125,7 +125,7 @@ private static List<DataFile> getDataFiles(RemoteIterator<LocatedFileStatus> fil
while (fileStatusIterator.hasNext()) {
LocatedFileStatus fileStatus = fileStatusIterator.next();
String fileName = fileStatus.getPath().getName();
- if (fileName.startsWith(".") || fileName.startsWith("_")) {
+ if (fileName.startsWith(".") || fileName.startsWith("_") || fileName.endsWith("metadata.json")) {
Review Comment:
There will be no snapshot files at this point since the data files are not yet imported. We only have the first metadata file that belongs to an empty iceberg table.
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] sonarcloud[bot] commented on pull request #3695: HIVE-26657: [Iceberg] Filter out the metadata.json file when migrating
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3695:
URL: https://github.com/apache/hive/pull/3695#issuecomment-1286651786
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3695)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3695&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3695&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3695&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3695&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3695&metric=duplicated_lines_density&view=list) No Duplication information
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] szlta commented on a diff in pull request #3695: HIVE-26657: [Iceberg] Filter out the metadata.json file when migrating
Posted by GitBox <gi...@apache.org>.
szlta commented on code in PR #3695:
URL: https://github.com/apache/hive/pull/3695#discussion_r1003033149
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveTableUtil.java:
##########
@@ -125,7 +125,7 @@ private static List<DataFile> getDataFiles(RemoteIterator<LocatedFileStatus> fil
while (fileStatusIterator.hasNext()) {
LocatedFileStatus fileStatus = fileStatusIterator.next();
String fileName = fileStatus.getPath().getName();
- if (fileName.startsWith(".") || fileName.startsWith("_")) {
+ if (fileName.startsWith(".") || fileName.startsWith("_") || fileName.endsWith("metadata.json")) {
Review Comment:
Got it, thanks!
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] lcspinter merged pull request #3695: HIVE-26657: [Iceberg] Filter out the metadata.json file when migrating
Posted by GitBox <gi...@apache.org>.
lcspinter merged PR #3695:
URL: https://github.com/apache/hive/pull/3695
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] sonarcloud[bot] commented on pull request #3695: HIVE-26657: [Iceberg] Filter out the metadata.json file when migrating
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3695:
URL: https://github.com/apache/hive/pull/3695#issuecomment-1286966296
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3695)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3695&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3695&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3695&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3695&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3695&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3695&metric=duplicated_lines_density&view=list) No Duplication information
--
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: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org