mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
More tests for parser
This commit is contained in:
parent
cc229ac9cc
commit
8a95eb9dc1
@ -1,5 +1,6 @@
|
||||
#include <Compression/CompressionCodecZSTD.h>
|
||||
#include <IO/CompressedStream.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
#include <Compression/CompressionFactory.h>
|
||||
#include <zstd.h>
|
||||
#include <Core/Field.h>
|
||||
@ -15,6 +16,7 @@ namespace ErrorCodes
|
||||
{
|
||||
extern const int CANNOT_COMPRESS;
|
||||
extern const int CANNOT_DECOMPRESS;
|
||||
extern const int ILLEGAL_SYNTAX_FOR_CODEC_TYPE;
|
||||
}
|
||||
|
||||
char CompressionCodecZSTD::getMethodByte()
|
||||
@ -66,6 +68,9 @@ void registerCodecZSTD(CompressionCodecFactory & factory)
|
||||
int level = 0;
|
||||
if (arguments && !arguments->children.empty())
|
||||
{
|
||||
if (arguments->children.size() != 1)
|
||||
throw Exception("ZSTD codec must have 1 parameter, given " + std::to_string(arguments->children.size()), ErrorCodes::ILLEGAL_SYNTAX_FOR_CODEC_TYPE);
|
||||
|
||||
const auto children = arguments->children;
|
||||
const ASTLiteral * literal = static_cast<const ASTLiteral *>(children[0].get());
|
||||
level = literal->value.safeGet<UInt64>();
|
||||
|
@ -1,3 +1,4 @@
|
||||
1 hello
|
||||
2 world
|
||||
3 !
|
||||
1 hello 2018-12-14 1.1
|
||||
2 world 2018-12-15 2.2
|
||||
3 ! 2018-12-16 3.3
|
||||
2
|
||||
|
@ -1,11 +1,30 @@
|
||||
SET send_logs_level = 'none';
|
||||
DROP TABLE IF EXISTS test.compression_codec;
|
||||
|
||||
CREATE TABLE test.compression_codec(id UInt64 CODEC(LZ4), data String CODEC(ZSTD)) ENGINE = MergeTree() order by tuple();
|
||||
CREATE TABLE test.compression_codec(id UInt64 CODEC(LZ4), data String CODEC(ZSTD), ddd Date CODEC(NONE), somenum Float64 CODEC(ZSTD(2))) ENGINE = MergeTree() ORDER BY tuple();
|
||||
|
||||
INSERT INTO test.compression_codec VALUES(1, 'hello');
|
||||
INSERT INTO test.compression_codec VALUES(2, 'world');
|
||||
INSERT INTO test.compression_codec VALUES(3, '!');
|
||||
INSERT INTO test.compression_codec VALUES(1, 'hello', toDate('2018-12-14'), 1.1);
|
||||
INSERT INTO test.compression_codec VALUES(2, 'world', toDate('2018-12-15'), 2.2);
|
||||
INSERT INTO test.compression_codec VALUES(3, '!', toDate('2018-12-16'), 3.3);
|
||||
|
||||
SELECT * FROM test.compression_codec order by id;
|
||||
SELECT * FROM test.compression_codec ORDER BY id;
|
||||
|
||||
OPTIMIZE TABLE test.compression_codec FINAL;
|
||||
|
||||
INSERT INTO test.compression_codec VALUES(2, '', toDate('2018-12-13'), 4.4);
|
||||
|
||||
SELECT count(*) FROM test.compression_codec WHERE id = 2 GROUP BY id;
|
||||
|
||||
DROP TABLE IF EXISTS test.compression_codec;
|
||||
|
||||
DROP TABLE IF EXISTS test.bad_codec;
|
||||
DROP TABLE IF EXISTS test.params_when_no_params;
|
||||
DROP TABLE IF EXISTS test.too_many_params;
|
||||
|
||||
CREATE TABLE test.bad_codec(id UInt64 CODEC(adssadads)) ENGINE = MergeTree() order by tuple(); -- { serverError 429 }
|
||||
CREATE TABLE test.too_many_params(id UInt64 CODEC(ZSTD(2,3,4,5))) ENGINE = MergeTree() order by tuple(); -- { serverError 428 }
|
||||
CREATE TABLE test.params_when_no_params(id UInt64 CODEC(LZ4(1))) ENGINE = MergeTree() ORDER BY tuple(); -- { serverError 378 }
|
||||
|
||||
DROP TABLE IF EXISTS test.bad_codec;
|
||||
DROP TABLE IF EXISTS test.params_when_no_params;
|
||||
DROP TABLE IF EXISTS test.too_many_params;
|
||||
|
Loading…
Reference in New Issue
Block a user