-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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-28518: Iceberg: Fix ClassCastException during in-place migration to Iceberg tables with timestamp columns #5590
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...eberg-handler/src/test/queries/positive/iceberg_inplace_migration_with_timestamp_column.q
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE EXTERNAL TABLE hive_28518_test(`id` int,`name` string,`dt` timestamp) STORED AS PARQUET; | ||
insert into hive_28518_test values (1, "test name" , cast('2024-08-09 14:08:26.326107' as timestamp)); | ||
ALTER TABLE hive_28518_test SET TBLPROPERTIES ('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler', 'format-version' = '2'); | ||
set hive.fetch.task.conversion=more; | ||
select * from hive_28518_test; | ||
set hive.fetch.task.conversion=none; | ||
select * from hive_28518_test; |
45 changes: 45 additions & 0 deletions
45
...g-handler/src/test/results/positive/iceberg_inplace_migration_with_timestamp_column.q.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
PREHOOK: query: CREATE EXTERNAL TABLE hive_28518_test(`id` int,`name` string,`dt` timestamp) STORED AS PARQUET | ||
PREHOOK: type: CREATETABLE | ||
PREHOOK: Output: database:default | ||
PREHOOK: Output: default@hive_28518_test | ||
POSTHOOK: query: CREATE EXTERNAL TABLE hive_28518_test(`id` int,`name` string,`dt` timestamp) STORED AS PARQUET | ||
POSTHOOK: type: CREATETABLE | ||
POSTHOOK: Output: database:default | ||
POSTHOOK: Output: default@hive_28518_test | ||
PREHOOK: query: insert into hive_28518_test values (1, "test name" , cast('2024-08-09 14:08:26.326107' as timestamp)) | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: _dummy_database@_dummy_table | ||
PREHOOK: Output: default@hive_28518_test | ||
POSTHOOK: query: insert into hive_28518_test values (1, "test name" , cast('2024-08-09 14:08:26.326107' as timestamp)) | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: _dummy_database@_dummy_table | ||
POSTHOOK: Output: default@hive_28518_test | ||
POSTHOOK: Lineage: hive_28518_test.dt SCRIPT [] | ||
POSTHOOK: Lineage: hive_28518_test.id SCRIPT [] | ||
POSTHOOK: Lineage: hive_28518_test.name SCRIPT [] | ||
PREHOOK: query: ALTER TABLE hive_28518_test SET TBLPROPERTIES ('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler', 'format-version' = '2') | ||
PREHOOK: type: ALTERTABLE_PROPERTIES | ||
PREHOOK: Input: default@hive_28518_test | ||
PREHOOK: Output: default@hive_28518_test | ||
POSTHOOK: query: ALTER TABLE hive_28518_test SET TBLPROPERTIES ('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler', 'format-version' = '2') | ||
POSTHOOK: type: ALTERTABLE_PROPERTIES | ||
POSTHOOK: Input: default@hive_28518_test | ||
POSTHOOK: Output: default@hive_28518_test | ||
PREHOOK: query: select * from hive_28518_test | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@hive_28518_test | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from hive_28518_test | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@hive_28518_test | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
1 test name 2024-08-09 14:08:26.326107 | ||
PREHOOK: query: select * from hive_28518_test | ||
PREHOOK: type: QUERY | ||
PREHOOK: Input: default@hive_28518_test | ||
PREHOOK: Output: hdfs://### HDFS PATH ### | ||
POSTHOOK: query: select * from hive_28518_test | ||
POSTHOOK: type: QUERY | ||
POSTHOOK: Input: default@hive_28518_test | ||
POSTHOOK: Output: hdfs://### HDFS PATH ### | ||
1 test name 2024-08-09 14:08:26.326107 |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be safe to check if it is LocalDateTime before casting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zratkai Thanks for taking a look into this.
Sure, I will make the necessary changes. Besides LocalDateTime and OffsetDateTime, are there any other classes that might be expected here? Please let me know so I can handle them appropriately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should always be LocalDateTime, ideally. But the Iceberg + Parquet reader constructs OffsetDateTime. So, we should support only LocalDateTime and OffsetDateTime.
Though we expected never fail, it could be a little kinder if we had a better error message like
String.format("An unexpected type %s was passed as timestamp", o.getClass)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed update @okumin
if it's okay. I will make the below code changes.
Please check and let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update @ayushtkn