Repository: tobymao/sqlglot

Issue:
[spark dialect] Parser doesn't handle default value for unix_timestamp function
Reproduction:
```python
from sqlglot import parse_one
sql = "select unix_timestamp()"
parse_one(sql, read='spark')
```

 error:
```python
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/__init__.py", line 84, in parse_one
    result = dialect.parse(sql, **opts)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/dialects/dialect.py", line 150, in parse
    return self.parser(**opts).parse(self.tokenizer.tokenize(sql), sql)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 658, in parse
    return self._parse(
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 696, in _parse
    expressions.append(parse_method(self))
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 808, in _parse_statement
    expression = self._parse_set_operations(expression) if expression else self._parse_select()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1165, in _parse_select
    expressions = self._parse_csv(self._parse_expression)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 2665, in _parse_csv
    parse_result = parse_method()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1708, in _parse_expression
    return self._parse_alias(self._parse_conjunction())
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1711, in _parse_conjunction
    return self._parse_tokens(self._parse_equality, self.CONJUNCTION)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 2679, in _parse_tokens
    this = parse_method()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1714, in _parse_equality
    return self._parse_tokens(self._parse_comparison, self.EQUALITY)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 2679, in _parse_tokens
    this = parse_method()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1717, in _parse_comparison
    return self._parse_tokens(self._parse_range, self.COMPARISON)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 2679, in _parse_tokens
    this = parse_method()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1720, in _parse_range
    this = self._parse_bitwise()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1785, in _parse_bitwise
    this = self._parse_term()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1808, in _parse_term
    return self._parse_tokens(self._parse_factor, self.TERM)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 2679, in _parse_tokens
    this = parse_method()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1811, in _parse_factor
    return self._parse_tokens(self._parse_unary, self.FACTOR)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 2679, in _parse_tokens
    this = parse_method()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1816, in _parse_unary
    return self._parse_at_time_zone(self._parse_type())
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1824, in _parse_type
    this = self._parse_column()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 1939, in _parse_column
    this = self._parse_field()
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 2019, in _parse_field
    return self._parse_primary() or self._parse_function() or self._parse_id_var(any_token)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 2073, in _parse_function
    self.validate_expression(this, args)
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 756, in validate_expression
    self.raise_error(f"Required keyword: '{k}' missing for {expression.__class__}")
  File "/opt/homebrew/lib/python3.8/site-packages/sqlglot/parser.py", line 733, in raise_error
    raise error
sqlglot.errors.ParseError: Required keyword: 'this' missing for <class 'sqlglot.expressions.StrToUnix'>. Line 1, Col: 23.
  select unix_timestamp()
```

So the `unix_timestamp` function requires 2 parameters, and the default values in spark dialect are:
```python
>>> spark.sql("select unix_timestamp()")
DataFrame[unix_timestamp(current_timestamp(), yyyy-MM-dd HH:mm:ss): bigint]
```

it seems the parser autofill the last one but miss the first one and requires a sepecific input which differs from spark dialect


Discussion:

Patch:
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
index 2167c675..d6c93dd1 100644
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -3002,8 +3002,10 @@ class StrToTime(Func):
     arg_types = {"this": True, "format": True}
 
 
+# Spark allows unix_timestamp()
+# https://spark.apache.org/docs/3.1.3/api/python/reference/api/pyspark.sql.functions.unix_timestamp.html
 class StrToUnix(Func):
-    arg_types = {"this": True, "format": True}
+    arg_types = {"this": False, "format": False}
 
 
 class NumberToStr(Func):


Test patch:
diff --git a/tests/dialects/test_spark.py b/tests/dialects/test_spark.py
index 7395e727..f287a89d 100644
--- a/tests/dialects/test_spark.py
+++ b/tests/dialects/test_spark.py
@@ -207,6 +207,7 @@ TBLPROPERTIES (
         )
 
     def test_spark(self):
+        self.validate_identity("SELECT UNIX_TIMESTAMP()")
         self.validate_all(
             "ARRAY_SORT(x, (left, right) -> -1)",
             write={