FANNG1 commented on code in PR #9590:
URL: https://github.com/apache/gravitino/pull/9590#discussion_r2664870431
##########
flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/hive/HivePropertiesConverter.java:
##########
@@ -70,6 +83,42 @@ public Map<String, String> toFlinkTableProperties(
return properties;
}
+ /**
+ * Converts Flink table properties to Gravitino table properties for Hive
tables.
+ *
+ * <p><b>Scope:</b> This method is only invoked when creating Hive tables
through the Flink
+ * connector. It does not affect:
+ *
+ * <ul>
+ * <li>Hive tables created via other connectors (Spark, Trino, etc.)
+ * <li>Hive tables created directly through Gravitino API
+ * <li>Non-Hive catalogs (Iceberg, Paimon, JDBC, etc.)
+ * </ul>
+ *
+ * <p><b>Default SerDe behavior:</b> When {@code serde-lib} is not
explicitly provided in the
+ * Flink table properties, this method sets it to {@code LazySimpleSerDe}.
This is required for
+ * Flink ↔ Hive interoperability, as the native Flink Hive client expects
{@code LazySimpleSerDe},
+ * while Gravitino's Hive catalog defaults to {@code JsonSerDe} when {@code
serde-lib} is
+ * unspecified. This ensures tables created via the Gravitino Flink
connector can be read by the
+ * native Flink Hive client.
+ *
+ * @param flinkProperties The Flink table properties to convert
+ * @return Gravitino table properties with default {@code serde-lib} set if
missing
+ */
+ @Override
+ public Map<String, String> toGravitinoTableProperties(Map<String, String>
flinkProperties) {
+ Map<String, String> gravitinoProperties = new HashMap<>(flinkProperties);
+
+ // Set default serde-lib for Flink-created Hive tables only.
+ // This ensures Flink ↔ Hive interoperability and does not affect other
usage paths.
+ if (!gravitinoProperties.containsKey(HiveConstants.SERDE_LIB)) {
Review Comment:
Flink hive connector get the serde lib from hive conf, we'd better follow it
https://github.com/apache/flink/blob/b2a260ac957dac3b6af5dc73684624dd36dc92ea/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/util/HiveTableUtil.java#L432-L435
--
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]