cassandra git commit: Fix SimpleDateType type compatibility
Repository: cassandra Updated Branches: refs/heads/cassandra-2.2 84d448853 -> b05fe4ffe Fix SimpleDateType type compatibility patch by Benjamin Lerer; reviewed by Joshua McKenzie for CASSANDRA-10027 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b05fe4ff Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b05fe4ff Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b05fe4ff Branch: refs/heads/cassandra-2.2 Commit: b05fe4ffee8f1c457a79013c2ddc88abcdadc6bb Parents: 84d4488 Author: blererAuthored: Thu Nov 12 20:53:42 2015 +0100 Committer: blerer Committed: Thu Nov 12 20:53:42 2015 +0100 -- CHANGES.txt| 1 + .../cassandra/db/marshal/SimpleDateType.java | 2 +- .../cql3/validation/operations/AlterTest.java | 17 + 3 files changed, 19 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/CHANGES.txt -- diff --git a/CHANGES.txt b/CHANGES.txt index 9c834f3..5705453 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.2.4 + * Fix SimpleDateType type compatibility (CASSANDRA-10027) * (Hadoop) fix splits calculation (CASSANDRA-10640) * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java -- diff --git a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java index 747709e..6e435ee 100644 --- a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java +++ b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java @@ -69,7 +69,7 @@ public class SimpleDateType extends AbstractType @Override public boolean isValueCompatibleWithInternal(AbstractType otherType) { -return this == otherType || otherType == IntegerType.instance; +return this == otherType || otherType == Int32Type.instance; } public Term fromJSONObject(Object parsed) throws MarshalException http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java -- diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java index 95380f4..566c0ea 100644 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java @@ -200,4 +200,21 @@ public class AlterTest extends CQLTester assertInvalidSyntaxMessage("no viable alternative at input 'WITH'", stmt); } } + +/** + * tests CASSANDRA-10027 + */ +@Test +public void testAlterColumnTypeToDate() throws Throwable +{ +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 int);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +execute("ALTER TABLE %s ALTER c1 TYPE date;"); +assertRows(execute("SELECT * FROM %s"), row(1, 1)); + +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 varint);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +assertInvalidMessage("Cannot change c1 from type varint to type date: types are incompatible.", + "ALTER TABLE %s ALTER c1 TYPE date;"); +} }
[1/3] cassandra git commit: Fix SimpleDateType type compatibility
Repository: cassandra Updated Branches: refs/heads/cassandra-3.1 e11bd0fa8 -> 6688911f4 Fix SimpleDateType type compatibility patch by Benjamin Lerer; reviewed by Joshua McKenzie for CASSANDRA-10027 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b05fe4ff Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b05fe4ff Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b05fe4ff Branch: refs/heads/cassandra-3.1 Commit: b05fe4ffee8f1c457a79013c2ddc88abcdadc6bb Parents: 84d4488 Author: blererAuthored: Thu Nov 12 20:53:42 2015 +0100 Committer: blerer Committed: Thu Nov 12 20:53:42 2015 +0100 -- CHANGES.txt| 1 + .../cassandra/db/marshal/SimpleDateType.java | 2 +- .../cql3/validation/operations/AlterTest.java | 17 + 3 files changed, 19 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/CHANGES.txt -- diff --git a/CHANGES.txt b/CHANGES.txt index 9c834f3..5705453 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.2.4 + * Fix SimpleDateType type compatibility (CASSANDRA-10027) * (Hadoop) fix splits calculation (CASSANDRA-10640) * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java -- diff --git a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java index 747709e..6e435ee 100644 --- a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java +++ b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java @@ -69,7 +69,7 @@ public class SimpleDateType extends AbstractType @Override public boolean isValueCompatibleWithInternal(AbstractType otherType) { -return this == otherType || otherType == IntegerType.instance; +return this == otherType || otherType == Int32Type.instance; } public Term fromJSONObject(Object parsed) throws MarshalException http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java -- diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java index 95380f4..566c0ea 100644 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java @@ -200,4 +200,21 @@ public class AlterTest extends CQLTester assertInvalidSyntaxMessage("no viable alternative at input 'WITH'", stmt); } } + +/** + * tests CASSANDRA-10027 + */ +@Test +public void testAlterColumnTypeToDate() throws Throwable +{ +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 int);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +execute("ALTER TABLE %s ALTER c1 TYPE date;"); +assertRows(execute("SELECT * FROM %s"), row(1, 1)); + +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 varint);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +assertInvalidMessage("Cannot change c1 from type varint to type date: types are incompatible.", + "ALTER TABLE %s ALTER c1 TYPE date;"); +} }
[1/2] cassandra git commit: Fix SimpleDateType type compatibility
Repository: cassandra Updated Branches: refs/heads/cassandra-3.0 9f056a917 -> 464f8f076 Fix SimpleDateType type compatibility patch by Benjamin Lerer; reviewed by Joshua McKenzie for CASSANDRA-10027 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b05fe4ff Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b05fe4ff Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b05fe4ff Branch: refs/heads/cassandra-3.0 Commit: b05fe4ffee8f1c457a79013c2ddc88abcdadc6bb Parents: 84d4488 Author: blererAuthored: Thu Nov 12 20:53:42 2015 +0100 Committer: blerer Committed: Thu Nov 12 20:53:42 2015 +0100 -- CHANGES.txt| 1 + .../cassandra/db/marshal/SimpleDateType.java | 2 +- .../cql3/validation/operations/AlterTest.java | 17 + 3 files changed, 19 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/CHANGES.txt -- diff --git a/CHANGES.txt b/CHANGES.txt index 9c834f3..5705453 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.2.4 + * Fix SimpleDateType type compatibility (CASSANDRA-10027) * (Hadoop) fix splits calculation (CASSANDRA-10640) * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java -- diff --git a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java index 747709e..6e435ee 100644 --- a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java +++ b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java @@ -69,7 +69,7 @@ public class SimpleDateType extends AbstractType @Override public boolean isValueCompatibleWithInternal(AbstractType otherType) { -return this == otherType || otherType == IntegerType.instance; +return this == otherType || otherType == Int32Type.instance; } public Term fromJSONObject(Object parsed) throws MarshalException http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java -- diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java index 95380f4..566c0ea 100644 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java @@ -200,4 +200,21 @@ public class AlterTest extends CQLTester assertInvalidSyntaxMessage("no viable alternative at input 'WITH'", stmt); } } + +/** + * tests CASSANDRA-10027 + */ +@Test +public void testAlterColumnTypeToDate() throws Throwable +{ +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 int);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +execute("ALTER TABLE %s ALTER c1 TYPE date;"); +assertRows(execute("SELECT * FROM %s"), row(1, 1)); + +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 varint);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +assertInvalidMessage("Cannot change c1 from type varint to type date: types are incompatible.", + "ALTER TABLE %s ALTER c1 TYPE date;"); +} }
[1/4] cassandra git commit: Fix SimpleDateType type compatibility
Repository: cassandra Updated Branches: refs/heads/trunk 7fcf14faa -> 0781bccc9 Fix SimpleDateType type compatibility patch by Benjamin Lerer; reviewed by Joshua McKenzie for CASSANDRA-10027 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b05fe4ff Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b05fe4ff Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b05fe4ff Branch: refs/heads/trunk Commit: b05fe4ffee8f1c457a79013c2ddc88abcdadc6bb Parents: 84d4488 Author: blererAuthored: Thu Nov 12 20:53:42 2015 +0100 Committer: blerer Committed: Thu Nov 12 20:53:42 2015 +0100 -- CHANGES.txt| 1 + .../cassandra/db/marshal/SimpleDateType.java | 2 +- .../cql3/validation/operations/AlterTest.java | 17 + 3 files changed, 19 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/CHANGES.txt -- diff --git a/CHANGES.txt b/CHANGES.txt index 9c834f3..5705453 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.2.4 + * Fix SimpleDateType type compatibility (CASSANDRA-10027) * (Hadoop) fix splits calculation (CASSANDRA-10640) * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java -- diff --git a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java index 747709e..6e435ee 100644 --- a/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java +++ b/src/java/org/apache/cassandra/db/marshal/SimpleDateType.java @@ -69,7 +69,7 @@ public class SimpleDateType extends AbstractType @Override public boolean isValueCompatibleWithInternal(AbstractType otherType) { -return this == otherType || otherType == IntegerType.instance; +return this == otherType || otherType == Int32Type.instance; } public Term fromJSONObject(Object parsed) throws MarshalException http://git-wip-us.apache.org/repos/asf/cassandra/blob/b05fe4ff/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java -- diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java index 95380f4..566c0ea 100644 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java @@ -200,4 +200,21 @@ public class AlterTest extends CQLTester assertInvalidSyntaxMessage("no viable alternative at input 'WITH'", stmt); } } + +/** + * tests CASSANDRA-10027 + */ +@Test +public void testAlterColumnTypeToDate() throws Throwable +{ +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 int);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +execute("ALTER TABLE %s ALTER c1 TYPE date;"); +assertRows(execute("SELECT * FROM %s"), row(1, 1)); + +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 varint);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +assertInvalidMessage("Cannot change c1 from type varint to type date: types are incompatible.", + "ALTER TABLE %s ALTER c1 TYPE date;"); +} }