Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F7FC17634 for ; Fri, 27 Mar 2015 16:41:55 +0000 (UTC) Received: (qmail 96373 invoked by uid 500); 27 Mar 2015 16:41:55 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 96337 invoked by uid 500); 27 Mar 2015 16:41:54 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 96324 invoked by uid 99); 27 Mar 2015 16:41:54 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Mar 2015 16:41:54 +0000 Date: Fri, 27 Mar 2015 16:41:54 +0000 (UTC) From: "Tyler Hobbs (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-9037) Terminal UDFs evaluated at prepare time throw protocol version error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-9037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14384113#comment-14384113 ] Tyler Hobbs commented on CASSANDRA-9037: ---------------------------------------- It just occurred to me that we can't execute terminal functions at prepare-time if they return a collection. The reason is that the protocol version isn't known yet, and the serialization of the collection depends on the protocol version. So, we should either avoid executing if the return type is a collection type (or tuple or UDT that contains a collection), or execute anyway and handle re-serialization at execute time if the protocol version is not v3+. I'm guessing the first option is significantly simpler to implement. > Terminal UDFs evaluated at prepare time throw protocol version error > -------------------------------------------------------------------- > > Key: CASSANDRA-9037 > URL: https://issues.apache.org/jira/browse/CASSANDRA-9037 > Project: Cassandra > Issue Type: Bug > Reporter: Sam Tunnicliffe > Assignee: Sam Tunnicliffe > Fix For: 3.0 > > > When a pure function with only terminal arguments (or with no arguments) is used in a where clause, it's executed at prepare time and {{Server.CURRENT_VERSION}} passed as the protocol version for serialization purposes. For native functions, this isn't a problem, but UDFs use classes in the bundled java-driver-core jar for (de)serialization of args and return values. When {{Server.CURRENT_VERSION}} is greater than the highest version supported by the bundled java driver the execution fails with the following exception: > {noformat} > ERROR [SharedPool-Worker-1] 2015-03-24 18:10:59,391 QueryMessage.java:132 - Unexpected error during query > org.apache.cassandra.exceptions.FunctionExecutionException: execution of 'ks.overloaded[text]' failed: java.lang.IllegalArgumentException: No protocol version matching integer version 4 > at org.apache.cassandra.exceptions.FunctionExecutionException.create(FunctionExecutionException.java:35) ~[main/:na] > at org.apache.cassandra.cql3.udf.gen.Cksoverloaded_1.execute(Cksoverloaded_1.java) ~[na:na] > at org.apache.cassandra.cql3.functions.FunctionCall.executeInternal(FunctionCall.java:78) ~[main/:na] > at org.apache.cassandra.cql3.functions.FunctionCall.access$200(FunctionCall.java:34) ~[main/:na] > at org.apache.cassandra.cql3.functions.FunctionCall$Raw.execute(FunctionCall.java:176) ~[main/:na] > at org.apache.cassandra.cql3.functions.FunctionCall$Raw.prepare(FunctionCall.java:161) ~[main/:na] > at org.apache.cassandra.cql3.SingleColumnRelation.toTerm(SingleColumnRelation.java:108) ~[main/:na] > at org.apache.cassandra.cql3.SingleColumnRelation.newEQRestriction(SingleColumnRelation.java:143) ~[main/:na] > at org.apache.cassandra.cql3.Relation.toRestriction(Relation.java:127) ~[main/:na] > at org.apache.cassandra.cql3.restrictions.StatementRestrictions.(StatementRestrictions.java:126) ~[main/:na] > at org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.prepareRestrictions(SelectStatement.java:787) ~[main/:na] > at org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.prepare(SelectStatement.java:740) ~[main/:na] > at org.apache.cassandra.cql3.QueryProcessor.getStatement(QueryProcessor.java:488) ~[main/:na] > at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:252) ~[main/:na] > at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:246) ~[main/:na] > at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:119) ~[main/:na] > at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:475) [main/:na] > at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:371) [main/:na] > at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.23.Final.jar:4.0.23.Final] > at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [netty-all-4.0.23.Final.jar:4.0.23.Final] > at io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:32) [netty-all-4.0.23.Final.jar:4.0.23.Final] > at io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:324) [netty-all-4.0.23.Final.jar:4.0.23.Final] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71] > at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.run(AbstractTracingAwareExecutorService.java:164) [main/:na] > at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:105) [main/:na] > at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71] > Caused by: java.lang.IllegalArgumentException: No protocol version matching integer version 4 > at com.datastax.driver.core.ProtocolVersion.fromInt(ProtocolVersion.java:89) ~[cassandra-driver-core-2.1.2.jar:na] > at org.apache.cassandra.cql3.functions.UDFunction.compose(UDFunction.java:177) ~[main/:na] > ... 25 common frames omitted > {noformat} > This is currently the case on trunk following the bump of {{Server.CURRENT_VERSION}} to 4 by CASSANDRA-7660. -- This message was sent by Atlassian JIRA (v6.3.4#6332)