Hi All, I have made a quick naïve implementation of the cast functionality so that we have something on which we can start discussions on. I am getting the closest match of called function. Now I need a way to convert the function call to the new data types. Can anyone point how can we convert the function call.
https://github.com/yashs360/incubator-drill-casting/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/OperatorFunctionResolver.java Currently I am returning the best matched function directly. Below are the results of my code so far. - Yash Provided functions for add (MathFunctions.java): ------------------------------------------------------------ ADD( INT, INT) ADD(BIGINT, BIGINT) ADD(FLOAT4, FLOAT4) ADD( FLOAT8, FLOAT8) Incoming function call : ----------------------------- INT(FLOAT4, FLOAT4) ADD(FLOAT4, INT) ADD( INT, FLOAT4) RESULTS: ----------------- 0: jdbc:drill:schema=parquet-local> select 2.3 + 2.2 as cast_result from "sample-data/region.parquet"; +--------------+ | CAST_RESULT | +--------------+ | 4.5 | | 4.5 | | 4.5 | | 4.5 | | 4.5 | +--------------+ 0: jdbc:drill:schema=parquet-local> select 2.3 + 2 as cast_result from "sample-data/region.parquet"; +--------------+ | CAST_RESULT | +--------------+ | 4.3 | | 4.3 | | 4.3 | | 4.3 | | 4.3 | +--------------+ 0: jdbc:drill:schema=parquet-local> select 2 + 2.3 as cast_result from "sample-data/region.parquet"; Caused by: org.apache.drill.exec.rpc.RpcException: [error_id: "b69f5eaf-b592-428b-8011-bab75a327191" endpoint { address: "localhost" user_port: 31010 bit_port: 31011 } error_type: 0 message: "Screen received stop request sent. < SchemaChangeException:[ Failure while attempting to load generated class ] < ClassTransformationException:[ Failure generating transformation classes for value: \n \npackage org.apache.drill.exec.test.generated;\n\nimport org.apache.drill.exec.exception.SchemaChangeException;\nimport org.apache.drill.exec.expr.holders.BigIntHolder;\nimport org.apache.drill.exec.expr.holders.Float8Holder;\nimport org.apache.drill.exec.ops.FragmentContext;\nimport org.apache.drill.exec.record.RecordBatch;\nimport org.apache.drill.exec.vector.BigIntVector;\n\npublic class Gen5 {\n\n BigIntVector vv3;\n\n public void doSetup(FragmentContext context, RecordBatch incoming, RecordBatch outgoing)\n throws SchemaChangeException\n {\n {\n /** start SETUP for function add **/ \n {\n {}\n }\n /** end SETUP for function add **/ \n Object tmp4 = (outgoing).getValueAccessorById(0, BigIntVector.class).getValueVector();\n if (tmp4 == null) {\n throw new SchemaChangeException(\"Failure while loading vector vv3 with id: TypedFieldId [type=minor_type: BIGINT\\nmode: REQUIRED\\n, fieldId=0, isSuperReader=false].\");\n }\n vv3 = ((BigIntVector) tmp4);\n }\n }\n\n public void doEval(int inIndex, int outIndex)\n throws SchemaChangeException\n {\n {\n BigIntHolder out0 = new BigIntHolder();\n out0 .value = 2L;\n Float8Holder out1 = new Float8Holder();\n out1 .value = 2.2D;\n Float8Holder out2 = new Float8Holder();\n {\n final Float8Holder out = new Float8Holder();\n BigIntHolder left = out0;\n Float8Holder right = out1;\n \n out.value = left.value + right.value;\n \n out2 = out;\n }\n vv3 .getMutator().set((outIndex), out2 .value);\n }\n }\n\n}\n ] < CompileException:[ Line 50, Column 34: No applicable constructor/method found for actual parameters \"int, double\"; candidates are: \"/*default*/ void org.apache.drill.exec.vector.BigIntVector$Mutator.set(int, org.apache.drill.exec.expr.holders.NullableBigIntHolder)\", \"public void org.apache.drill.exec.vector.BigIntVector$Mutator.set(int, org.apache.drill.exec.expr.holders.BigIntHolder)\", \"public void org.apache.drill.exec.vector.BigIntVector$Mutator.set(int, long)\" ]" ] at org.apache.drill.sql.client.full.BatchListener.resultArrived(BatchListener.java:52) at org.apache.drill.exec.rpc.user.QueryResultHandler.batchArrived(QueryResultHandler.java:75) at org.apache.drill.exec.rpc.user.UserClient.handle(UserClient.java:79) at org.apache.drill.exec.rpc.BasicClientWithConnection.handle(BasicClientWithConnection.java:48) at org.apache.drill.exec.rpc.BasicClientWithConnection.handle(BasicClientWithConnection.java:33) at org.apache.drill.exec.rpc.RpcBus$InboundHandler.decode(RpcBus.java:142) at org.apache.drill.exec.rpc.RpcBus$InboundHandler.decode(RpcBus.java:127) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:334) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:320) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:334) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:320) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:334) at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:320) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:497) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:465) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:359) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) at java.lang.Thread.run(Thread.java:724) -----Original Message----- From: Jason Altekruse [mailto:[email protected]] Sent: Wednesday, November 06, 2013 12:46 PM To: drill-dev Subject: Re: Thread for discussing CAST functionality The last few letters were cut off here is the correct link https://www.dropbox.com/s/puwilz8dv2qp13p/Drillcast%20compatibility.xlsx On Tue, Nov 5, 2013 at 11:57 PM, Dhruv <[email protected]> wrote: > Hi Yash, > > +1. I am in. > I think dropbox link is broken. can you re-check? > > -Dhruv > > > On 11/06/2013 11:08 AM, Yash Sharma wrote: > >> Hi All, >> I see that cast functionality is not moving on with a good pace and >> also blocking few other tasks, so thought of making a separate thread >> for discussing about it. >> I am thinking of putting dedicated hours for Cast functionality this >> week so that we can at least have some plan ready for it. >> >> We can have a dedicated hangout for discussing it too. >> Thoughts? >> >> >> JIRA: https://issues.apache.org/jira/browse/DRILL-259 >> Proposal Doc: https://docs.google.com/document/d/1HzcWg4uQ42gnz_ >> IlgxEzpE2PjPpYvgPjkHyfA04vCac/edit#<https://docs.google.com/ >> document/d/1HzcWg4uQ42gnz_IlgxEzpE2PjPpYvgPjkHyfA04vCac/edit> >> >> Type cast compatibility chart: https://www.dropbox.com/s/ >> puwilz8dv2qp13p/Drillcast%20compatibility.xl >> >> >> - Yash >> >> >> ________________________________ >> >> >> >> >> >> >> 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. >> >> > ________________________________ 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.
