bchapuis commented on code in PR #3668:
URL: https://github.com/apache/calcite/pull/3668#discussion_r2242750524
##########
core/src/main/java/org/apache/calcite/jdbc/JavaTypeFactoryImpl.java:
##########
@@ -440,4 +442,17 @@ private static class RecordFieldImpl implements
Types.RecordField {
return syntheticType;
}
}
+
+ @Override public RelDataType createJavaType(Class clazz) {
+ return createJavaType(clazz, null);
+ }
+
+ @Override public RelDataType createJavaType(
+ Class clazz,
+ @Nullable RelDataTypeFamily family) {
+ if (Geometry.class.isAssignableFrom(clazz)) {
+ return canonize(new JavaType(clazz, SqlTypeFamily.GEOMETRY));
+ }
+ return super.createJavaType(clazz, family);
+ }
Review Comment:
I abandoned the idea of introducing the wrappers described in CALCITE-6263
after the addition of the @SqlType annotation by @jhyde in
[7124c3a](https://github.com/apache/calcite/commit/7124c3ae3e5001b85dc6617554c170be49476f75),
as it allows Java types to explicitly declare their corresponding SQL type.
I’m still trying to wrap my head around the best solution 😅, but since
spatial support is still evolving in Calcite (and JTS is almost a de facto
standard for Java) moving this to `JavaTypeFactoryImpl` felt like a practical
fit for now.
Let me know if you’d like to discuss broader architectural directions. I’m
happy to revisit it (ideally in another PR), but I hope this strikes a
reasonable balance in the meantime.
--
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]