Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-26507: Do not allow hive to iceberg migration if source table contains CHAR or VARCHAR columns #3570

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

lcspinter
Copy link
Contributor

What changes were proposed in this pull request?

Raise exception when trying to convert hive table to iceberg if the hive table contains CHAR or VARCHAR columns.

Why are the changes needed?

Previously CHAR and VARCHAR columns were mapped to STRING columns on the iceberg side since iceberg doesn't have support for those.
CHAR and VARCHAR types are fixed-length meaning that the values can be shorter than the specified length, and the remaining characters are padded with spaces. These spaces are trimmed during comparison.

When a table is migrated to iceberg the CHAR columns are read as a STRING on the iceberg side, therefore the whole content of the record is considered important. When running a filter against these columns we would need to add the whole content of the record, including white spaces. This can cause confusion since the same query run on a hive and iceberg table can return different results.

Does this PR introduce any user-facing change?

When running the iceberg migration command, an exception is raised if the source table contains CHAR or VARCHAR columns. As a workaround, the dataset of the source table should be converted to string.

How was this patch tested?

Unit test

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor

@szlta szlta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@lcspinter lcspinter merged commit 4e4e39c into apache:master Sep 7, 2022
@lcspinter lcspinter deleted the HIVE-26507 branch September 7, 2022 10:58
DongWei-4 pushed a commit to DongWei-4/hive that referenced this pull request Oct 28, 2022
…ntains CHAR or VARCHAR columns (apache#3570) (Laszlo Pinter, reviewed by Adam Szita)
dengzhhu653 pushed a commit to dengzhhu653/hive that referenced this pull request Dec 15, 2022
…ntains CHAR or VARCHAR columns (apache#3570) (Laszlo Pinter, reviewed by Adam Szita)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants