Repository: tobymao/sqlglot

Issue:
DOW and DOY Trino functions are not properly parsed and translated to Snowflake
**Fully reproducible code snippet**
```
>>> sqlglot.parse_one('SELECT DOW("orders.date")', dialect="trino").sql(dialect="snowflake")
'SELECT DOW("orders.date")'
>>> sqlglot.parse_one('SELECT DOY("orders.date")', dialect="trino").sql(dialect="snowflake")
'SELECT DOY("orders.date")'
```

They should be aliases to DAY_OF_WEEK and DAY_OF_YEAR:
https://trino.io/docs/current/functions/datetime.html#week_of_year

**Official Documentation**
https://trino.io/docs/current/functions/datetime.html#week_of_year
https://docs.snowflake.com/en/sql-reference/functions/year

Hints from issue comments:

Solution patch:
diff --git a/sqlglot/dialects/presto.py b/sqlglot/dialects/presto.py
index 028650c0e8..3e3e0ab3eb 100644
--- a/sqlglot/dialects/presto.py
+++ b/sqlglot/dialects/presto.py
@@ -330,6 +330,8 @@ class Parser(parser.Parser):
             "DATE_PARSE": build_formatted_time(exp.StrToTime, "presto"),
             "DATE_TRUNC": date_trunc_to_time,
             "DAY_OF_WEEK": exp.DayOfWeekIso.from_arg_list,
+            "DOW": exp.DayOfWeekIso.from_arg_list,
+            "DOY": exp.DayOfYear.from_arg_list,
             "ELEMENT_AT": lambda args: exp.Bracket(
                 this=seq_get(args, 0), expressions=[seq_get(args, 1)], offset=1, safe=True
             ),


Test patch:
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
index 05ac13417f..1369bc1fdf 100644
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -1025,6 +1025,7 @@ def test_snowflake(self):
         self.validate_all(
             "DAYOFWEEKISO(foo)",
             read={
+                "presto": "DAY_OF_WEEK(foo)",
                 "trino": "DAY_OF_WEEK(foo)",
             },
             write={
@@ -1032,6 +1033,28 @@ def test_snowflake(self):
             },
         )
 
+        self.validate_all(
+            "DAYOFWEEKISO(foo)",
+            read={
+                "presto": "DOW(foo)",
+                "trino": "DOW(foo)",
+            },
+            write={
+                "snowflake": "DAYOFWEEKISO(foo)",
+            },
+        )
+
+        self.validate_all(
+            "DAYOFYEAR(foo)",
+            read={
+                "presto": "DOY(foo)",
+                "trino": "DOY(foo)",
+            },
+            write={
+                "snowflake": "DAYOFYEAR(foo)",
+            },
+        )
+
     def test_null_treatment(self):
         self.validate_all(
             r"SELECT FIRST_VALUE(TABLE1.COLUMN1) OVER (PARTITION BY RANDOM_COLUMN1, RANDOM_COLUMN2 ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS MY_ALIAS FROM TABLE1",