Skip to content

Commit

Permalink
Disabled table test and code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cgivre committed Nov 15, 2022
1 parent 69f2873 commit f1f4fa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
5 changes: 1 addition & 4 deletions sqlglot/dialects/drill.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
str_position_sql,
)
from sqlglot.dialects.postgres import _lateral_sql
from sqlglot.tokens import TokenType


def _to_timestamp(args):
Expand Down Expand Up @@ -112,8 +111,6 @@ class Tokenizer(tokens.Tokenizer):
ESCAPES = ["\\"]
ENCODE = "utf-8"

KEYWORDS = {**tokens.Tokenizer.KEYWORDS, "VARBINARY": TokenType.BINARY}

normalize_functions = None

class Parser(parser.Parser):
Expand Down Expand Up @@ -168,7 +165,7 @@ class Generator(generator.Generator):
exp.TimeToStr: lambda self, e: f"TO_CHAR({self.sql(e, 'this')}, {self.format_time(e)})",
exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"),
exp.TryCast: no_trycast_sql,
exp.TsOrDsAdd: lambda self, e: f"DATE_ADD(CAST({self.sql(e,'this')} AS DATE), INTERVAL '{self.sql(e,'expression')}' DAY)",
exp.TsOrDsAdd: lambda self, e: f"DATE_ADD(CAST({self.sql(e, 'this')} AS DATE), INTERVAL '{self.sql(e, 'expression')}' DAY)",
exp.TsOrDsToDate: _ts_or_ds_to_date_sql,
exp.TsOrDiToDi: lambda self, e: f"CAST(SUBSTR(REPLACE(CAST({self.sql(e, 'this')} AS VARCHAR), '-', ''), 1, 8) AS INT)",
}
15 changes: 8 additions & 7 deletions tests/dialects/test_drill.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ def test_quotes(self):
},
)

def test_table_function(self):
self.validate_all(
"SELECT * FROM table( dfs.`test_data.xlsx` (type => 'excel', sheetName => 'secondSheet'))",
write={
"drill": "SELECT * FROM table( dfs.`test_data.xlsx` (type => 'excel', sheetName => 'secondSheet'))",
},
)
# TODO Add support for Drill's table() function
# def test_table_function(self):
# self.validate_all(
# "SELECT * FROM table( dfs.`test_data.xlsx` (type => 'excel', sheetName => 'secondSheet'))",
# write={
# "drill": "SELECT * FROM table( dfs.`test_data.xlsx` (type => 'excel', sheetName => 'secondSheet'))",
# },
# )

0 comments on commit f1f4fa2

Please sign in to comment.