adelapena commented on code in PR #1739:
URL: https://github.com/apache/cassandra/pull/1739#discussion_r943985744
##########
test/unit/org/apache/cassandra/cql3/validation/entities/WritetimeOrTTLTest.java:
##########
@@ -1050,6 +1052,47 @@ public void testFrozenNestedUDTs() throws Throwable
assertWritetimeAndTTL("t.f2.f2", "k=12", TIMESTAMP_1, TTL_1);
}
+ @Test
+ public void testFunctions() throws Throwable
+ {
+ createTable("CREATE TABLE %s (k int PRIMARY KEY, v int, s set<int>, fs
frozen<set<int>>)");
+ execute("INSERT INTO %s (k, v, s, fs) VALUES (0, 0, {1, 2, 3}, {1, 2,
3}) USING TIMESTAMP 1 AND TTL 1000");
+ execute("INSERT INTO %s (k, v, s, fs) VALUES (1, 1, {10, 20, 30}, {10,
20, 30}) USING TIMESTAMP 10 AND TTL 1000");
+ execute("UPDATE %s USING TIMESTAMP 2 AND TTL 2000 SET s = s + {2, 3}
WHERE k = 0");
+ execute("UPDATE %s USING TIMESTAMP 20 AND TTL 2000 SET s = s + {20,
30} WHERE k = 1");
+
+ // Regular column
+ assertRows("SELECT min(v) FROM %s", row(0));
+ assertRows("SELECT max(v) FROM %s", row(1));
+ assertRows("SELECT writetime(v) FROM %s", row(10L), row(1L));
+ assertRows("SELECT min(writetime(v)) FROM %s", row(1L));
+ assertRows("SELECT max(writetime(v)) FROM %s", row(10L));
+ assertRows("SELECT min(maxwritetime(v)) FROM %s", row(1L));
+ assertRows("SELECT max(maxwritetime(v)) FROM %s", row(10L));
Review Comment:
This is indeed confusing. The `max` function is not what perhaps we would
like in this context, but an aggregation function that selects the row with the
maximum column value. If it's applied to a collection column it doesn't select
the max item within the collection, but the max collection among the selected
rows. There is some followup on this in CASSANDRA-17811.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]