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

Support Offset() as an expression with no breakouts [backend] #42132

Merged
merged 15 commits into from May 7, 2024

Conversation

camsaul
Copy link
Member

@camsaul camsaul commented May 1, 2024

Follow-on to #41346

Fixes #42323

Backend support for using offset() as a plain expression (as opposed to an aggregation or in an aggregation expression)

Most of the changes to make this work are actually in #42302, this PR is mostly just a few more small tweaks and extra backend tests.

FE work will have to be done separately, I'm not currently planning on trying to tackle it so maybe someone from QC can update things once this lands

@metabase-bot metabase-bot bot added the .Team/QueryProcessor :hammer_and_wrench: label May 1, 2024
Base automatically changed from change-breakouts-to-use-for-window-function-partitions to master May 3, 2024 00:50
@camsaul camsaul changed the base branch from master to nest-query-mlv2 May 3, 2024 01:08
@mngr
Copy link

mngr commented May 3, 2024

It still shows error about aggregation. Probably it should say something about that offset in customs columns is not yet supported for anything except postgres.
Captura de ecrã 2024-05-03, às 20 20 28
Also, what is the logic you've implemented for sorting and partitioning when the offset function is used in custom column?

@mngr
Copy link

mngr commented May 3, 2024

Well, for the postgres db I got the same error
Captura de ecrã 2024-05-03, às 21 09 43

@camsaul camsaul changed the base branch from nest-query-mlv2 to only-nest-expressions-in-breakouts-or-aggregations May 6, 2024 23:32
@camsaul camsaul marked this pull request as ready for review May 6, 2024 23:32
@camsaul camsaul changed the title Support Offset() as an expression with no breakouts [WIP] Support Offset() as an expression with no breakouts [backend] May 6, 2024
@camsaul
Copy link
Member Author

camsaul commented May 6, 2024

@mngr this PR is only for the backend, maybe you or someone else can help with FE changes? And the PR was a "WIP" draft PR when you commented, so the behavior (and what DBs this supports or does not support) is not finalized.

@camsaul camsaul requested a review from a team May 7, 2024 01:08
@camsaul camsaul added the no-backport Do not backport this PR to any branch label May 7, 2024
Copy link

replay-io bot commented May 7, 2024

Status Complete ↗︎
Commit 5e37e70
Results
⚠️ 6 Flaky
2466 Passed

@@ -109,14 +109,23 @@
(= ref-type (first x))
(not (contains? valid-ids (get x 2)))))

(defn- stage-with-joins-and-namespaced-keys-removed
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand that using Offset in custom column expression requires presence of an order-by clause or a breakout clause. The following video shows me trying it out:

  • 0:15 - adding order by clause does not change anything, query still fails
  • 0:25 - editing a custom column adds effective-type: "type/Float" in pMBQL and BE throws because of it

Are those BE issues?

2024-05-07.18-22-41.mp4

Copy link
Member Author

Choose a reason for hiding this comment

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

what branch are you on, so I can test this locally?

Btw I just fixed the effective-type error, #42323 should be fixed in this branch too

Copy link
Contributor

Choose a reason for hiding this comment

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

Aforementioned issues seem to be fixed now ✔️

Sorry, I was using 42318-offset-custom-columns-frontend branch to test it.

Base automatically changed from only-nest-expressions-in-breakouts-or-aggregations to master May 7, 2024 19:04
@camsaul camsaul enabled auto-merge (squash) May 7, 2024 19:28
@camsaul camsaul merged commit 5406087 into master May 7, 2024
110 checks passed
@camsaul camsaul deleted the offset-part-2 branch May 7, 2024 20:05
Copy link

github-actions bot commented May 7, 2024

@camsaul Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/QueryProcessor :hammer_and_wrench:
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offset() doesn't work after saving a question
4 participants