bchapuis commented on code in PR #3668:
URL: https://github.com/apache/calcite/pull/3668#discussion_r2423457982


##########
core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactory.java:
##########
@@ -65,6 +65,15 @@ public interface RelDataTypeFactory {
    */
   RelDataType createJavaType(Class clazz);
 
+  /**
+   * Creates a type that corresponds to a Java class, with a given family.
+   *
+   * @param clazz the Java class used to define the type
+   * @param family The family of the type, or null to infer
+   * @return canonical Java type descriptor
+   */
+  RelDataType createJavaType(Class clazz, @Nullable RelDataTypeFamily family);

Review Comment:
   This change comes from a suggestion made by @julianhyde in 
https://github.com/apache/calcite/commit/da8494213c3810584a75064d5fadf52ac1f95d12
   
   > Add annotation Parameter.sqlType
   The annotation allows you to define the SQL type of a
   parameter, for cases where it cannot be deduced automatically
   from the Java type. This is especially useful for GEOMETRY
   values, for which Calcite has no built-in Java type. (JTS
   Geometry is widely used in Calcite, but it is an
   implementation, and we do not want it to become the
   specification.)
   >
   > This commit is incomplete, but illustrates the general idea.
   > 
   > A related change is to add a 'family' parameter to
   the `TypeFactory.createJavaType` method. It is nullable, and
   if null, the type becomes its own family. In JavaType, we
   should add a `family` field.
   > 
   > When this change is complete we should be able to remove JTS
   Geometry from RelDataTypeFactoryImpl.CLASS_FAMILIES.
   
   In my understanding this proposition was an API change (possibly major) that 
would allow to define the SQL type of a parameter more explicitly. As the 
family parameter is nullable, it effectively allows the cosumers to continue 
working as before. I acknoledge that I probably don't get all the possible 
ramifications of this 😅 
   
   



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