Skip to content

Commit f770c15

Browse files
authored
Handling Delta with number literal (#78)
1 parent 5c4ca69 commit f770c15

File tree

4 files changed

+182
-125
lines changed

4 files changed

+182
-125
lines changed

parser/parser_column.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,15 @@ func (p *Parser) tryParseCompressionCodecs(pos Pos) (*CompressionCodec, error) {
801801
if err != nil {
802802
return nil, err
803803
}
804-
// parse DELTA if CODEC(Delta, ZSTD(1))
804+
// parse DELTA if CODEC(Delta, ZSTD(1)) or CODEC(Delta(9), ZSTD(1))
805805
var codecType *Ident
806806
if strings.ToUpper(name.Name) == "DELTA" {
807807
codecType = name
808+
// try parse delta level
809+
if _, err := p.tryParseCompressionLevel(p.Pos()); err != nil {
810+
return nil, err
811+
}
812+
// consume comma
808813
if _, err := p.consumeTokenKind(","); err != nil {
809814
return nil, err
810815
}

parser/testdata/ddl/create_table_with_codec_delta.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ CREATE TABLE IF NOT EXISTS test_local
22
(
33
`id` UInt64 CODEC(Delta, ZSTD(1)),
44
`api_id` UInt64 CODEC(ZSTD(1)),
5+
`app_id` UInt64 CODEC(Delta(9), ZSTD(1)),
56
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
67
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
78
)

parser/testdata/ddl/format/create_table_with_codec_delta.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS test_local
33
(
44
`id` UInt64 CODEC(Delta, ZSTD(1)),
55
`api_id` UInt64 CODEC(ZSTD(1)),
6+
`app_id` UInt64 CODEC(Delta(9), ZSTD(1)),
67
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
78
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
89
)
@@ -18,6 +19,7 @@ CREATE TABLE IF NOT EXISTS test_local
1819
(
1920
`id` UInt64 CODEC(Delta, ZSTD(1)),
2021
`api_id` UInt64 CODEC(ZSTD(1)),
22+
`app_id` UInt64 CODEC(Delta, ZSTD(1)),
2123
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
2224
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
2325
)

0 commit comments

Comments
 (0)