Repository: tobymao/sqlglot

Issue:
Spark to DuckDB 'datediff' transpilation error
Possibly related to #1929 

Getting an issue transpiling from Spark to DuckDB, the 'datediff' function is transpiling correctly to "date_diff" but the period parameter is being returned as "None" instead of "Day".

Source sql:
![image](https://github.com/tobymao/sqlglot/assets/136445689/329dbe3d-8e7b-452e-9557-35747a054075)

Expected:
![image](https://github.com/tobymao/sqlglot/assets/136445689/c8ee6801-18fc-425e-9666-57b2ce577a4f)

Actual:
![image](https://github.com/tobymao/sqlglot/assets/136445689/a730cfd3-bf57-44cf-b977-b545df53de79)

Can you take a look please.

Discussion:

Patch:
diff --git a/sqlglot/dialects/duckdb.py b/sqlglot/dialects/duckdb.py
index 03edaa3b..219b1aa8 100644
--- a/sqlglot/dialects/duckdb.py
+++ b/sqlglot/dialects/duckdb.py
@@ -211,7 +211,7 @@ class DuckDB(Dialect):
             exp.DateFromParts: rename_func("MAKE_DATE"),
             exp.DateSub: _date_delta_sql,
             exp.DateDiff: lambda self, e: self.func(
-                "DATE_DIFF", f"'{e.args.get('unit', 'day')}'", e.expression, e.this
+                "DATE_DIFF", f"'{e.args.get('unit') or 'day'}'", e.expression, e.this
             ),
             exp.DateStrToDate: datestrtodate_sql,
             exp.DateToDi: lambda self, e: f"CAST(STRFTIME({self.sql(e, 'this')}, {DuckDB.DATEINT_FORMAT}) AS INT)",


Test patch:
diff --git a/tests/dialects/test_duckdb.py b/tests/dialects/test_duckdb.py
index 37a6f490..5284700f 100644
--- a/tests/dialects/test_duckdb.py
+++ b/tests/dialects/test_duckdb.py
@@ -56,6 +56,15 @@ class TestDuckDB(Validator):
         self.validate_all("0x1010", write={"": "0 AS x1010"})
         self.validate_all("x ~ y", write={"duckdb": "REGEXP_MATCHES(x, y)"})
         self.validate_all("SELECT * FROM 'x.y'", write={"duckdb": 'SELECT * FROM "x.y"'})
+        self.validate_all(
+            "DATE_DIFF('day', CAST(b AS DATE), CAST(a AS DATE))",
+            read={
+                "duckdb": "DATE_DIFF('day', CAST(b AS DATE), CAST(a AS DATE))",
+                "hive": "DATEDIFF(a, b)",
+                "spark": "DATEDIFF(a, b)",
+                "spark2": "DATEDIFF(a, b)",
+            },
+        )
         self.validate_all(
             "XOR(a, b)",
             read={