Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Drill >> mail # dev >> Re: Review Request 15871: DRILL-316. Explicit cast support in drill execution engine .


Copy link to this message
-
Re: Review Request 15871: DRILL-316. Explicit cast support in drill execution engine .

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

common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g
<https://reviews.apache.org/r/15871/#comment58450>

    As discussed, it is weird to treat the type as a logical expression.  Can you please modify this to be a new struct that holds the information associated with charType and numType?  Same for typeLen.  Or maybe just build a more complicated parser rule?  Otherwise it seems like a hack

common/src/main/java/org/apache/drill/common/expression/FunctionRegistry.java
<https://reviews.apache.org/r/15871/#comment58452>

    Can you add these definitions so that they are automatically generated as part of type helper so we don't have to worry about maintenance in multiple places?

exec/java-exec/src/main/codegen/templates/CastFunctionsSrcVarLen.java
<https://reviews.apache.org/r/15871/#comment58449>

    Can you take a quick look at what this looks like in machine code after optimized.  I'm concerned that it will be inefficient.
- Jacques Nadeau
On Dec. 16, 2013, 5:52 p.m., Jinfeng Ni wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/15871/
> -----------------------------------------------------------
>
> (Updated Dec. 16, 2013, 5:52 p.m.)
>
>
> Review request for drill.
>
>
> Repository: drill-git
>
>
> Description
> -------
>
> The explicit cast function is treated as a special function call. Its syntax in logical/physical plan:
>    
>     cast (input_expr as int | bigint | float4 | float8 | varchar(length) | varbinary(length) )
>
> The main code changes :
> 1) parser change to read expression in logical/physical plan, which may contain an explicit cast function
> 2) FunctionRegistry.java is added with two methods to build a logical expression for cast function.
> 3) Add 3 function template to generate the different type of cast functions :
>  
>    CastFunctionsSrcVarLen.java : when source type has varied length, target type has fixed length.
>    CastFunctionsTargetVarLen.java: when source type has fixed length, target type has varied length.
>    CastFunctionsSrcVarLenTargetVarLen.java: when both source and target type have varied length.
>
> Currently, the following 6 types can be cast into each other
>   float4, float8, int, bigint, varchar, varbinary.
>
>
> Diffs
> -----
>
>   common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprLexer.g 76da965
>   common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g 7fc1651
>   common/src/main/java/org/apache/drill/common/expression/FunctionCall.java a8b7e01
>   common/src/main/java/org/apache/drill/common/expression/FunctionDefinition.java fb00dc7
>   common/src/main/java/org/apache/drill/common/expression/FunctionRegistry.java 73e1925
>   common/src/main/java/org/apache/drill/common/expression/OutputTypeDeterminer.java 2f583d5
>   common/src/main/java/org/apache/drill/common/expression/fn/CastFunctionDefs.java PRE-CREATION
>   exec/java-exec/src/main/codegen/data/Casts.tdd 760b0f9
>   exec/java-exec/src/main/codegen/templates/CastFunctions.java 85a00b0
>   exec/java-exec/src/main/codegen/templates/CastFunctionsSrcVarLen.java PRE-CREATION
>   exec/java-exec/src/main/codegen/templates/CastFunctionsSrcVarLenTargetVarLen.java PRE-CREATION
>   exec/java-exec/src/main/codegen/templates/CastFunctionsTargetVarLen.java PRE-CREATION
>   exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillFuncHolder.java e001ffe
>   exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java 5bbab76
>   exec/java-exec/src/main/java/org/apache/drill/exec/vector/ValueHolderHelper.java 077c693
>   exec/java-exec/src/main/java/org/apache/drill/exec/work/FragmentRunner.java d003972