Skip to content

Commit

Permalink
feat(starrocks): add largeint
Browse files Browse the repository at this point in the history
  • Loading branch information
pickfire committed Dec 12, 2024
1 parent 5a24d91 commit 1f1a0a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sqlglot/dialects/starrocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class StarRocks(MySQL):
class Tokenizer(MySQL.Tokenizer):
KEYWORDS = {
**MySQL.Tokenizer.KEYWORDS,
"LARGEINT": TokenType.INT128,
"PARTITION BY RANGE": TokenType.PARTITION_BY_RANGE,
}

Expand Down Expand Up @@ -115,6 +116,7 @@ class Generator(MySQL.Generator):

TYPE_MAPPING = {
**MySQL.Generator.TYPE_MAPPING,
exp.DataType.Type.INT128: "LARGEINT",
exp.DataType.Type.TEXT: "STRING",
exp.DataType.Type.TIMESTAMP: "DATETIME",
exp.DataType.Type.TIMESTAMPTZ: "DATETIME",
Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_starrocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_ddl(self):
self.validate_identity(
"CREATE TABLE foo (col0 DECIMAL(9, 1), col1 DECIMAL32(9, 1), col2 DECIMAL64(18, 10), col3 DECIMAL128(38, 10)) DISTRIBUTED BY HASH (col1) BUCKETS 1"
)
self.validate_identity("CREATE TABLE foo (col1 LARGEINT) DISTRIBUTED BY HASH (col1) BUCKETS 1")

def test_identity(self):
self.validate_identity("SELECT CAST(`a`.`b` AS INT) FROM foo")
Expand Down

0 comments on commit 1f1a0a3

Please sign in to comment.