zinking commented on a change in pull request #706: [CALCITE-2302] Implicit
type cast support
URL: https://github.com/apache/calcite/pull/706#discussion_r309488917
##########
File path: core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
##########
@@ -287,6 +287,25 @@ public static boolean isDatetime(RelDataType type) {
return SqlTypeFamily.DATETIME.contains(type);
}
+ /**
+ * @return true if type is DATE
+ */
+ public static boolean isDate(RelDataType type) {
+ SqlTypeName typeName = type.getSqlTypeName();
+ if (typeName == null) {
+ return false;
+ }
+
+ return type.getSqlTypeName() == SqlTypeName.DATE;
+ }
+
+ /**
+ * @return true if type is TIMESTAMP
+ */
+ public static boolean isTimestamp(RelDataType type) {
+ return SqlTypeFamily.TIMESTAMP.contains(type);
Review comment:
this sounds weird, if there's no chance it can be null, why shall we check
it?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services