Skip to content

Commit 3567880

Browse files
committed
feat: add tokens to functions
1 parent ea0263a commit 3567880

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

sqlglot/parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6076,7 +6076,8 @@ def _parse_function_call(
60766076
this = exp.Identifier(this=this, quoted=True).update_positions(token)
60776077

60786078
this = self.expression(exp.Anonymous, this=this, expressions=args)
6079-
this = this.update_positions(token)
6079+
6080+
this = this.update_positions(token)
60806081

60816082
if isinstance(this, exp.Expression):
60826083
this.add_comments(comments)

tests/dialects/test_clickhouse.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def test_clickhouse(self):
3232

3333
expr = parse_one("count(x)")
3434
self.assertEqual(expr.sql(dialect="clickhouse"), "COUNT(x)")
35-
self.assertIsNone(expr._meta)
3635

3736
self.validate_identity('SELECT DISTINCT ON ("id") * FROM t')
3837
self.validate_identity("SELECT 1 OR (1 = 2)")

tests/test_parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,8 @@ def test_token_position_meta(self):
990990
ast = parse_one("SELECT 1")
991991
self.assertEqual(ast.find(exp.Literal).meta, {"line": 1, "col": 8, "start": 7, "end": 7})
992992

993+
self.assertEqual(parse_one("max(1)").meta, {"col": 3, "end": 2, "line": 1, "start": 0})
994+
993995
def test_quoted_identifier_meta(self):
994996
sql = 'SELECT "a" FROM "test_schema"."test_table_a"'
995997
ast = parse_one(sql)

0 commit comments

Comments
 (0)