Vladsz83 commented on code in PR #9923:
URL: https://github.com/apache/ignite/pull/9923#discussion_r843101695
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/type/IgniteTypeFactory.java:
##########
@@ -266,22 +266,36 @@ else if (type instanceof UuidType)
return
createTypeWithNullability(createSqlIntervalType(INTERVAL_QUALIFIER_DAY_TIME),
true);
else if (clazz == Period.class)
return
createTypeWithNullability(createSqlIntervalType(INTERVAL_QUALIFIER_YEAR_MONTH),
true);
- else if (clazz == UUID.class)
- return createTypeWithNullability(createUuidType(), true);
+ else {
+ RelDataType relType = createCustomType(clazz.getName());
+
+ if (relType != null)
+ return relType;
+ }
}
return super.toSql(type);
}
- /** @return UUID SQL type. */
- public RelDataType createUuidType() {
- return canonize(new UuidType(true));
+ /** @return Custom type by name or storeable class name. {@code Null} if
type not found. */
+ public RelDataType createCustomType(String typeName) {
+ return createCustomType(typeName, true);
+ }
+
+ /** @return Nullable custom type by name or storeable class name. {@code
Null} if type not found. */
+ public RelDataType createCustomType(String typeName, boolean nullable) {
+ if ("UUID".equals(typeName) || UUID.class.getName().equals(typeName))
+ return new UuidType(nullable);
+ else if ("OTHER".equals(typeName) ||
Object.class.getName().equals(typeName))
+ return new OtherType(nullable);
+
+ return null;
}
/** {@inheritDoc} */
@Override public RelDataType createTypeWithNullability(RelDataType type,
boolean nullable) {
- if (type instanceof UuidType && type.isNullable() != nullable)
- type = new UuidType(nullable);
+ if (type instanceof IgniteSqlCalciteType && type.isNullable() !=
nullable)
Review Comment:
Fixed for Other and Uuid. But I think BINARY type is for another ticket.
WDYT?
--
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]