根据https://iceberg.apache.org/flink/,我使用 flink 的 sql-client 选项 -j
:
bin/sql-client.sh embedded -j lib/flink-sql-connector-hive-2.3.6_2.11-1.11.3.jar -j lib/iceberg-flink-runtime-0.11.0.jar shell
并满足以下例外:
Exception in thread "main" org.apache.flink.table.client.SqlClientException: Unexpected exception. This is a bug. Please consider filing an issue.
at org.apache.flink.table.client.SqlClient.main(SqlClient.java:213)
Caused by: org.apache.flink.table.client.gateway.SqlExecutionException: Could not create execution context.
at org.apache.flink.table.client.gateway.local.ExecutionContext$Builder.build(ExecutionContext.java:870)
at org.apache.flink.table.client.gateway.local.LocalExecutor.openSession(LocalExecutor.java:227)
at org.apache.flink.table.client.SqlClient.start(SqlClient.java:108)
at org.apache.flink.table.client.SqlClient.main(SqlClient.java:201)
Caused by: java.lang.VerifyError: Stack map does not match the one at exception handler 70
Exception Details:
Location:
org/apache/iceberg/hive/HiveCatalog.loadNamespaceMetadata(Lorg/apache/iceberg/catalog/Namespace;)Ljava/util/Map; @70: astore_2
Reason:
Type 'org/apache/hadoop/hive/metastore/api/NoSuchObjectException' (current frame, stack[0]) is not assignable to 'org/apache/thrift/TException' (stack map, stack[0])
Current Frame:
bci: @27
flags: { }
locals: { 'org/apache/iceberg/hive/HiveCatalog', 'org/apache/iceberg/catalog/Namespace' }
stack: { 'org/apache/hadoop/hive/metastore/api/NoSuchObjectException' }
Stackmap Frame:
bci: @70
flags: { }
locals: { 'org/apache/iceberg/hive/HiveCatalog', 'org/apache/iceberg/catalog/Namespace' }
stack: { 'org/apache/thrift/TException' }
Bytecode:
0x0000000: 2a2b b700 c59a 0016 bb01 2c59 1301 2e04
0x0000010: bd01 3059 032b 53b7 0133 bf2a b400 3e2b
0x0000020: ba02 8e00 00b6 00e8 c002 904d 2a2c b702
0x0000030: 944e b201 2213 0296 2b2d b902 5d01 00b9
0x0000040: 012a 0400 2db0 4dbb 012c 592c 1301 2e04
0x0000050: bd01 3059 032b 53b7 0281 bf4d bb01 3559
0x0000060: bb01 3759 b701 3813 0283 b601 3e2b b601
0x0000070: 4113 0208 b601 3eb6 0144 2cb7 0147 bf4d
0x0000080: b800 46b6 014a bb01 3559 bb01 3759 b701
0x0000090: 3813 0285 b601 3e2b b601 4113 0208 b601
0x00000a0: 3eb6 0144 2cb7 0147 bf
Exception Handler Table:
bci [27, 69] => handler: 70
bci [27, 69] => handler: 70
bci [27, 69] => handler: 91
bci [27, 69] => handler: 127
Stackmap Table:
same_frame(@27)
same_locals_1_stack_item_frame(@70,Object[#191])
same_locals_1_stack_item_frame(@91,Object[#191])
same_locals_1_stack_item_frame(@127,Object[#193])
at org.apache.iceberg.flink.CatalogLoader$HiveCatalogLoader.loadCatalog(CatalogLoader.java:112)
at org.apache.iceberg.flink.FlinkCatalog.<init>(FlinkCatalog.java:111)
at org.apache.iceberg.flink.FlinkCatalogFactory.createCatalog(FlinkCatalogFactory.java:127)
at org.apache.iceberg.flink.FlinkCatalogFactory.createCatalog(FlinkCatalogFactory.java:117)
at org.apache.flink.table.client.gateway.local.ExecutionContext.createCatalog(ExecutionContext.java:378)
at org.apache.flink.table.client.gateway.local.ExecutionContext.lambda$null$5(ExecutionContext.java:626)
at java.util.HashMap.forEach(HashMap.java:1289)
at org.apache.flink.table.client.gateway.local.ExecutionContext.lambda$initializeCatalogs$6(ExecutionContext.java:625)
at org.apache.flink.table.client.gateway.local.ExecutionContext.wrapClassLoader(ExecutionContext.java:264)
at org.apache.flink.table.client.gateway.local.ExecutionContext.initializeCatalogs(ExecutionContext.java:624)
at org.apache.flink.table.client.gateway.local.ExecutionContext.initializeTableEnvironment(ExecutionContext.java:523)
at org.apache.flink.table.client.gateway.local.ExecutionContext.<init>(ExecutionContext.java:183)
at org.apache.flink.table.client.gateway.local.ExecutionContext.<init>(ExecutionContext.java:136)
at org.apache.flink.table.client.gateway.local.ExecutionContext$Builder.build(ExecutionContext.java:859)
... 3 more
这似乎是 jar 版本出了点问题。
经过尝试不同的 hive 版本的 flink 版本,仍然遇到同样的问题。