diqiu50 commented on code in PR #12105:
URL: https://github.com/apache/gravitino/pull/12105#discussion_r3734554812


##########
spark-connector/spark-common/src/main/java/org/apache/gravitino/spark/connector/SparkTypeConverter.java:
##########
@@ -192,6 +192,11 @@ public DataType toSparkType(Type gravitinoType) {
       return DataTypes.createStructType(fields);
     } else if (gravitinoType instanceof Types.NullType) {
       return DataTypes.NullType;
+    } else if (gravitinoType instanceof Types.ExternalType) {
+      // ExternalType represents types with no Gravitino-native mapping (e.g. 
ClickHouse
+      // IPv4/IPv6, Doris LARGEINT/BITMAP, Glue unknown types). Map to 
StringType so that
+      // tables containing these columns remain loadable in Spark. Users can 
CAST as needed.
+      return DataTypes.StringType;

Review Comment:
   I think the current behavior of falling back to StringType for ExternalType 
is a reasonable default for the connector. The primary goal is to keep queries 
working instead of failing because of unsupported types.
   
   Leveraging the JDBC-resolved schema in Spark is a good optimization and can 
provide more accurate type mappings where available. However, I don't think we 
should fail the query if a matching JDBC field cannot be found. Falling back to 
StringType is a more user-friendly behavior than failing explicitly.



-- 
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]

Reply via email to