assertnode.query("SELECT COUNT(*) FROM compression_codec_multiple_with_key WHERE id % 2 == 0")=="2\n"
assertnode.query("SELECT DISTINCT somecolumn FROM compression_codec_multiple_with_key ORDER BY id")=="777.777\n88.88\n99.99\n"
assertnode.query("SELECT data FROM compression_codec_multiple_with_key WHERE id >= 1112 AND somedate = toDate('2018-10-12') AND somecolumn <= 100")=="hello\nworld\n"
node.query("INSERT INTO compression_codec_multiple_with_key SELECT toDate('2018-10-12'), number, toString(number), 1.0 FROM system.numbers LIMIT 10000")
assertnode.query("SELECT COUNT(id) FROM compression_codec_multiple_with_key WHERE id % 10 == 0")=="1001\n"
assertnode.query("SELECT SUM(somecolumn) FROM compression_codec_multiple_with_key")==str(777.777+88.88+99.99+1.0*10000)+"\n"
assertnode.query("SELECT count(*) FROM compression_codec_multiple_with_key GROUP BY somedate")=="10003\n"
assertnode3.query("SELECT COUNT(*) FROM compression_codec_multiple_with_key WHERE id % 2 == 0")=="2\n"
assertnode3.query("SELECT DISTINCT somecolumn FROM compression_codec_multiple_with_key ORDER BY id")=="777.777\n88.88\n99.99\n"
assertnode3.query("SELECT data FROM compression_codec_multiple_with_key WHERE id >= 1112 AND somedate = toDate('2018-10-12') AND somecolumn <= 100")=="hello\nworld\n"
node3.query("INSERT INTO compression_codec_multiple_with_key VALUES(toDate('2018-10-12'), 100000, '{}', 88.88)".format(''.join(random.choice(string.ascii_uppercase+string.digits)for_inrange(10000))))
assertnode3.query("SELECT max(length(data)) from compression_codec_multiple_with_key GROUP BY data ORDER BY max(length(data)) DESC LIMIT 1")=="10000\n"
foriinxrange(10):
node3.query("INSERT INTO compression_codec_multiple_with_key VALUES(toDate('2018-10-12'), {}, '{}', 88.88)".format(i,''.join(random.choice(string.ascii_uppercase+string.digits)for_inrange(10000))))
node4.query("INSERT INTO compression_codec_multiple_with_key VALUES(toDate('2018-10-12'), 100000, '{}', 88.88)".format(''.join(random.choice(string.ascii_uppercase+string.digits)for_inrange(10000))))
# two equal requests one by one, to get into UncompressedCache for the first block
assertnode4.query("SELECT max(length(data)) from compression_codec_multiple_with_key GROUP BY data ORDER BY max(length(data)) DESC LIMIT 1")=="10000\n"
assertnode4.query("SELECT max(length(data)) from compression_codec_multiple_with_key GROUP BY data ORDER BY max(length(data)) DESC LIMIT 1")=="10000\n"
node5.query("INSERT INTO compression_codec_multiple_with_key VALUES(toDate('2018-10-12'), 100000, '{}', 88.88)".format('a'*10000))
assertnode5.query("SELECT max(length(data)) from compression_codec_multiple_with_key GROUP BY data ORDER BY max(length(data)) DESC LIMIT 1")=="10000\n"