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

Switch to Threaded View
Drill >> mail # dev >> Query regarding Scalar Functions implementation


Copy link to this message
-
Query regarding Scalar Functions implementation
Hi Team,
I had two  questions regarding the  implementation of  Scalar Functions.

1. What would be the Output type of Division func (given: Input types are all Integers)

Currently I have provided an implementation of the DIVISION func which has input/output params as :
        @Param  IntHolder left;
        @Param  IntHolder right;
         @Output IntHolder out;

now, the issue is the data type of output field:
output type will be integer if left & right are divisible integers, while..
output type would be decimal if left & right are non-divisible integers (i.e.  have a remainder)

So my question is,
Do I have to provide 3 overloaded methods for division with different @output types, (IntHolder, Float4Holder, Float8Holder) ?
or shall I have a  Float8 output type irrespective of the inputs?

Other functions like add/multiple & subtract won't be having this issue.. . It's only the issue with division.
2. What would be the input type for any Scalar func (given: Input types might not always be Integers).

Inputs would also be of different data types as Float4Holder & Float8Holder, so would we have to provide overloaded methods for different combinations of input types?
This would be the case with all scalar functions (+_*/).

Any Suggestions?
Thanks,
Yash Sharma

________________________________
NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.