-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cubesql): Support to_char UDF (#4600)
- Loading branch information
1 parent
005eaa9
commit 48077a9
Showing
5 changed files
with
171 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...ubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__metabase_to_char_query.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: cubesql/src/compile/mod.rs | ||
expression: "execute_query(\"select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.MS TZ')\".to_string(),\n DatabaseProtocol::PostgreSQL).await?" | ||
--- | ||
+-------------------------------------------------------------+ | ||
| to_char(utctimestamp(),Utf8("YYYY-MM-DD HH24:MI:SS.MS TZ")) | | ||
+-------------------------------------------------------------+ | ||
| 2022-05-26 11:18:59.122 | | ||
+-------------------------------------------------------------+ |
9 changes: 9 additions & 0 deletions
9
rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__to_char_1.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: cubesql/src/compile/mod.rs | ||
expression: "execute_query(\"SELECT to_char(x, 'YYYY-MM-DD HH24:MI:SS.MS TZ') FROM (SELECT Str_to_date('2021-08-31 11:05:10.400000', '%Y-%m-%d %H:%i:%s.%f') x) e\".to_string(),\n DatabaseProtocol::PostgreSQL).await?" | ||
--- | ||
+--------------------------------------------------+ | ||
| to_char(e.x,Utf8("YYYY-MM-DD HH24:MI:SS.MS TZ")) | | ||
+--------------------------------------------------+ | ||
| 2021-08-31 11:05:10.400 | | ||
+--------------------------------------------------+ |
10 changes: 10 additions & 0 deletions
10
rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__to_char_2.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
source: cubesql/src/compile/mod.rs | ||
expression: "execute_query(\"\n SELECT to_char(x, 'YYYY-MM-DD HH24:MI:SS.MS TZ') \n FROM (\n SELECT Str_to_date('2021-08-31 11:05:10.400000', '%Y-%m-%d %H:%i:%s.%f') x \n UNION ALL \n SELECT str_to_date('2021-08-31 11:05', '%Y-%m-%d %H:%i') x\n ) e\n \".to_string(),\n DatabaseProtocol::PostgreSQL).await?" | ||
--- | ||
+--------------------------------------------------+ | ||
| to_char(e.x,Utf8("YYYY-MM-DD HH24:MI:SS.MS TZ")) | | ||
+--------------------------------------------------+ | ||
| 2021-08-31 11:05:10.400 | | ||
| 2021-08-31 11:05:00.000 | | ||
+--------------------------------------------------+ |