-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/18047/
-----------------------------------------------------------

Review request for drill.


Repository: drill-git


Description
-------

The patch is to fix the problem related to output type determiner for cast 
functions. Previously, cast function's definition uses a fixed type determiner, 
which is always non-nullable. However, when the input is of nullable type, even 
though cast's implementation is null_if_null, the output type is still 
non-nullable, which causes the compilation error reported in Drill-364.

To fix this, introduce a NullIfNullType output type determiner. It will take a 
minorType. If any of the argument is null, then it will return a nullable type, 
otherwise return a non-nullable type. 

Also, fix a minor bug in cast function when target is int type.    


Diffs
-----

  
common/src/main/java/org/apache/drill/common/expression/OutputTypeDeterminer.java
 66523c4 
  
common/src/main/java/org/apache/drill/common/expression/fn/CastFunctionDefs.java
 6a98f94 
  exec/java-exec/src/main/codegen/data/Casts.tdd ceb9cde 
  
exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestCastFunctions.java
 3010c37 
  exec/java-exec/src/test/resources/functions/cast/testCastVarCharNull.json 
PRE-CREATION 
  exec/java-exec/src/test/resources/jsoninput/input1.json PRE-CREATION 

Diff: https://reviews.apache.org/r/18047/diff/


Testing
-------

Add a junit test case and read data from a json file. Test cast from nullable 
int to varchar, and from nullable float to varchar. 


Thanks,

Jinfeng Ni

Reply via email to