Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DuckDB POSITIONAL JOIN syntax #3109

Closed
dylanscott opened this issue Mar 9, 2024 · 0 comments · Fixed by #3111
Closed

DuckDB POSITIONAL JOIN syntax #3109

dylanscott opened this issue Mar 9, 2024 · 0 comments · Fixed by #3111

Comments

@dylanscott
Copy link

DuckDB supports a unique positional join type which matches up rows of equal length tables, documented here. Currently sqlglot's duckdb dialect does not recognize this syntax and interprets it as an alias for a normal join.

Here's a minimal repro, using the example from the documentation:

from sqlglot import parse_one

parsed = parse_one("""
SELECT df1.*, df2.*
FROM df1
POSITIONAL JOIN df2;
""", dialect="duckdb")

print(f"""
{parsed!r}
--------------------
{parsed.sql(dialect="duckdb", pretty=True)}
""")

Which prints

Select(
  expressions=[
    Column(
      this=Star(),
      table=Identifier(this=df1, quoted=False)),
    Column(
      this=Star(),
      table=Identifier(this=df2, quoted=False))],
  from=From(
    this=Table(
      this=Identifier(this=df1, quoted=False),
      alias=TableAlias(
        this=Identifier(this=POSITIONAL, quoted=False)))),
  joins=[
    Join(
      this=Table(
        this=Identifier(this=df2, quoted=False)))])
--------------------
SELECT
  df1.*,
  df2.*
FROM df1 AS POSITIONAL, df2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant