From 3ea81804667b4005749503d704685bc36dc98ab9 Mon Sep 17 00:00:00 2001 From: LoySheng Date: Sat, 10 May 2025 16:22:56 +0800 Subject: [PATCH 1/2] feat: added support for current_timestamp --- sqlglot/dialects/druid.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sqlglot/dialects/druid.py b/sqlglot/dialects/druid.py index e2a67a283d..5baa29cc96 100644 --- a/sqlglot/dialects/druid.py +++ b/sqlglot/dialects/druid.py @@ -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" \ No newline at end of file From 1eef19e51f58a969f14448ab18dbcbc06f67768b Mon Sep 17 00:00:00 2001 From: LoySheng Date: Sat, 10 May 2025 16:23:07 +0800 Subject: [PATCH 2/2] test: Added tests for current_timestamp --- tests/dialects/test_druid.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/dialects/test_druid.py b/tests/dialects/test_druid.py index a64462d2d6..c79b00721e 100644 --- a/tests/dialects/test_druid.py +++ b/tests/dialects/test_druid.py @@ -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(