internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: tobymao/sqlglot

Issue:
Interval parsing does not meet expectations
When adding other keywords after interval, there is a problem with interval parsing, and it is not parsed into the format of the standard interval '71' day.
Reproduce code example：
`expression = sqlglot.parse_one("""select a from tbl where a <= date '1998-12-01' - interval '71 days' group by b;`
result：`SELECT a FROM tbl WHERE a <= CAST('1998-12-01' AS DATE) - INTERVAL '71 days' GROUP BY b`

`expression = sqlglot.parse_one("""select a from tbl where a <= date '1998-12-01' - interval '71 days';`
result：`SELECT a FROM tbl WHERE a <= CAST('1998-12-01' AS DATE) - INTERVAL '71' days`


Discussion:

Resolving patch:
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -3154,12 +3154,12 @@ def _parse_interval(self) -> t.Optional[exp.Interval]:
 
             if len(parts) == 2:
                 if unit:
-                    # this is not actually a unit, it's something else
+                    # This is not actually a unit, it's something else (e.g. a "window side")
                     unit = None
                     self._retreat(self._index - 1)
-                else:
-                    this = exp.Literal.string(parts[0])
-                    unit = self.expression(exp.Var, this=parts[1])
+
+                this = exp.Literal.string(parts[0])
+                unit = self.expression(exp.Var, this=parts[1])
 
         return self.expression(exp.Interval, this=this, unit=unit)
 


Test patch:
diff --git a/tests/test_parser.py b/tests/test_parser.py
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -711,3 +711,11 @@ def test_parse_terse_coalesce(self):
             parse_one("SELECT a, b ?? c ?? 'No Data' FROM z").sql(),
             "SELECT a, COALESCE(COALESCE(b, c), 'No Data') FROM z",
         )
+
+    def test_parse_intervals(self):
+        ast = parse_one(
+            "SELECT a FROM tbl WHERE a <= DATE '1998-12-01' - INTERVAL '71 days' GROUP BY b"
+        )
+
+        self.assertEqual(ast.find(exp.Interval).this.sql(), "'71'")
+        self.assertEqual(ast.find(exp.Interval).unit.assert_is(exp.Var).sql(), "days")
Repository: tobymao/sqlglot

Issue:
Teradata to Databricks transpilation issue
When working on Teradata to Databricks conversion i ran into a issue where a command like "Database databasename" which is equvalent to "USE Databasename" on Databricks side is not getting tranpiled correctly. The final output still shows the original command.


**Sample code** below
```
sql="""
	DATABASE tduser;
"""

try:
    new_query = sqlglot.transpile(sql, read='teradata', write='databricks', pretty=True)[0]
    print(new_query)
except sqlglot.errors.ParseError as error:
    print(traceback.format_exc())
    print(error.errors)
```
**Expected output:**
USE tduser

**Official Documentation**
https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-usedb.html



Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/teradata.py b/sqlglot/dialects/teradata.py
--- a/sqlglot/dialects/teradata.py
+++ b/sqlglot/dialects/teradata.py
@@ -95,6 +95,9 @@ class Parser(parser.Parser):
 
         STATEMENT_PARSERS = {
             **parser.Parser.STATEMENT_PARSERS,
+            TokenType.DATABASE: lambda self: self.expression(
+                exp.Use, this=self._parse_table(schema=False)
+            ),
             TokenType.REPLACE: lambda self: self._parse_create(),
         }
 
@@ -165,6 +168,7 @@ class Generator(generator.Generator):
             exp.Select: transforms.preprocess([transforms.eliminate_distinct_on]),
             exp.StrToDate: lambda self, e: f"CAST({self.sql(e, 'this')} AS DATE FORMAT {self.format_time(e)})",
             exp.ToChar: lambda self, e: self.function_fallback_sql(e),
+            exp.Use: lambda self, e: f"DATABASE {self.sql(e, 'this')}",
         }
 
         def partitionedbyproperty_sql(self, expression: exp.PartitionedByProperty) -> str:


Test patch:
diff --git a/tests/dialects/test_teradata.py b/tests/dialects/test_teradata.py
--- a/tests/dialects/test_teradata.py
+++ b/tests/dialects/test_teradata.py
@@ -4,6 +4,18 @@
 class TestTeradata(Validator):
     dialect = "teradata"
 
