kamkaz1 opened a new pull request, #26: URL: https://github.com/apache/flink-connector-kudu/pull/26
## Purpose of the change [FLINK-41252](https://issues.apache.org/jira/browse/FLINK-41252) The flink-sql-connector-kudu uber-jar relocates org.apache.kudu to org.apache.flink.kudu.shaded.org.apache.kudu. Maven Shade, however, does not reliably rewrite the serialised lambda metadata that the generated $deserializeLambda$ method uses. In KuduTableUtils#createTableInfo, ColumnSchemasFactory and CreateTableOptionsFactory are implemented as serialisable lambdas. After shading, the lambda implementation method refers to the relocated Kudu classes, but the signature string checked by $deserializeLambda$ still refers to the original classes. This mismatch leads to java.IllegalArgumentException: Invalid lambda deserialisation when using tables with PRIMARYKEY through the SQL uber-jar. - implementation: `lambda$createTableInfo$4bdb320f$1(ILjava/util/List;I)Lorg/apache/flink/kudu/shaded/org/apache/kudu/client/CreateTableOptions;` - expected by `$deserializeLambda$`: `(ILjava/util/List;I)Lorg/apache/kudu/client/CreateTableOptions;` As a result, any table with a `PRIMARY KEY` used through the SQL uber-jar fails with `java.lang.IllegalArgumentException: Invalid lambda deserialization`. The released `2.0.0-1.19` and `2.0.0-1.20` jars contain the same mismatch. ## Brief change log - Replace the two serializable lambdas in `KuduTableUtils#createTableInfo` with private static named classes (`FlinkColumnSchemasFactory`, `HashPartitionedTableOptionsFactory`). Behavior is unchanged. - Add `KuduTableUtilsTest`, which serializes the `KuduTableInfo` returned by `createTableInfo`, asserts that the serialized form contains no `SerializedLambda`, and checks that the deserialized instance still provides the expected schema and create-table options. ## Verifying this change - New unit test `KuduTableUtilsTest#testCreateTableInfoIsSerializableWithoutLambdas`. It passes with this change and fails on the previous code (`main` @ 3a4df68) with `Expecting ... not to contain: "java.lang.invoke.SerializedLambda"`. - `mvn clean verify` passes, including the Testcontainers-based integration tests. - Verified the rebuilt `flink-sql-connector-kudu` jar: no class contains `$deserializeLambda$` anymore, and `HashPartitionedTableOptionsFactory#getCreateTableOptions` returns the relocated `CreateTableOptions` type. - Reproduced the original failure with the SQL Client on Flink 1.19.1 / Kudu 1.17.0 by creating a table with PRIMARY KEY (id) NOT ENFORCED and executing a subsequent SELECT. ## Impact and documentation Not applicable --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes Generated-by: Claude Opus 5.5 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
