Skip to content

Commit

Permalink
snowflake - alt cast (antlr#3929)
Browse files Browse the repository at this point in the history
* snowflake - alt cast

* no python target
  • Loading branch information
mlorek authored Jan 23, 2024
1 parent c71f07b commit 85de28c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions sql/snowflake/SnowflakeParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -3701,6 +3701,7 @@ try_cast_expr

cast_expr
: CAST LR_BRACKET expr AS data_type RR_BRACKET
| (TIMESTAMP | DATE | TIME) expr
;

json_literal
Expand Down
5 changes: 3 additions & 2 deletions sql/snowflake/desc.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<desc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../_scripts/desc.xsd">
<antlr-version>^4.10</antlr-version>
<targets>CSharp;Cpp;Dart;Java;JavaScript;Python3</targets>
<antlr-version>^4.10</antlr-version>
<targets>CSharp;Cpp;Dart;Java;JavaScript</targets>
<!--CSharp;Cpp;Dart;Go;Java;JavaScript;PHP;Python3;TypeScript-->
</desc>
9 changes: 9 additions & 0 deletions sql/snowflake/examples/alt_cast.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
with t as (
select current_time() as ct, current_date() as cd, current_timestamp() as cts
)
select *
from t
where
ct > TIME '0:0:0' or
cd > DATE '2024-01-01' or
cts > TIMESTAMP '2024-01-01 0:0:0';

0 comments on commit 85de28c

Please sign in to comment.