mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-01 21:55:50 +00:00
This patch adds several more tests reproducing bugs in toJson() and SELECT JSON. First add two xfailing tests reproducing two toJson() issues - #7988 and #8002. The first is that toJson() incorrectly formats values of the "time" type - it should be a string but Scylla forgets the quotes. The second is that toJson() format "decimal" values as JSON numbers without using an exponent, resulting in memory allocation failure for numbers with high exponents, like 1e1000000000. The actual test for 1e1000000000 has to be skipped because in debug build mode we get a crash trying this huge allocation. So instead, we check 1e1000 - this generates a string of 1000 characters, which is much too much (should just be "1e1000") but doesn't crash. Then we add a reproducing test for issue #8077: When using SELECT JSON on a function, such as count(*), ttl(v) or intAsBlob(v), Cassandra has a specific way how it formats the result in JSON, and Scylla should do it the same way unless we have a good reason not to. As usual, the new tests passes on Cassandra, fails on Scylla, so is marked xfail. Refs #7988 Refs #8002 Refs #8077. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20210214210727.1098388-1-nyh@scylladb.com>