diff --git a/sqlglot/dialects/starrocks.py b/sqlglot/dialects/starrocks.py index 157fdfdea3..f38c4e6d4a 100644 --- a/sqlglot/dialects/starrocks.py +++ b/sqlglot/dialects/starrocks.py @@ -106,6 +106,7 @@ class Generator(MySQL.Generator): exp.TimeStrToDate: rename_func("TO_DATE"), exp.UnixToStr: lambda self, e: self.func("FROM_UNIXTIME", e.this, self.format_time(e)), exp.UnixToTime: rename_func("FROM_UNIXTIME"), + exp.ArrayFilter: rename_func("ARRAY_FILTER"), } TRANSFORMS.pop(exp.DateTrunc) diff --git a/tests/dialects/test_dialect.py b/tests/dialects/test_dialect.py index f0faccb47e..a4e467c184 100644 --- a/tests/dialects/test_dialect.py +++ b/tests/dialects/test_dialect.py @@ -1787,6 +1787,13 @@ def test_operators(self): "spark": "FILTER(the_array, x -> x > 0)", }, ) + self.validate_all( + "FILTER(the_array, x -> x > 0)", + write={ + "presto": "FILTER(the_array, x -> x > 0)", + "starrocks": "ARRAY_FILTER(the_array, x -> x > 0)", + }, + ) self.validate_all( "a / b", write={