HIVE-26507: Do not allow hive to iceberg migration if source table contains CHAR or VARCHAR columns #3570
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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