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

refactor(frontend): rearrange column binding steps in create table handler #19917

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Dec 24, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Rearrange some column binding steps in CREATE TABLE handler.

Basically, it makes gen_create_table_plan_without_source lightweight and not take AST types as arguments. This is in preparation for #19866.

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • My PR contains critical fixes that are necessary to be merged into the latest release.

Documentation

  • My PR needs documentation updates.
Release note

&generated_column_names,
pk_column_ids,
)?;
// Check if generated column references another generated column.
Copy link
Member Author

Choose a reason for hiding this comment

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

This inlines the function.

// Check if impure generated columns are part of the primary key.
for column in &columns {
Copy link
Member Author

@BugenZhao BugenZhao Dec 24, 2024

Choose a reason for hiding this comment

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

This step used to be in bind_sql_column_constraints, now moved into bind_pk_and_row_id_on_relation as a post check.

@BugenZhao BugenZhao marked this pull request as ready for review December 24, 2024 09:02
Copy link
Contributor

@st1page st1page left a comment

Choose a reason for hiding this comment

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

To be honest, I am not sure about if we need to support row_id in generated column...

dev=> explain create table t(v int, k bigint as _row_id::bigint);
                                                          QUERY PLAN

------------------------------------------------------------------------------------------------------------------------
------
 StreamMaterialize { columns: [v, k, _row_id(hidden)], stream_key: [_row_id], pk_columns: [_row_id], pk_conflict: Overwr
ite }
 └─StreamRowIdGen { row_id_index: 2 }
   └─StreamUnion { all: true }
     └─StreamExchange { dist: HashShard(_row_id) }
       └─StreamProject { exprs: [v, _row_id::Int64 as $expr1, _row_id] }
         └─StreamDml { columns: [v, _row_id] }
           └─StreamSource
(7 rows)

@BugenZhao BugenZhao force-pushed the bz/extract-create-table-args-3 branch from 168965d to 04928f1 Compare December 24, 2024 10:05
@BugenZhao BugenZhao force-pushed the bz/extract-create-table-args-2 branch from f141ea7 to 2d02e3e Compare December 26, 2024 05:12
@BugenZhao BugenZhao force-pushed the bz/extract-create-table-args-3 branch 2 times, most recently from 8d19f9f to 9f28773 Compare December 26, 2024 06:00
Base automatically changed from bz/extract-create-table-args-2 to main December 26, 2024 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants