Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling T64, DoubleDelta, Gorilla codec #83

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions parser/parser_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -801,10 +801,12 @@ func (p *Parser) tryParseCompressionCodecs(pos Pos) (*CompressionCodec, error) {
if err != nil {
return nil, err
}
// parse DELTA if CODEC(Delta, ZSTD(1)) or CODEC(Delta(9), ZSTD(1))
// parse DELTA if CODEC(Delta, ZSTD(1))
// or CODEC(Delta(9), ZSTD(1)) or CODEC(T64, ZSTD(1))
var codecType *Ident
var typeLevel *NumberLiteral
if strings.ToUpper(name.Name) == "DELTA" {
switch strings.ToUpper(name.Name) {
case "DELTA", "DOUBLEDELTA", "T64", "GORILLA":
codecType = name
// try parse delta level
typeLevel, err = p.tryParseCompressionLevel(p.Pos())
Expand All @@ -824,7 +826,7 @@ func (p *Parser) tryParseCompressionCodecs(pos Pos) (*CompressionCodec, error) {
var level *NumberLiteral
// TODO: check if the codec name is valid
switch strings.ToUpper(name.Name) {
case "ZSTD", "LZ4HC":
case "ZSTD", "LZ4HC", "LH4":
level, err = p.tryParseCompressionLevel(p.Pos())
if err != nil {
return nil, err
Expand Down
3 changes: 3 additions & 0 deletions parser/testdata/ddl/create_table_with_codec_delta.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ CREATE TABLE IF NOT EXISTS test_local
`id` UInt64 CODEC(Delta, ZSTD(1)),
`api_id` UInt64 CODEC(ZSTD(1)),
`app_id` UInt64 CODEC(Delta(9), ZSTD(1)),
`device_id` UInt64 CODEC(DoubleDelta, ZSTD(1)),
`guage` Float64 CODEC(Gorilla, LZ4),
`value` UInt64 CODEC(T64, LZ4),
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
)
Expand Down
6 changes: 6 additions & 0 deletions parser/testdata/ddl/format/create_table_with_codec_delta.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ CREATE TABLE IF NOT EXISTS test_local
`id` UInt64 CODEC(Delta, ZSTD(1)),
`api_id` UInt64 CODEC(ZSTD(1)),
`app_id` UInt64 CODEC(Delta(9), ZSTD(1)),
`device_id` UInt64 CODEC(DoubleDelta, ZSTD(1)),
`guage` Float64 CODEC(Gorilla, LZ4),
`value` UInt64 CODEC(T64, LZ4),
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
)
Expand All @@ -20,6 +23,9 @@ CREATE TABLE IF NOT EXISTS test_local
`id` UInt64 CODEC(Delta, ZSTD(1)),
`api_id` UInt64 CODEC(ZSTD(1)),
`app_id` UInt64 CODEC(Delta(9), ZSTD(1)),
`device_id` UInt64 CODEC(DoubleDelta, ZSTD(1)),
`guage` Float64 CODEC(Gorilla, LZ4),
`value` UInt64 CODEC(T64, LZ4),
`timestamp` DateTime64(9) CODEC(ZSTD(1)),
INDEX timestamp_index(timestamp) TYPE minmax GRANULARITY 4
)
Expand Down
Loading
Loading