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

Switch to Threaded View
Drill >> mail # dev >> Review Request 16490: DRILL_259 : implicit cast support in drill.


Copy link to this message
-
Re: Review Request 16490: DRILL_259 : implicit cast support in drill.


> On Jan. 3, 2014, 6:56 p.m., Timothy Chen wrote:
> > exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java, line 272
> > <https://reviews.apache.org/r/16490/diff/2/?file=406753#file406753line272>
> >
> >     This uses epoch time?
>
> Jinfeng Ni wrote:
>     Yash might have a better idea, since he put those rules together, probably from Optiq.
>    
>     From what I understand, yes, it will convert epoch time into datetime/timestamp.  For instance, postgres has function to_timestamp(double precision).  Whether we support such function probably depends on how we implement date/time type in Drill.

I did not think of epoch time conversions while creating the rule set. Created it similar to that being used in Optiq with Drill's datatypes. It would be a good thing to have and we can discuss on how we can support the conversion in drill.
- Yash
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/16490/#review31106
-----------------------------------------------------------
On Jan. 3, 2014, 10:57 p.m., Jinfeng Ni wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/16490/
> -----------------------------------------------------------
>
> (Updated Jan. 3, 2014, 10:57 p.m.)
>
>
> Review request for drill.
>
>
> Repository: drill-git
>
>
> Description
> -------
>
> This patch is to provide implicit cast support in Drill.
>
> The code change is mainly in two areas:
>
> 1. Function Resolver and related type cast rules : used to choose the best matched function implementation corresponding to a function name and its list of argument types. Type promotion would be implied, if there is no function implementation whose parameter types exactly match the argument types. Type promotion is implemented using the type precedence list. Type promotion is checked against a rule which will help implement a isCastable(from, to) method.  
> New files: 1) DefaultFunctionResolver.java
>            2) FunctionResolver
>            3) FunctionResolverFactor.java
>            4) OperatorFunctionResolver.java : reserved for future use.
>            5) ResolverTypePrecedence.java
>            6) TypeCastRules.java
>            7) UDFFunctionResolver.java : reserved for future use.
>
> 2. ImplicitCastBuilder : to inject implicit cast whenever necessary. After the function resolver returns a best matched function implementation, if the param type does not match the argument type, an implicit cast will be inserted on top of the argument.
>    - ImplicitCastBuilder uses a visitor to inject implicit cast.
>    - ImplicitCastBuilder will be part of ExpressionTreeMateralizer, after we materialize the expression tree.
>    - ExpressionValidator will be called after implicit cast is injected, in stead of after expression materialization.
>    - Because ImplicitCastBuilder requires a FunctionImplementationRegistry (to decide the best matched function implementation), and ImplicitCastBuilder is part of ExpressionTreeMaterializer, all the call of ExpressionTreeMaterializer is modified by adding a FunctionImplementationRegistry.
>
> New files or modified files:
>             1)CastFunctionDefs.java
>             2)ExpressionTreeMaterializer.java
>             3)ImplicitCastBuilder.java
>             4)DrillFuncHolder.java : expose param type and size
>             5)FunctionImplementationRegistry.java : expose the list of function implementation.
>             6) other files because of the change to ExpressionTreeMaterializer.java.
>
> Some other minor changes:
>
> 1. ArgumentValidator.ComparableArguments :
>   change allSame from true to false, since currently we have comparison operators defined over different types of inputs.
>
> 2. VectorUtil:
>   Add code to handle null value when display the result.
>
>