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

fix: wrong primary key when define tsid and timestamp key as primary key #453

Merged
merged 6 commits into from
Dec 7, 2022

Conversation

ShiKaiWi
Copy link
Member

@ShiKaiWi ShiKaiWi commented Dec 6, 2022

Which issue does this PR close?

Closes #

Rationale for this change

After #340 merged, it can't define (tsid, timestamp_key_name) as primary key. And this pr will fix this problem.

What changes are included in this PR?

  • Refactor the generation of create table plan;
  • We can define a primary key with tsid;

Are there any user-facing changes?

The tsid column will be the last column in the schema after this pr, compared with that tsid column just follows the timestamp key column.

How does this change test

New sql test in the harness.

tests/cases/local/05_ddl/create_tables.sql Show resolved Hide resolved
sql/src/planner.rs Show resolved Hide resolved
sql/src/planner.rs Outdated Show resolved Hide resolved
sql/src/planner.rs Show resolved Hide resolved
sql/src/planner.rs Outdated Show resolved Hide resolved
@ShiKaiWi ShiKaiWi changed the title fix: wrong primary when define tsid and tiemstamp key as primary key fix: wrong primary key when define tsid and timestamp key as primary key Dec 7, 2022
Copy link
Contributor

@jiacai2050 jiacai2050 left a comment

Choose a reason for hiding this comment

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

LGTM

@ShiKaiWi ShiKaiWi merged commit be10d88 into main Dec 7, 2022
@ShiKaiWi ShiKaiWi deleted the fix-define-primary-key branch December 7, 2022 07:47
chunshao90 pushed a commit to chunshao90/ceresdb that referenced this pull request May 15, 2023
…key (apache#453)

* fix: wrong primary when define tsid and tiemstamp key as primary key

* chore: add test for define primary with tsid

* chore: fix harness test

* refactor: add some comments

* fix: wrong order of the primary key columns

* chore: replace BTreeMap with HashMap for columns_by_names
This pull request was closed.
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