Skip to content

Commit 6a6d450

Browse files
authored
Handling T64, DoubleDelta, Gorilla codec (#83)
1 parent 11f26f8 commit 6a6d450

File tree

4 files changed

+278
-127
lines changed

4 files changed

+278
-127
lines changed

parser/parser_column.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,12 @@ 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)) or CODEC(Delta(9), ZSTD(1))
804+
// parse DELTA if CODEC(Delta, ZSTD(1))
805+
// or CODEC(Delta(9), ZSTD(1)) or CODEC(T64, ZSTD(1))
805806
var codecType *Ident
806807
var typeLevel *NumberLiteral
807-
if strings.ToUpper(name.Name) == "DELTA" {
808+
switch strings.ToUpper(name.Name) {
809+
case "DELTA", "DOUBLEDELTA", "T64", "GORILLA":
808810
codecType = name
809811
// try parse delta level
810812
typeLevel, err = p.tryParseCompressionLevel(p.Pos())
@@ -824,7 +826,7 @@ func (p *Parser) tryParseCompressionCodecs(pos Pos) (*CompressionCodec, error) {
824826
var level *NumberLiteral
825827
// TODO: check if the codec name is valid
826828
switch strings.ToUpper(name.Name) {
827-
case "ZSTD", "LZ4HC":
829+
case "ZSTD", "LZ4HC", "LH4":
828830
level, err = p.tryParseCompressionLevel(p.Pos())
829831
if err != nil {
830832
return nil, err

parser/testdata/ddl/create_table_with_codec_delta.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ CREATE TABLE IF NOT EXISTS test_local
33
`id` UInt64 CODEC(Delta, ZSTD(1)),
44
`api_id` UInt64 CODEC(ZSTD(1)),
55
`app_id` UInt64 CODEC(Delta(9), ZSTD(1)),
6+
`device_id` UInt64 CODEC(DoubleDelta, ZSTD(1)),
7+
`guage` Float64 CODEC(Gorilla, LZ4),
8+
`value` UInt64 CODEC(T64, LZ4),
69
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
710
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
811
)

parser/testdata/ddl/format/create_table_with_codec_delta.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ CREATE TABLE IF NOT EXISTS test_local
44
`id` UInt64 CODEC(Delta, ZSTD(1)),
55
`api_id` UInt64 CODEC(ZSTD(1)),
66
`app_id` UInt64 CODEC(Delta(9), ZSTD(1)),
7+
`device_id` UInt64 CODEC(DoubleDelta, ZSTD(1)),
8+
`guage` Float64 CODEC(Gorilla, LZ4),
9+
`value` UInt64 CODEC(T64, LZ4),
710
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
811
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
912
)
@@ -20,6 +23,9 @@ CREATE TABLE IF NOT EXISTS test_local
2023
`id` UInt64 CODEC(Delta, ZSTD(1)),
2124
`api_id` UInt64 CODEC(ZSTD(1)),
2225
`app_id` UInt64 CODEC(Delta(9), ZSTD(1)),
26+
`device_id` UInt64 CODEC(DoubleDelta, ZSTD(1)),
27+
`guage` Float64 CODEC(Gorilla, LZ4),
28+
`value` UInt64 CODEC(T64, LZ4),
2329
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
2430
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
2531
)

0 commit comments

Comments
 (0)