Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions sqlglot/dialects/druid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ class Generator(generator.Generator):
exp.DataType.Type.TEXT: "STRING",
exp.DataType.Type.UUID: "STRING",
}

def currenttimestamp_sql(self, expression: exp.CurrentTimestamp) -> str:
this = expression.this
return self.func("CURRENT_TIMESTAMP", this) if this else "CURRENT_TIMESTAMP"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want a function right? You can only use it without parentheses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, it worked for my usecase but i see the way you've done it in your commit. Thanks !

3 changes: 2 additions & 1 deletion tests/dialects/test_druid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def test_druid(self):
self.validate_identity("SELECT FLOOR(__time TO WEEK) FROM t")
self.validate_identity("SELECT FLOOR(col) FROM t")
self.validate_identity("SELECT FLOOR(price, 2) AS rounded_price FROM t")

self.validate_identity("SELECT CURRENT_TIMESTAMP")

# validate across all dialects
write = {dialect.value: "FLOOR(__time TO WEEK)" for dialect in Dialects}
self.validate_all(
Expand Down
Loading