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

bring up JOIN USING and make README query work #5477

Merged
merged 3 commits into from
Nov 13, 2024
Merged

bring up JOIN USING and make README query work #5477

merged 3 commits into from
Nov 13, 2024

Conversation

mccanne
Copy link
Collaborator

@mccanne mccanne commented Nov 13, 2024

This commit gets the using condition for joins working and now allows the query that is now in the top-level README to work. We unified some of the join logic between SQL and SPQ and relaxed some of the checking of group-by keys with selection, which had been too aggressive. We also added a test that emulates the README query with smaller data in local files rather than APIs.

This commit gets the using condition for joins working and now allows
the query that is now in the top-level README to work.  We unified
some of the join logic between SQL and SPQ and relaxed some of the
checking of group-by keys with selection, which had been too aggressive.
We also added a test that emulates the README query with smaller data
in local files rather than APIs.
@mccanne mccanne requested a review from a team November 13, 2024 05:05
Comment on lines +342 to 350
for k, col := range scalars {
path := col.scalar
if this, ok := col.scalar.(*dag.This); ok {
if field.Path(this.Path).In(paths) {
continue
}
}
if !(field.Path{col.name}).In(paths) {
a.error(exprs[k], fmt.Errorf("'%s': selected expression is missing from GROUP BY clause (and is not an aggregation)", path))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
for k, col := range scalars {
path := col.scalar
if this, ok := col.scalar.(*dag.This); ok {
if field.Path(this.Path).In(paths) {
continue
}
}
if !(field.Path{col.name}).In(paths) {
a.error(exprs[k], fmt.Errorf("'%s': selected expression is missing from GROUP BY clause (and is not an aggregation)", path))
for k, col := range scalars {
if this, ok := col.scalar.(*dag.This); ok {
if paths.Has(this.Path) {
continue
}
}
if !paths.Has(col.name) {
a.error(exprs[k], fmt.Errorf("%q: selected expression is missing from GROUP BY clause (and is not an aggregation)", col.scalar))

case *ast.JoinUsingExpr:
c.write("using (")
c.exprs(cond.Fields)
c.write(")")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
c.write(")")
c.write(")")
default:
panic(cond)

@mccanne mccanne merged commit 38692a4 into main Nov 13, 2024
3 checks passed
@mccanne mccanne deleted the join-using branch November 13, 2024 14:08
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 this pull request may close these issues.

2 participants