Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-7569

IndexOutOfBoundsException when building SyntaxError message snippet

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.1.1
    • Legacy/CQL
    • None
    • Low

    Description

      When parsing the following query (which is expected to fail), an IndexOutOfBoundsException is hit when looking up the bad token:

      CREATE TABLE mytable (k int PRIMARY KEY,  v_1 tuple<int>,  v_2 tuple<int, int>,  v_3 tuple<int, int, int>,  v_384 tuple<int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>))
      

      Here's the stacktrace (after I added a log statement, which we should probably make permanent at DEBUG level):

      ERROR [SharedPool-Worker-3] 2014-07-17 21:30:58,165 QueryProcessor.java:465 - Exception parsing statement:
      java.lang.IndexOutOfBoundsException: Index: 1206, Size: 1206
          at java.util.ArrayList.rangeCheck(ArrayList.java:635) ~[na:1.7.0_45]
          at java.util.ArrayList.get(ArrayList.java:411) ~[na:1.7.0_45]
          at org.antlr.runtime.CommonTokenStream.get(CommonTokenStream.java:296) ~[antlr-3.2.jar:na]
          at org.apache.cassandra.cql3.ErrorCollector.appendQuerySnippet(ErrorCollector.java:118) ~[main/:na]
          at org.apache.cassandra.cql3.ErrorCollector.syntaxError(ErrorCollector.java:79) ~[main/:na]
          at org.apache.cassandra.cql3.CqlParser.displayRecognitionError(CqlParser.java:266) ~[main/:na]
          at org.antlr.runtime.BaseRecognizer.reportError(BaseRecognizer.java:186) ~[antlr-3.2.jar:na]
          at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(BaseRecognizer.java:596) ~[antlr-3.2.jar:na]
          at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115) ~[antlr-3.2.jar:na]
          at org.apache.cassandra.cql3.CqlParser.query(CqlParser.java:367) ~[main/:na]
          at org.apache.cassandra.cql3.QueryProcessor.parseStatement(QueryProcessor.java:455) [main/:na]
          at org.apache.cassandra.cql3.QueryProcessor.getStatement(QueryProcessor.java:430) [main/:na]
          at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:200) [main/:na]
          at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:118) [main/:na]
          at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:421) [main/:na]
          at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:318) [main/:na]
          at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [netty-all-4.0.20.Final.jar:4.0.20.Final]
          at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:332) [netty-all-4.0.20.Final.jar:4.0.20.Final]
          at io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:31) [netty-all-4.0.20.Final.jar:4.0.20.Final]
          at io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:323) [netty-all-4.0.20.Final.jar:4.0.20.Final]
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_45]
          at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.run(AbstractTracingAwareExecutorService.java:162) [main/:na]
          at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:103) [main/:na]
          at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
      

      Attachments

        1. CASSANDRA-7569.txt
          2 kB
          Benjamin Lerer

        Activity

          People

            blerer Benjamin Lerer
            thobbs Tom Hobbs
            Benjamin Lerer
            Tom Hobbs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: