mirror of https://github.com/apache/cassandra
Fix SimpleDateType type compatibility
patch by Benjamin Lerer; reviewed by Joshua McKenzie for CASSANDRA-10027
This commit is contained in:
parent
84d4488537
commit
b05fe4ffee
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class SimpleDateType extends AbstractType<Integer>
|
|||
@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
|
||||
|
|
|
|||
|
|
@ -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;");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue