Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
        CHANGES.txt
        src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
        test/unit/org/apache/cassandra/cql3/MultiColumnRelationTest.java


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/aca77ec8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/aca77ec8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/aca77ec8

Branch: refs/heads/trunk
Commit: aca77ec878ce9982d658dc4fe9e97292ebffe3bd
Parents: c99f37e aae9b91
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Wed Sep 3 13:05:03 2014 -0500
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Wed Sep 3 13:05:03 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                                    | 3 ++-
 .../org/apache/cassandra/cql3/statements/SelectStatement.java  | 6 ++++++
 .../org/apache/cassandra/cql3/MultiColumnRelationTest.java     | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/aca77ec8/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index e93b16c,7be8979..5404f83
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,65 -1,7 +1,67 @@@
 -2.0.11:
 - * Explicitly disallowing mixing multi-column and single-column
 +2.1.1
 + * (cqlsh): Show progress of COPY operations (CASSANDRA-7789)
 + * Add syntax to remove multiple elements from a map (CASSANDRA-6599)
 + * Support non-equals conditions in lightweight transactions (CASSANDRA-6839)
 + * Add IF [NOT] EXISTS to create/drop triggers (CASSANDRA-7606)
 + * (cqlsh) Display the current logged-in user (CASSANDRA-7785)
 + * (cqlsh) Don't ignore CTRL-C during COPY FROM execution (CASSANDRA-7815)
 + * (cqlsh) Order UDTs according to cross-type dependencies in DESCRIBE
 +   output (CASSANDRA-7659)
 + * (cqlsh) Fix handling of CAS statement results (CASSANDRA-7671)
 + * (cqlsh) COPY TO/FROM improvements (CASSANDRA-7405)
 + * Support list index operations with conditions (CASSANDRA-7499)
 + * Add max live/tombstoned cells to nodetool cfstats output (CASSANDRA-7731)
 + * Validate IPv6 wildcard addresses properly (CASSANDRA-7680)
 + * (cqlsh) Error when tracing query (CASSANDRA-7613)
 + * Avoid IOOBE when building SyntaxError message snippet (CASSANDRA-7569)
 + * SSTableExport uses correct validator to create string representation of 
partition
 +   keys (CASSANDRA-7498)
 + * Avoid NPEs when receiving type changes for an unknown keyspace 
(CASSANDRA-7689)
 + * Add support for custom 2i validation (CASSANDRA-7575)
 + * Pig support for hadoop CqlInputFormat (CASSANDRA-6454)
 + * Add listen_interface and rpc_interface options (CASSANDRA-7417)
 + * Improve schema merge performance (CASSANDRA-7444)
 + * Adjust MT depth based on # of partition validating (CASSANDRA-5263)
 + * Optimise NativeCell comparisons (CASSANDRA-6755)
 + * Configurable client timeout for cqlsh (CASSANDRA-7516)
 + * Include snippet of CQL query near syntax error in messages (CASSANDRA-7111)
 +Merged from 2.0:
++ * Explicitly disallow mixing multi-column and single-column
+    relations on clustering columns (CASSANDRA-7711)
   * Better error message when condition is set on PK column (CASSANDRA-7804)
 + * Don't send schema change responses and events for no-op DDL
 +   statements (CASSANDRA-7600)
 + * (Hadoop) fix cluster initialisation for a split fetching (CASSANDRA-7774)
 + * Throw InvalidRequestException when queries contain relations on entire
 +   collection columns (CASSANDRA-7506)
 + * (cqlsh) enable CTRL-R history search with libedit (CASSANDRA-7577)
 + * (Hadoop) allow ACFRW to limit nodes to local DC (CASSANDRA-7252)
 + * (cqlsh) cqlsh should automatically disable tracing when selecting
 +   from system_traces (CASSANDRA-7641)
 + * (Hadoop) Add CqlOutputFormat (CASSANDRA-6927)
 + * Don't depend on cassandra config for nodetool ring (CASSANDRA-7508)
 + * (cqlsh) Fix failing cqlsh formatting tests (CASSANDRA-7703)
 + * Fix IncompatibleClassChangeError from hadoop2 (CASSANDRA-7229)
 + * Add 'nodetool sethintedhandoffthrottlekb' (CASSANDRA-7635)
 + * (cqlsh) Add tab-completion for CREATE/DROP USER IF [NOT] EXISTS 
(CASSANDRA-7611)
 + * Catch errors when the JVM pulls the rug out from GCInspector 
(CASSANDRA-5345)
 + * cqlsh fails when version number parts are not int (CASSANDRA-7524)
 +Merged from 1.2:
 + * Improve PasswordAuthenticator default super user setup (CASSANDRA-7788)
 +
 +
 +2.1.0
 + * Add frozen keyword and require UDT to be frozen (CASSANDRA-7857)
 + * Track added sstable size correctly (CASSANDRA-7239)
 + * (cqlsh) Fix case insensitivity (CASSANDRA-7834)
 + * Fix failure to stream ranges when moving (CASSANDRA-7836)
 + * Correctly remove tmplink files (CASSANDRA-7803)
 + * (cqlsh) Fix column name formatting for functions, CAS operations,
 +   and UDT field selections (CASSANDRA-7806)
 + * (cqlsh) Fix COPY FROM handling of null/empty primary key
 +   values (CASSANDRA-7792)
 + * Fix ordering of static cells (CASSANDRA-7763)
 +Merged from 2.0:
   * Forbid re-adding dropped counter columns (CASSANDRA-7831)
   * Fix CFMetaData#isThriftCompatible() for PK-only tables (CASSANDRA-7832)
   * Always reject inequality on the partition key without token()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aca77ec8/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
index a2e6624,ea1d8e9..586eb85
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@@ -1391,31 -1409,34 +1393,35 @@@ public class SelectStatement implement
                  if (relation.isMultiColumn())
                  {
                      MultiColumnRelation rel = (MultiColumnRelation) relation;
 -                    List<CFDefinition.Name> names = new 
ArrayList<>(rel.getEntities().size());
 +                    List<ColumnDefinition> names = new 
ArrayList<>(rel.getEntities().size());
                      for (ColumnIdentifier entity : rel.getEntities())
                      {
 -                        boolean[] queriable = processRelationEntity(stmt, 
relation, entity, cfDef);
 +                        ColumnDefinition def = 
cfm.getColumnDefinition(entity);
 +                        boolean[] queriable = processRelationEntity(stmt, 
relation, entity, def);
                          hasQueriableIndex |= queriable[0];
                          hasQueriableClusteringColumnIndex |= queriable[1];
 -                        Name name = cfDef.get(entity);
 -                        names.add(name);
 -                        hasMultiColumnRelations |= 
Kind.COLUMN_ALIAS.equals(name.kind);
 +                        names.add(def);
++                        hasMultiColumnRelations |= 
ColumnDefinition.Kind.CLUSTERING_COLUMN.equals(def.kind);
                      }
                      updateRestrictionsForRelation(stmt, names, rel, 
boundNames);
                  }
                  else
                  {
                      SingleColumnRelation rel = (SingleColumnRelation) 
relation;
 -                    boolean[] queriable = processRelationEntity(stmt, 
relation, rel.getEntity(), cfDef);
 +                    ColumnIdentifier entity = rel.getEntity();
 +                    ColumnDefinition def = cfm.getColumnDefinition(entity);
 +                    boolean[] queriable = processRelationEntity(stmt, 
relation, entity, def);
                      hasQueriableIndex |= queriable[0];
                      hasQueriableClusteringColumnIndex |= queriable[1];
 -                    Name name = cfDef.get(rel.getEntity());
 -                    hasSingleColumnRelations |= 
Kind.COLUMN_ALIAS.equals(name.kind);
 -                    updateRestrictionsForRelation(stmt, name, rel, 
boundNames);
++                    hasSingleColumnRelations |= 
ColumnDefinition.Kind.CLUSTERING_COLUMN.equals(def.kind);
 +                    updateRestrictionsForRelation(stmt, def, rel, boundNames);
                  }
              }