+    def test_teradata(self):
+        self.validate_all(
+            "DATABASE tduser",
+            read={
+                "databricks": "USE tduser",
+            },
+            write={
+                "databricks": "USE tduser",
+                "teradata": "DATABASE tduser",
+            },
+        )
+
     def test_translate(self):
         self.validate_all(
             "TRANSLATE(x USING LATIN_TO_UNICODE)",
Repository: tobymao/sqlglot

Issue:
Spark raw String Support, comonly used with regexes
This fails with sqlglot:

```python
import sqlglot

sql = """select regexp_replace('100-200', r'([^0-9])', '')"""
sqlglot.parse_one(sql, read="databricks")
```

**Official Documentation**
https://spark.apache.org/docs/latest/sql-ref-literals.html



Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/spark.py b/sqlglot/dialects/spark.py
--- a/sqlglot/dialects/spark.py
+++ b/sqlglot/dialects/spark.py
@@ -35,6 +35,13 @@ def _parse_datediff(args: t.List) -> exp.Expression:
 
 
 class Spark(Spark2):
+    class Tokenizer(Spark2.Tokenizer):
+        RAW_STRINGS = [
+            (prefix + q, q)
+            for q in t.cast(t.List[str], Spark2.Tokenizer.QUOTES)
+            for prefix in ("r", "R")
+        ]
+
     class Parser(Spark2.Parser):
         FUNCTIONS = {
             **Spark2.Parser.FUNCTIONS,


Test patch:
diff --git a/tests/dialects/test_spark.py b/tests/dialects/test_spark.py
--- a/tests/dialects/test_spark.py
+++ b/tests/dialects/test_spark.py
@@ -239,6 +239,14 @@ def test_spark(self):
         self.validate_identity("TRIM(LEADING 'SL' FROM 'SSparkSQLS')")
         self.validate_identity("TRIM(TRAILING 'SL' FROM 'SSparkSQLS')")
         self.validate_identity("SPLIT(str, pattern, lim)")
+        self.validate_identity(
+            "SELECT REGEXP_REPLACE('100-200', r'([^0-9])', '')",
+            "SELECT REGEXP_REPLACE('100-200', '([^0-9])', '')",
+        )
+        self.validate_identity(
+            "SELECT REGEXP_REPLACE('100-200', R'([^0-9])', '')",
+            "SELECT REGEXP_REPLACE('100-200', '([^0-9])', '')",
+        )
         self.validate_identity(
             "SELECT STR_TO_MAP('a:1,b:2,c:3')",
             "SELECT STR_TO_MAP('a:1,b:2,c:3', ',', ':')",
Repository: tobymao/sqlglot

Issue:
Specifying 3.7+ in setup.py
sqlglot fails with Python version < 3.7. 

While Python 3.6 is end-of-life, there are systems that still use 3.6 as they transition to 3.7. Having either `setup.py` or `setup.cfg` specify 3.7+ or adding to README would be helpful. 

```
import sqlglot
```
`SyntaxError: future feature annotations is not defined`

**Official Documentation**
https://docs.python.org/3/library/__future__.html



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -17,6 +17,7 @@
         "local_scheme": "no-local-version",
     },
     setup_requires=["setuptools_scm"],
+    python_requires=">=3.7",
     extras_require={
         "dev": [
             "autoflake",


Test patch:
Repository: tobymao/sqlglot

Issue:
Unable to parse the oracle query when query has OFFSET & FETCH Clauses with NVL
Hello Team,
Warm greetings!

Parser is throwing an error when there are following clauses with NVL function present in the query -

 - OFFSET
 - FETCH

**Oracle Documentation -**
https://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqljoffsetfetch.html

**Code for your reference -**

```
import sqlglot.expressions as exp

# works fine
query1 ="""
SELECT * FROM T ORDER BY I OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY
"""
# Doesn't work
query2 ="""
SELECT * FROM T ORDER BY I OFFSET nvl(:variable1, 10) ROWS FETCH NEXT nvl(:variable2, 10) ROWS ONLY
"""

#works fine
query3 ="""
SELECT * FROM T ORDER BY I OFFSET (select 5 from dual) ROWS FETCH NEXT 10 ROWS ONLY
"""

expressions = sqlglot.parse_one(query1, read='oracle')
x = list(expressions.find_all(exp.Table))

for i in x:
  listTables = str(i).split(' ')[0]
  print(listTables)

```

Note that above queries are valid oracle queries.

Numbers and select queries work fine with OFFSET and FETCH clause.

query2 fails as it cannot process nvl function.
Request you to add support for nvl function in OFFSET and FETCH clause.

Thanks ton in advance!

Thanks,
Sachin


Discussion:

Resolving patch:
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -848,6 +848,8 @@ class Parser(metaclass=_Parser):
     WINDOW_BEFORE_PAREN_TOKENS = {TokenType.OVER}
     WINDOW_SIDES = {"FOLLOWING", "PRECEDING"}
 
+    FETCH_TOKENS = ID_VAR_TOKENS - {TokenType.ROW, TokenType.ROWS, TokenType.PERCENT}
+
     ADD_CONSTRAINT_TOKENS = {TokenType.CONSTRAINT, TokenType.PRIMARY_KEY, TokenType.FOREIGN_KEY}
 
     DISTINCT_TOKENS = {TokenType.DISTINCT}
@@ -2984,7 +2986,7 @@ def _parse_limit(
             direction = self._match_set((TokenType.FIRST, TokenType.NEXT))
             direction = self._prev.text if direction else "FIRST"
 
-            count = self._parse_number()
+            count = self._parse_field(tokens=self.FETCH_TOKENS)
             percent = self._match(TokenType.PERCENT)
 
             self._match_set((TokenType.ROW, TokenType.ROWS))


Test patch:
diff --git a/tests/dialects/test_oracle.py b/tests/dialects/test_oracle.py
--- a/tests/dialects/test_oracle.py
+++ b/tests/dialects/test_oracle.py
@@ -50,6 +50,10 @@ def test_oracle(self):
             "SELECT UNIQUE col1, col2 FROM table",
             "SELECT DISTINCT col1, col2 FROM table",
         )
+        self.validate_identity(
+            "SELECT * FROM T ORDER BY I OFFSET nvl(:variable1, 10) ROWS FETCH NEXT nvl(:variable2, 10) ROWS ONLY",
+            "SELECT * FROM T ORDER BY I OFFSET COALESCE(:variable1, 10) ROWS FETCH NEXT COALESCE(:variable2, 10) ROWS ONLY",
+        )
 
         self.validate_all(
             "NVL(NULL, 1)",
Repository: tobymao/sqlglot

Issue:
Unable to parse the oracle query when query has CONNECT BY followed by START WITH clause
Hello Team,
Warm greetings!

Parser is throwing an error when there is CONNECT BY followed by START WITH clause!

**Oracle Documentation -**
https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Hierarchical-Queries.html#GUID-0118DF1D-B9A9-41EB-8556-C6E7D6A5A84E
![image](https://github.com/tobymao/sqlglot/assets/142426118/ce13a736-cb2d-4924-9e4c-e40fe2ae34c5)


**Code for your reference -**
```

import sqlglot.expressions as exp

# works fine
query1 ="""
SELECT last_name "Employee", 
   LEVEL, SYS_CONNECT_BY_PATH(last_name, '/') "Path"
   FROM employees
   WHERE level <= 3 AND department_id = 80
   START WITH last_name = 'King'
   CONNECT BY PRIOR employee_id = manager_id AND LEVEL <= 4
"""
# Doesn't work
query2 ="""
SELECT last_name "Employee", 
   LEVEL, SYS_CONNECT_BY_PATH(last_name, '/') "Path"
   FROM employees
   WHERE level <= 3 AND department_id = 80
   CONNECT BY PRIOR employee_id = manager_id AND LEVEL <= 4
   START WITH last_name = 'King'
"""

expressions = sqlglot.parse_one(query2, read='oracle')
x = list(expressions.find_all(exp.Table))

for i in x:
  listTables = str(i).split(' ')[0]
  print(listTables)
```

Note that above queries are valid oracle queries.

query2 fails as START WITH clause is after the connect by clause.
Request you to add support for the same.

Thanks ton in advance!

Thanks,
Sachin


Discussion:

Resolving patch:
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -2913,6 +2913,10 @@ def _parse_connect(self, skip_start_token: bool = False) -> t.Optional[exp.Conne
         )
         connect = self._parse_conjunction()
         self.NO_PAREN_FUNCTION_PARSERS.pop("PRIOR")
+
+        if not start and self._match(TokenType.START_WITH):
+            start = self._parse_conjunction()
+
         return self.expression(exp.Connect, start=start, connect=connect)
 
     def _parse_order(


Test patch:
diff --git a/tests/dialects/test_oracle.py b/tests/dialects/test_oracle.py
--- a/tests/dialects/test_oracle.py
+++ b/tests/dialects/test_oracle.py
@@ -218,3 +218,25 @@ def test_json_table(self):
   ON ar.empno = jt.empno""",
             pretty=True,
         )
+
+    def test_connect_by(self):
+        start = "START WITH last_name = 'King'"
+        connect = "CONNECT BY PRIOR employee_id = manager_id AND LEVEL <= 4"
+        body = """
+            SELECT last_name "Employee",
+            LEVEL, SYS_CONNECT_BY_PATH(last_name, '/') "Path"
+            FROM employees
+            WHERE level <= 3 AND department_id = 80
+        """
+        pretty = """SELECT
+  last_name AS "Employee",
+  LEVEL,
+  SYS_CONNECT_BY_PATH(last_name, '/') AS "Path"
+FROM employees
+START WITH last_name = 'King'
+CONNECT BY PRIOR employee_id = manager_id AND LEVEL <= 4
+WHERE
+  level <= 3 AND department_id = 80"""
+
+        for query in (f"{body}{start}{connect}", f"{body}{connect}{start}"):
+            self.validate_identity(query, pretty, pretty=True)
Repository: tobymao/sqlglot

Issue:
Support LOCK TABLES MySQL statement
MySQL schema can have LOCK TABLES and UNLOCK TABLES statements.
At the moment it seems that the library does not parse them in any way and raises an error.


**Fully reproducible code snippet**
```python
    sql = "LOCK TABLES `app_fields` WRITE;"
    parsed_sql_exprs = sqlglot.parse_one(sql, read="mysql")
```

**Official Documentation**
https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html


Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/mysql.py b/sqlglot/dialects/mysql.py
--- a/sqlglot/dialects/mysql.py
+++ b/sqlglot/dialects/mysql.py
@@ -130,6 +130,7 @@ class Tokenizer(tokens.Tokenizer):
             "ENUM": TokenType.ENUM,
             "FORCE": TokenType.FORCE,
             "IGNORE": TokenType.IGNORE,
+            "LOCK TABLES": TokenType.COMMAND,
             "LONGBLOB": TokenType.LONGBLOB,
             "LONGTEXT": TokenType.LONGTEXT,
             "MEDIUMBLOB": TokenType.MEDIUMBLOB,
@@ -142,6 +143,7 @@ class Tokenizer(tokens.Tokenizer):
             "START": TokenType.BEGIN,
             "SIGNED": TokenType.BIGINT,
             "SIGNED INTEGER": TokenType.BIGINT,
+            "UNLOCK TABLES": TokenType.COMMAND,
             "UNSIGNED": TokenType.UBIGINT,
             "UNSIGNED INTEGER": TokenType.UBIGINT,
             "YEAR": TokenType.YEAR,


Test patch:
diff --git a/tests/dialects/test_mysql.py b/tests/dialects/test_mysql.py
--- a/tests/dialects/test_mysql.py
+++ b/tests/dialects/test_mysql.py
@@ -107,9 +107,8 @@ def test_ddl(self):
         )
 
     def test_identity(self):
-        self.validate_identity(
-            "SELECT * FROM x ORDER BY BINARY a", "SELECT * FROM x ORDER BY CAST(a AS BINARY)"
-        )
+        self.validate_identity("UNLOCK TABLES")
+        self.validate_identity("LOCK TABLES `app_fields` WRITE")
         self.validate_identity("SELECT 1 XOR 0")
         self.validate_identity("SELECT 1 && 0", "SELECT 1 AND 0")
         self.validate_identity("SELECT /*+ BKA(t1) NO_BKA(t2) */ * FROM t1 INNER JOIN t2")
@@ -133,6 +132,9 @@ def test_identity(self):
         self.validate_identity("CREATE TABLE A LIKE B")
         self.validate_identity("SELECT * FROM t1, t2 FOR SHARE OF t1, t2 SKIP LOCKED")
         self.validate_identity("SELECT a || b", "SELECT a OR b")
+        self.validate_identity(
+            "SELECT * FROM x ORDER BY BINARY a", "SELECT * FROM x ORDER BY CAST(a AS BINARY)"
+        )
         self.validate_identity(
             """SELECT * FROM foo WHERE 3 MEMBER OF(JSON_EXTRACT(info, '$.value'))"""
         )
Repository: tobymao/sqlglot

Issue:
Snowflake dialect fails to parse expression when casting object constant to variant using double colon syntax
As noted in the [object-constants](https://docs.snowflake.com/en/sql-reference/data-types-semistructured#object-constants) docs, using ` { 'test': 'test' } ` is valid SQL. 

Its also possible to cast an object constant to a variant using `SELECT to_variant({'test': 'best'});` 

Therefore when attempting to cast it as follows `{ 'test': 'test' }::variant`, I'd expect success. However, it fails 

```python
sql = """SELECT {'test': 'best'}::variant"""

import sqlglot

sqlglot.parse_one(sql, read="snowflake")
```

```
Traceback (most recent call last):
  File "/Users/wesley.hamburger/Library/Application Support/Code/User/globalStorage/buenon.scratchpads/scratchpads/1a4f2b73c916c9af3926773a674c6453/scratch31.py", line 5, in <module>
    sqlglot.parse_one(sql, read="snowflake")
  File "/Users/wesley.hamburger/.pyenv/versions/3.10.11/envs/snowflake-pipe/lib/python3.10/site-packages/sqlglot/__init__.py", line 125, in parse_one
    result = dialect.parse(sql, **opts)
  File "/Users/wesley.hamburger/.pyenv/versions/3.10.11/envs/snowflake-pipe/lib/python3.10/site-packages/sqlglot/dialects/dialect.py", line 285, in parse
    return self.parser(**opts).parse(self.tokenize(sql), sql)
  File "/Users/wesley.hamburger/.pyenv/versions/3.10.11/envs/snowflake-pipe/lib/python3.10/site-packages/sqlglot/parser.py", line 882, in parse
    return self._parse(
  File "/Users/wesley.hamburger/.pyenv/versions/3.10.11/envs/snowflake-pipe/lib/python3.10/site-packages/sqlglot/parser.py", line 951, in _parse
    self.raise_error("Invalid expression / Unexpected token")
  File "/Users/wesley.hamburger/.pyenv/versions/3.10.11/envs/snowflake-pipe/lib/python3.10/site-packages/sqlglot/parser.py", line 992, in raise_error
    raise error
sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 1, Col: 25.
  SELECT {'test': 'best'}::variant
```


Discussion:

Resolving patch:
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -3251,7 +3251,7 @@ def _parse_type(self) -> t.Optional[exp.Expression]:
                 return self._parse_column()
             return self._parse_column_ops(data_type)
 
-        return this
+        return this and self._parse_column_ops(this)
 
     def _parse_type_size(self) -> t.Optional[exp.DataTypeParam]:
         this = self._parse_type()


Test patch:
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -78,6 +78,10 @@ def test_snowflake(self):
             r"SELECT $$a ' \ \t \x21 z $ $$",
             r"SELECT 'a \' \\ \\t \\x21 z $ '",
         )
+        self.validate_identity(
+            "SELECT {'test': 'best'}::VARIANT",
+            "SELECT CAST(OBJECT_CONSTRUCT('test', 'best') AS VARIANT)",
+        )
 
         self.validate_all("CAST(x AS BYTEINT)", write={"snowflake": "CAST(x AS INT)"})
         self.validate_all("CAST(x AS CHAR VARYING)", write={"snowflake": "CAST(x AS VARCHAR)"})
Repository: tobymao/sqlglot

Issue:
Support Sqlite datetime functions
**Is your feature request related to a problem? Please describe.**
I've tried to run queries with SQLite dialect, and I found that the following datetime functions are not defined:
- date
- datetime
- julianday
- unixepoch
- timediff

In this link, you can see their definition [](https://www.sqlite.org/lang_datefunc.html)

**Describe the solution you'd like.**
I wanted these functions to be supported.

**Describe alternatives you've considered**
N/A

**Additional context**
N/A



Discussion:
Hello, can you please elaborate on what exactly is not working as expected?

Resolving patch:
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py
--- a/sqlglot/expressions.py
+++ b/sqlglot/expressions.py
@@ -4427,7 +4427,8 @@ class DateToDi(Func):
 
 # https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#date
 class Date(Func):
-    arg_types = {"this": True, "zone": False}
+    arg_types = {"this": False, "zone": False, "expressions": False}
+    is_var_len_args = True
 
 
 class Day(Func):


Test patch:
diff --git a/tests/dialects/test_sqlite.py b/tests/dialects/test_sqlite.py
--- a/tests/dialects/test_sqlite.py
+++ b/tests/dialects/test_sqlite.py
@@ -59,6 +59,20 @@ def test_ddl(self):
         )
 
     def test_sqlite(self):
+        self.validate_identity("SELECT DATE()")
+        self.validate_identity("SELECT DATE('now', 'start of month', '+1 month', '-1 day')")
+        self.validate_identity("SELECT DATETIME(1092941466, 'unixepoch')")
+        self.validate_identity("SELECT DATETIME(1092941466, 'auto')")
+        self.validate_identity("SELECT DATETIME(1092941466, 'unixepoch', 'localtime')")
+        self.validate_identity("SELECT UNIXEPOCH()")
+        self.validate_identity("SELECT STRFTIME('%s')")
+        self.validate_identity("SELECT JULIANDAY('now') - JULIANDAY('1776-07-04')")
+        self.validate_identity("SELECT UNIXEPOCH() - UNIXEPOCH('2004-01-01 02:34:56')")
+        self.validate_identity("SELECT DATE('now', 'start of year', '+9 months', 'weekday 2')")
+        self.validate_identity("SELECT (JULIANDAY('now') - 2440587.5) * 86400.0")
+        self.validate_identity("SELECT UNIXEPOCH('now', 'subsec')")
+        self.validate_identity("SELECT TIMEDIFF('now', '1809-02-12')")
+
         self.validate_all("SELECT LIKE(y, x)", write={"sqlite": "SELECT x LIKE y"})
         self.validate_all("SELECT GLOB('*y*', 'xyz')", write={"sqlite": "SELECT 'xyz' GLOB '*y*'"})
         self.validate_all(
Repository: tobymao/sqlglot

Issue:
SQLglot misinterprets keywords from other dialects for bigquery
**Fully reproducible code snippet**
```
sql = "select a overlaps, b from table"
schema = {"a": "INT", "b": "INT"}

from sqlglot.optimizer import optimize

optimize(sql, dialect = "bigquery")
```

Actual output
```
ParseError: Required keyword: 'expression' missing for <class 'sqlglot.expressions.Overlaps'>. Line 1, Col: 18.
  select a overlaps, b from table
```

Expected output
This should parse, since "overlaps" is not a reserved keyword in BQ, but it is in other dialects (e.g. [sqlserver](https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/ef/language-reference/overlaps-entity-sql).



Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/bigquery.py b/sqlglot/dialects/bigquery.py
--- a/sqlglot/dialects/bigquery.py
+++ b/sqlglot/dialects/bigquery.py
@@ -343,6 +343,9 @@ class Parser(parser.Parser):
             "OPTIONS": lambda self: exp.Properties(expressions=self._parse_with_property()),
         }
 
+        RANGE_PARSERS = parser.Parser.RANGE_PARSERS.copy()
+        RANGE_PARSERS.pop(TokenType.OVERLAPS, None)
+
         NULL_TOKENS = {TokenType.NULL, TokenType.UNKNOWN}
 
         def _parse_table_part(self, schema: bool = False) -> t.Optional[exp.Expression]:
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -285,6 +285,7 @@ class Parser(metaclass=_Parser):
         TokenType.NEXT,
         TokenType.OFFSET,
         TokenType.ORDINALITY,
+        TokenType.OVERLAPS,
         TokenType.OVERWRITE,
         TokenType.PARTITION,
         TokenType.PERCENT,


Test patch:
diff --git a/tests/dialects/test_bigquery.py b/tests/dialects/test_bigquery.py
--- a/tests/dialects/test_bigquery.py
+++ b/tests/dialects/test_bigquery.py
@@ -106,6 +106,10 @@ def test_bigquery(self):
         self.validate_identity(
             "SELECT LAST_VALUE(a IGNORE NULLS) OVER y FROM x WINDOW y AS (PARTITION BY CATEGORY)",
         )
+        self.validate_identity(
+            "SELECT a overlaps",
+            "SELECT a AS overlaps",
+        )
         self.validate_identity(
             "SELECT y + 1 z FROM x GROUP BY y + 1 ORDER BY z",
             "SELECT y + 1 AS z FROM x GROUP BY z ORDER BY z",