This is an automated email from the ASF dual-hosted git repository. smiklosovic pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit 16643c007801faa235a7c3e314bd276962a4e8db Merge: 2e5fb2ea1d 30220bc723 Author: Stefan Miklosovic <[email protected]> AuthorDate: Thu Apr 27 09:08:54 2023 +0200 Merge branch 'cassandra-4.1' into trunk CHANGES.txt | 1 + src/antlr/Lexer.g | 21 ++++++++++-- test/unit/org/apache/cassandra/cql3/CQLTester.java | 14 ++++++-- .../cql3/validation/operations/CreateTest.java | 17 ++++++++++ .../cql3/validation/operations/DropTest.java | 9 +++++ .../cql3/validation/operations/InsertTest.java | 38 ++++++++++++++++++++++ 6 files changed, 96 insertions(+), 4 deletions(-) diff --cc test/unit/org/apache/cassandra/cql3/validation/operations/InsertTest.java index de9c67bd29,4e33ae3461..f6e71ae3a5 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/InsertTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/InsertTest.java @@@ -31,15 -30,43 +32,52 @@@ import org.apache.cassandra.exceptions. public class InsertTest extends CQLTester { + @Test + public void testInsertZeroDuration() throws Throwable + { + Duration expectedDuration = Duration.newInstance(0, 0, 0); + createTable(KEYSPACE, "CREATE TABLE %s (a INT PRIMARY KEY, b DURATION);"); + execute("INSERT INTO %s (a, b) VALUES (1, P0Y)"); + execute("INSERT INTO %s (a, b) VALUES (2, P0M)"); + execute("INSERT INTO %s (a, b) VALUES (3, P0W)"); + execute("INSERT INTO %s (a, b) VALUES (4, P0D)"); + execute("INSERT INTO %s (a, b) VALUES (5, P0Y0M0D)"); + execute("INSERT INTO %s (a, b) VALUES (6, PT0H)"); + execute("INSERT INTO %s (a, b) VALUES (7, PT0M)"); + execute("INSERT INTO %s (a, b) VALUES (8, PT0S)"); + execute("INSERT INTO %s (a, b) VALUES (9, PT0H0M0S)"); + execute("INSERT INTO %s (a, b) VALUES (10, P0YT0H)"); + execute("INSERT INTO %s (a, b) VALUES (11, P0MT0M)"); + execute("INSERT INTO %s (a, b) VALUES (12, P0DT0S)"); + execute("INSERT INTO %s (a, b) VALUES (13, P0M0DT0H0S)"); + execute("INSERT INTO %s (a, b) VALUES (14, P0Y0M0DT0H0M0S)"); + assertRowsIgnoringOrder(execute("SELECT * FROM %s"), + row(1, expectedDuration), + row(2, expectedDuration), + row(3, expectedDuration), + row(4, expectedDuration), + row(5, expectedDuration), + row(6, expectedDuration), + row(7, expectedDuration), + row(8, expectedDuration), + row(9, expectedDuration), + row(10, expectedDuration), + row(11, expectedDuration), + row(12, expectedDuration), + row(13, expectedDuration), + row(14, expectedDuration)); + assertInvalidMessage("no viable alternative at input ')' (... b) VALUES (15, [P]))","INSERT INTO %s (a, b) VALUES (15, P)"); + } + + @Test + public void testEmptyTTL() throws Throwable + { + createTable("CREATE TABLE %s (k int PRIMARY KEY, v int)"); + execute("INSERT INTO %s (k, v) VALUES (0, 0) USING TTL ?", (Object) null); + execute("INSERT INTO %s (k, v) VALUES (1, 1) USING TTL ?", ByteBuffer.wrap(new byte[0])); + assertRows(execute("SELECT k, v, ttl(v) FROM %s"), row(1, 1, null), row(0, 0, null)); + } + @Test public void testInsertWithUnset() throws Throwable { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