+             if (hasSingleColumnRelations && hasMultiColumnRelations)
+                 throw new InvalidRequestException("Mixing single column 
relations and multi column relations on clustering columns is not allowed");
  
               // At this point, the select statement if fully constructed, but 
we still have a few things to validate
 -            processPartitionKeyRestrictions(stmt, cfDef, hasQueriableIndex);
 +            processPartitionKeyRestrictions(stmt, hasQueriableIndex, cfm);
  
              // All (or none) of the partition key columns have been specified;
              // hence there is no need to turn these restrictions into index 
expressions.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aca77ec8/test/unit/org/apache/cassandra/cql3/MultiColumnRelationTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/MultiColumnRelationTest.java
index bfc6d2d,498d332..bcf4f27
--- a/test/unit/org/apache/cassandra/cql3/MultiColumnRelationTest.java
+++ b/test/unit/org/apache/cassandra/cql3/MultiColumnRelationTest.java
@@@ -33,42 -205,344 +33,45 @@@ public class MultiColumnRelationTest ex
      }
  
      @Test
 -    public void testSingleClusteringColumnEquality() throws Throwable
 +    public void testMultiClusteringInvalidQueries() throws Throwable
      {
 -        execute("INSERT INTO %s.single_clustering (a, b, c) VALUES (0, 0, 
0)");
 -        execute("INSERT INTO %s.single_clustering (a, b, c) VALUES (0, 1, 
0)");
 -        execute("INSERT INTO %s.single_clustering (a, b, c) VALUES (0, 2, 
0)");
 -        UntypedResultSet results = execute("SELECT * FROM 
%s.single_clustering WHERE a=0 AND (b) = (1)");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 1, 0);
 -
 -        results = execute("SELECT * FROM %s.single_clustering WHERE a=0 AND 
(b) = (3)");
 -        assertEquals(0, results.size());
 -    }
 +        createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY KEY 
(a, b, c, d))");
  
 -    @Test
 -    public void testMultipleClusteringColumnEquality() throws Throwable
 -    {
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
0, 0, 0)");
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
1, 0, 0)");
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
1, 1, 0)");
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
1, 1, 1)");
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
2, 0, 0)");
 -        UntypedResultSet results = execute("SELECT * FROM 
%s.multiple_clustering WHERE a=0 AND (b) = (1)");
 -        assertEquals(3, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 0);
 -        checkRow(2, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c) = (1, 1)");
 -        assertEquals(2, results.size());
 -        checkRow(0, results, 0, 1, 1, 0);
 -        checkRow(1, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) = (1, 1, 1)");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 1, 1, 1);
 -        execute("DELETE FROM %s.multiple_clustering WHERE a=0 AND b=2 and c=0 
and d=0");
 -    }
 +        assertInvalidSyntax("SELECT * FROM %s WHERE a = 0 AND (b, c) > ()");
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (b, c) > (?, ?, ?)", 
1, 2, 3);
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (b, c) > (?, ?)", 1, 
null);
  
 -    @Test(expected=InvalidRequestException.class)
 -    public void testPartitionAndClusteringColumnEquality() throws Throwable
 -    {
 -        execute("SELECT * FROM %s.single_clustering WHERE (a, b) = (0, 0)");
 -    }
 +        // Wrong order of columns
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (d, c, b) = (?, ?, 
?)", 0, 0, 0);
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (d, c, b) > (?, ?, 
?)", 0, 0, 0);
  
 -    @Test(expected=InvalidRequestException.class)
 -    public void testClusteringColumnsOutOfOrderInEquality() throws Throwable
 -    {
 -        execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND (d, c, b) 
= (3, 2, 1)");
 -    }
 +        // Wrong number of values
 +        assertInvalid("SELECT * FROM %s WHERE a=0 AND (b, c, d) IN ((?, ?))", 
0, 1);
 +        assertInvalid("SELECT * FROM %s WHERE a=0 AND (b, c, d) IN ((?, ?, ?, 
?, ?))", 0, 1, 2, 3, 4);
  
 -    @Test(expected=InvalidRequestException.class)
 -    public void testBadType() throws Throwable
 -    {
 -        execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND (b, c, d) 
= (1, 2, 'foobar')");
 -    }
 +        // Missing first clustering column
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (c, d) = (?, ?)", 0, 
0);
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (c, d) > (?, ?)", 0, 
0);
  
 -    @Test(expected=SyntaxException.class)
 -    public void testSingleColumnTupleRelation() throws Throwable
 -    {
 -        execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND b = (1, 
2, 3)");
 -    }
 +        // Nulls
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (b, c, d) IN ((?, ?, 
?))", 1, 2, null);
  
 -    @Test
 -    public void testMixSingleAndTupleInequalities() throws Throwable
 -    {
 -        String[] queries = new String[]{
 -            "SELECT * FROM %s.multiple_clustering WHERE a=0 AND (b, c, d) > 
(0, 1, 0) AND b < 1",
 -            "SELECT * FROM %s.multiple_clustering WHERE a=0 AND (b, c, d) > 
(0, 1, 0) AND c < 1",
 -            "SELECT * FROM %s.multiple_clustering WHERE a=0 AND b > 1 AND (b, 
c, d) < (1, 1, 0)",
 -            "SELECT * FROM %s.multiple_clustering WHERE a=0 AND c > 1 AND (b, 
c, d) < (1, 1, 0)",
 -        };
 -
 -        for (String query : queries)
 -        {
 -            try
 -            {
 -                execute(query);
 -                fail(String.format("Expected query \"%s\" to throw an 
InvalidRequestException", query));
 -            }
 -            catch (InvalidRequestException e) {}
 -        }
 -    }
 +        // Wrong type for 'd'
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (b, c, d) = (?, ?, 
?)", 1, 2, "foobar");
  
 -    @Test
 -    public void testSingleClusteringColumnInequality() throws Throwable
 -    {
 -        execute("INSERT INTO %s.single_clustering (a, b, c) VALUES (0, 0, 
0)");
 -        execute("INSERT INTO %s.single_clustering (a, b, c) VALUES (0, 1, 
0)");
 -        execute("INSERT INTO %s.single_clustering (a, b, c) VALUES (0, 2, 
0)");
 -
 -        UntypedResultSet results = execute("SELECT * FROM 
%s.single_clustering WHERE a=0 AND (b) > (0)");
 -        assertEquals(2, results.size());
 -        checkRow(0, results, 0, 1, 0);
 -        checkRow(1, results, 0, 2, 0);
 -
 -        results = execute("SELECT * FROM %s.single_clustering WHERE a=0 AND 
(b) >= (1)");
 -        assertEquals(2, results.size());
 -        checkRow(0, results, 0, 1, 0);
 -        checkRow(1, results, 0, 2, 0);
 -
 -        results = execute("SELECT * FROM %s.single_clustering WHERE a=0 AND 
(b) < (2)");
 -        assertEquals(2, results.size());
 -        checkRow(0, results, 0, 0, 0);
 -        checkRow(1, results, 0, 1, 0);
 -
 -        results = execute("SELECT * FROM %s.single_clustering WHERE a=0 AND 
(b) <= (1)");
 -        assertEquals(2, results.size());
 -        checkRow(0, results, 0, 0, 0);
 -        checkRow(1, results, 0, 1, 0);
 -
 -        results = execute("SELECT * FROM %s.single_clustering WHERE a=0 AND 
(b) > (0) AND (b) < (2)");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 1, 0);
 -    }
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND b = (?, ?, ?)", 1, 2, 
3);
  
 -    @Test
 -    public void testMultipleClusteringColumnInequality() throws Throwable
 -    {
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
0, 0, 0)");
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
0, 1, 0)");
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
0, 1, 1)");
 -
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
1, 0, 0)");
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
1, 1, 0)");
 -        execute("INSERT INTO %s.multiple_clustering (a, b, c, d) VALUES (0, 
1, 1, 1)");
 -
 -        UntypedResultSet results = execute("SELECT * FROM 
%s.multiple_clustering WHERE a=0 AND (b) > (0)");
 -        assertEquals(3, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 0);
 -        checkRow(2, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b) >= (0)");
 -        assertEquals(6, results.size());
 -        checkRow(0, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 0);
 -        checkRow(2, results, 0, 0, 1, 1);
 -        checkRow(3, results, 0, 1, 0, 0);
 -        checkRow(4, results, 0, 1, 1, 0);
 -        checkRow(5, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c) > (1, 0)");
 -        assertEquals(2, results.size());
 -        checkRow(0, results, 0, 1, 1, 0);
 -        checkRow(1, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c) >= (1, 0)");
 -        assertEquals(3, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 0);
 -        checkRow(2, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) > (1, 1, 0)");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) >= (1, 1, 0)");
 -        assertEquals(2, results.size());
 -        checkRow(0, results, 0, 1, 1, 0);
 -        checkRow(1, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b) < (1)");
 -        assertEquals(3, results.size());
 -        checkRow(0, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 0);
 -        checkRow(2, results, 0, 0, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b) <= (1)");
 -        assertEquals(6, results.size());
 -        checkRow(0, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 0);
 -        checkRow(2, results, 0, 0, 1, 1);
 -        checkRow(3, results, 0, 1, 0, 0);
 -        checkRow(4, results, 0, 1, 1, 0);
 -        checkRow(5, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c) < (0, 1)");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 0, 0, 0);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c) <= (0, 1)");
 -        assertEquals(3, results.size());
 -        checkRow(0, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 0);
 -        checkRow(2, results, 0, 0, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) < (0, 1, 1)");
 -        assertEquals(2, results.size());
 -        checkRow(0, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 0);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) <= (0, 1, 1)");
 -        checkRow(0, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 0);
 -        checkRow(2, results, 0, 0, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) > (0, 1, 0) AND (b) < (1)");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 0, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) > (0, 1, 1) AND (b, c) < (1, 1)");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) > (0, 1, 1) AND (b, c, d) < (1, 1, 0)");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 +        // Mix single and tuple inequalities
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (b, c, d) > (?, ?, ?) 
AND b < ?", 0, 1, 0, 1);
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND (b, c, d) > (?, ?, ?) 
AND c < ?", 0, 1, 0, 1);
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND b > ? AND (b, c, d) < 
(?, ?, ?)", 1, 1, 1, 0);
 +        assertInvalid("SELECT * FROM %s WHERE a = 0 AND c > ? AND (b, c, d) < 
(?, ?, ?)", 1, 1, 1, 0);
  
 -        // reversed
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b) > (0) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(3, results.size());
 -        checkRow(2, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 0);
 -        checkRow(0, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b) >= (0) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(6, results.size());
 -        checkRow(5, results, 0, 0, 0, 0);
 -        checkRow(4, results, 0, 0, 1, 0);
 -        checkRow(3, results, 0, 0, 1, 1);
 -        checkRow(2, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 0);
 -        checkRow(0, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c) > (1, 0) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(2, results.size());
 -        checkRow(1, results, 0, 1, 1, 0);
 -        checkRow(0, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c) >= (1, 0) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(3, results.size());
 -        checkRow(2, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 0);
 -        checkRow(0, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) > (1, 1, 0) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) >= (1, 1, 0) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(2, results.size());
 -        checkRow(1, results, 0, 1, 1, 0);
 -        checkRow(0, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b) < (1) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(3, results.size());
 -        checkRow(2, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 0);
 -        checkRow(0, results, 0, 0, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b) <= (1) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(6, results.size());
 -        checkRow(5, results, 0, 0, 0, 0);
 -        checkRow(4, results, 0, 0, 1, 0);
 -        checkRow(3, results, 0, 0, 1, 1);
 -        checkRow(2, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 0);
 -        checkRow(0, results, 0, 1, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c) < (0, 1) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 0, 0, 0);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c) <= (0, 1) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(3, results.size());
 -        checkRow(2, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 0);
 -        checkRow(0, results, 0, 0, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) < (0, 1, 1) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(2, results.size());
 -        checkRow(1, results, 0, 0, 0, 0);
 -        checkRow(0, results, 0, 0, 1, 0);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) <= (0, 1, 1) ORDER BY b DESC, c DESC, d DESC");
 -        checkRow(2, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 0);
 -        checkRow(0, results, 0, 0, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) > (0, 1, 0) AND (b) < (1) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 0, 1, 1);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) > (0, 1, 1) AND (b, c) < (1, 1) ORDER BY b DESC, c DESC, d DESC");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering WHERE a=0 AND 
(b, c, d) > (0, 1, 1) AND (b, c, d) < (1, 1, 0) ORDER BY b DESC, c DESC, d 
DESC");
 -        assertEquals(1, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 -    }
 +        assertInvalid("SELECT * FROM %s WHERE (a, b, c, d) IN ((?, ?, ?, 
?))", 0, 1, 2, 3);
 +        assertInvalid("SELECT * FROM %s WHERE (c, d) IN ((?, ?))", 0, 1);
+ 
 -    @Test
 -    public void testMultipleClusteringColumnInequalityReversedComponents() 
throws Throwable
 -    {
 -        // b and d are reversed in the clustering order
 -        execute("INSERT INTO %s.multiple_clustering_reversed (a, b, c, d) 
VALUES (0, 1, 0, 0)");
 -        execute("INSERT INTO %s.multiple_clustering_reversed (a, b, c, d) 
VALUES (0, 1, 1, 1)");
 -        execute("INSERT INTO %s.multiple_clustering_reversed (a, b, c, d) 
VALUES (0, 1, 1, 0)");
 -
 -        execute("INSERT INTO %s.multiple_clustering_reversed (a, b, c, d) 
VALUES (0, 0, 0, 0)");
 -        execute("INSERT INTO %s.multiple_clustering_reversed (a, b, c, d) 
VALUES (0, 0, 1, 1)");
 -        execute("INSERT INTO %s.multiple_clustering_reversed (a, b, c, d) 
VALUES (0, 0, 1, 0)");
 -
 -
 -        UntypedResultSet results = execute("SELECT * FROM 
%s.multiple_clustering_reversed WHERE a=0 AND (b) > (0)");
 -        assertEquals(3, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 1);
 -        checkRow(2, results, 0, 1, 1, 0);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering_reversed 
WHERE a=0 AND (b) >= (0)");
 -        assertEquals(6, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 1);
 -        checkRow(2, results, 0, 1, 1, 0);
 -        checkRow(3, results, 0, 0, 0, 0);
 -        checkRow(4, results, 0, 0, 1, 1);
 -        checkRow(5, results, 0, 0, 1, 0);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering_reversed 
WHERE a=0 AND (b) < (1)");
 -        assertEquals(3, results.size());
 -        checkRow(0, results, 0, 0, 0, 0);
 -        checkRow(1, results, 0, 0, 1, 1);
 -        checkRow(2, results, 0, 0, 1, 0);
 -
 -        results = execute("SELECT * FROM %s.multiple_clustering_reversed 
WHERE a=0 AND (b) <= (1)");
 -        assertEquals(6, results.size());
 -        checkRow(0, results, 0, 1, 0, 0);
 -        checkRow(1, results, 0, 1, 1, 1);
 -        checkRow(2, results, 0, 1, 1, 0);
 -        checkRow(3, results, 0, 0, 0, 0);
 -        checkRow(4, results, 0, 0, 1, 1);
 -        checkRow(5, results, 0, 0, 1, 0);
++        assertInvalid("SELECT * FROM %s WHERE a = ? AND (b, c) in ((?, ?), 
(?, ?)) AND d > ?", 0, 0, 0, 0, 0, 0);
+ 
 -        // preserve pre-6875 behavior (even though the query result is 
technically incorrect)
 -        results = execute("SELECT * FROM %s.multiple_clustering_reversed 
WHERE a=0 AND (b, c) > (1, 0)");
 -        assertEquals(0, results.size());
      }
  
      @Test

Reply via email to