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

feat: support multi-table insert #15002

Merged
merged 68 commits into from
Mar 30, 2024
Merged

Conversation

SkyFan2002
Copy link
Member

@SkyFan2002 SkyFan2002 commented Mar 19, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

Syntax

-- Unconditional multi-table insert
INSERT [ OVERWRITE ] ALL
  intoClause [ ... ]
<subquery>

-- Conditional multi-table insert
INSERT [ OVERWRITE ] { FIRST | ALL }
  { WHEN <condition> THEN intoClause [ ... ] }
  [ ... ]
  [ ELSE intoClause ]
<subquery>

Where:

intoClause ::=
  INTO <target_table> [ ( <target_col_name> [ , ... ] ) ] [ VALUES (<source_col_name>[ , ... ] ) ]

Integrate with other features (Now)

  • Transaction. Multi-table insert loads data into multi table atomatically, and it can be used in a multi-stmt transaction.
  • Change tracking
  • Cluster key
  • Computed column
  • Distributed execution

Next step

  1. Enhance syntax: VALUES (<source_col_name>[ , ... ] -> VALUES ({expr | DEFAULT }[ , ... ], which supports eval different exprs for different branch.
  2. Support computed column and distributed execution
  3. Improve performance, adjust organization of pipeline, method to execute filter, and concurrency...

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Mar 19, 2024
# Conflicts:
#	src/query/ast/src/ast/statements/statement.rs
#	src/query/sql/src/executor/physical_plan.rs
#	src/query/storages/fuse/src/operations/common/mutation_log.rs
Copy link
Member

@dantengsky dantengsky left a comment

Choose a reason for hiding this comment

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

really enjoy reading this PR.

left some comments/suggestions, pls feel free to amend those in the subsequent PR (if necessary).

and for the 'next steps', it is also suggested to implement the VALUES (expr ..) first, since it currently seems to be the functionality most eagerly awaited by users.

src/query/pipeline/core/src/pipeline.rs Outdated Show resolved Hide resolved
src/query/ast/src/parser/token.rs Outdated Show resolved Hide resolved
src/query/pipeline/core/src/pipeline.rs Outdated Show resolved Hide resolved
src/query/sql/src/planner/planner.rs Outdated Show resolved Hide resolved
@BohuTANG BohuTANG merged commit e48ca07 into datafuselabs:main Mar 30, 2024
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants