-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-22400][hive connect]fix NPE problem when convert flink object for Map #15712
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -531,6 +531,31 @@ public void testLocationWithComma() throws Exception { | |
| } | ||
| } | ||
|
|
||
| @Test | ||
| public void testReadHiveDataWithEmptyMapForHiveShim20X() throws Exception { | ||
| Assume.assumeTrue(HiveShimLoader.getHiveVersion().compareTo("2.0.0") <= 0); | ||
| TableEnvironment tableEnv = getTableEnvWithHiveCatalog(); | ||
| try { | ||
| String format = "parquet"; | ||
| // test.parquet data: hehuiyuan {} [] | ||
| String folderURI = this.getClass().getResource("/parquet").getPath(); | ||
|
|
||
| tableEnv.getConfig() | ||
| .getConfiguration() | ||
| .set(HiveOptions.TABLE_EXEC_HIVE_FALLBACK_MAPRED_READER, true); | ||
| tableEnv.executeSql( | ||
| String.format( | ||
| "create external table src_t (a string, b map<string, string>, c array<string>) stored as %s location 'file://%s'", | ||
| format, folderURI)); | ||
|
|
||
| List<Row> results = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's also verify the results
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should also test empty arrays?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes ,the same problem |
||
| CollectionUtil.iteratorToList( | ||
| tableEnv.sqlQuery("select * from src_t").execute().collect()); | ||
| } finally { | ||
| tableEnv.executeSql("drop table if exists src_t"); | ||
| } | ||
| } | ||
|
|
||
| private TableEnvironment getTableEnvWithHiveCatalog() { | ||
| TableEnvironment tableEnv = | ||
| HiveTestUtils.createTableEnvWithBlinkPlannerBatchMode(SqlDialect.HIVE); | ||
|
|
||
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.
We can only run this test for hive <=2.0.0. Something like
Assume.assumeTrue(HiveShimLoader.getHiveVersion().compareTo("2.0.0") <= 0)