File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1183,9 +1183,10 @@ def lower_sql(self, expression: exp.Lower) -> str:
11831183
11841184 arg = annotate_types (arg , dialect = self .dialect )
11851185
1186- if arg .is_type (exp .DataType .Type .BINARY ):
1186+ if not arg .is_type (exp .DataType .Type .VARCHAR ):
11871187 expression .this .replace (exp .cast (expression .this , exp .DataType .Type .VARCHAR ))
1188- return self .sql (exp .cast (expression , exp .DataType .Type .BINARY ))
1188+ if arg .is_type (exp .DataType .Type .BINARY ):
1189+ return self .sql (exp .cast (expression , exp .DataType .Type .BINARY ))
11891190
11901191 return self .func ("LOWER" , expression .this )
11911192
Original file line number Diff line number Diff line change @@ -847,10 +847,10 @@ def test_bigquery(self):
847847 )
848848
849849 self .validate_all (
850- "LOWER(b' \x41 \x42 \x43 ' )" ,
850+ "LOWER(CAST('HELLO' AS BYTES) )" ,
851851 write = {
852- "bigquery" : "LOWER(b' \x41 \x42 \x43 ' )" ,
853- "duckdb" : "CAST(LOWER(CAST(e' \x41 \x42 \x43 ' AS TEXT)) AS BLOB)" ,
852+ "bigquery" : "LOWER(CAST('HELLO' AS BYTES) )" ,
853+ "duckdb" : "CAST(LOWER(CAST(CAST('HELLO' AS BLOB) AS TEXT)) AS BLOB)" ,
854854 },
855855 )
856856 self .validate_all (
@@ -1747,7 +1747,7 @@ def test_bigquery(self):
17471747 "spark" : "CONTAINS(LOWER(a), LOWER(b))" ,
17481748 "databricks" : "CONTAINS(LOWER(a), LOWER(b))" ,
17491749 "snowflake" : "CONTAINS(LOWER(a), LOWER(b))" ,
1750- "duckdb" : "CONTAINS(LOWER(a) , LOWER(b ))" ,
1750+ "duckdb" : "CONTAINS(LOWER(CAST(a AS TEXT)) , LOWER(CAST(b AS TEXT) ))" ,
17511751 "oracle" : "CONTAINS(LOWER(a), LOWER(b))" ,
17521752 "bigquery" : "CONTAINS_SUBSTR(a, b)" ,
17531753 },
You can’t perform that action at this time.
0 commit comments