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

ct: implement CREATE TABLE .. TRANSFORM .. USING as syntactic sugar #29966

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

danhhz
Copy link
Contributor

@danhhz danhhz commented Oct 11, 2024

The parser learns to recognize CREATE TABLE .. TRANSFORM .. USING (..)
and de-sugars it into a CREATE CONTINUAL TASK statement. This allows
us to incrementally ship a smaller footprint than the full generality of
the feature. The statement remembers how it was typed in and we can have
separate feature flags, but otherwise planning etc only see this as a
normal CT.

Touches https://github.com/MaterializeInc/database-issues/issues/8427

Motivation

  • This PR adds a known-desirable feature.

Tips for reviewer

Syntax very much a strawman that we'll want to hash out with sql-council. Inspired by CREATE TABLE .. FROM SOURCE, for which I think there are good parallels:

  • Maybe you want more than one TRANSFORM USING for a source, etc.
  • 1:1 relationship between statements and objects (for things like dbt/terraform).
  • A one-output CT kinda feels like a read-only table? Super long-term I think we could even allow user writes to this table?

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

Strictly speaking, we only need the list of columns when the CT is
self-referential. Make things easier to type by allowing the user to
omit the columns when the CT is not self-referential.
The parser learns to recognize `CREATE TABLE .. TRANSFORM .. USING (..)`
and de-sugars it into a `CREATE CONTINUAL TASK` statement. This allows
us to incrementally ship a smaller footprint than the full generality of
the feature. The statement remembers how it was typed in and we can have
separate feature flags, but otherwise planning etc only see this as a
normal CT.
@danhhz danhhz requested a review from a team as a code owner October 11, 2024 18:53
@danhhz danhhz requested a review from ParkMyCar October 11, 2024 18:53
@danhhz danhhz marked this pull request as draft October 11, 2024 19:32
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.

1 participant