vdiravka commented on a change in pull request #1494: DRILL-6768: Improve 
to_date, to_time and to_timestamp and correspondi…
URL: https://github.com/apache/drill/pull/1494#discussion_r223472860
 
 

 ##########
 File path: 
logical/src/main/java/org/apache/drill/common/expression/fn/CastFunctions.java
 ##########
 @@ -78,66 +79,46 @@
     CAST_FUNC_REPLACEMENT_NEEDED.add(TYPE2FUNC.get(MinorType.DECIMAL28SPARSE));
     CAST_FUNC_REPLACEMENT_NEEDED.add(TYPE2FUNC.get(MinorType.DECIMAL38SPARSE));
     CAST_FUNC_REPLACEMENT_NEEDED.add(TYPE2FUNC.get(MinorType.VARDECIMAL));
+    // Date types
+    CAST_FUNC_REPLACEMENT_NEEDED.add(TYPE2FUNC.get(MinorType.DATE));
+    CAST_FUNC_REPLACEMENT_NEEDED.add(TYPE2FUNC.get(MinorType.TIME));
+    CAST_FUNC_REPLACEMENT_NEEDED.add(TYPE2FUNC.get(MinorType.TIMESTAMP));
+    // Interval types
+    CAST_FUNC_REPLACEMENT_NEEDED.add(TYPE2FUNC.get(MinorType.INTERVAL));
+    CAST_FUNC_REPLACEMENT_NEEDED.add(TYPE2FUNC.get(MinorType.INTERVALDAY));
+    CAST_FUNC_REPLACEMENT_NEEDED.add(TYPE2FUNC.get(MinorType.INTERVALYEAR));
+
+    setupReplacementFunctions(MinorType.INT, "NullableINT");
+    setupReplacementFunctions(MinorType.BIGINT, "NullableBIGINT");
+    setupReplacementFunctions(MinorType.FLOAT4, "NullableFLOAT4");
+    setupReplacementFunctions(MinorType.FLOAT8, "NullableFLOAT8");
+    setupReplacementFunctions(MinorType.DECIMAL9, "NullableDECIMAL9");
+    setupReplacementFunctions(MinorType.DECIMAL18, "NullableDECIMAL18");
+    setupReplacementFunctions(MinorType.DECIMAL28SPARSE, 
"NullableDECIMAL28SPARSE");
+    setupReplacementFunctions(MinorType.DECIMAL38SPARSE, 
"NullableDECIMAL38SPARSE");
+    setupReplacementFunctions(MinorType.VARDECIMAL, "NullableVARDECIMAL");
+
+    setupReplacementFunctions(MinorType.DATE, "NULLABLEDATE");
+    setupReplacementFunctions(MinorType.TIME, "NULLABLETIME");
+    setupReplacementFunctions(MinorType.TIMESTAMP, "NULLABLETIMESTAMP");
+
+    setupReplacementFunctions(MinorType.INTERVAL, "NullableINTERVAL");
+    setupReplacementFunctions(MinorType.INTERVALDAY, "NullableINTERVALDAY");
+    setupReplacementFunctions(MinorType.INTERVALYEAR, "NullableINTERVALYEAR");
+  }
+
+  private static void setupReplacementFunctions(MinorType type, String toType) 
{
 
 Review comment:
   The same as for `ToFunctions.convertNullableVarCharTo()`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to