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: drop column for alter table #562

Merged
merged 5 commits into from
Nov 17, 2022

Conversation

killme2008
Copy link
Contributor

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Try to fix #466, which supports alter table drop column [name]:

mysql> create table test(host STRING, ts timestamp, time index(ts));
Query OK, 1 row affected (0.03 sec)

mysql> insert into test values('a', 1);
Query OK, 1 row affected (0.03 sec)

mysql> insert into test values('b', 2);
Query OK, 1 row affected (0.04 sec)

mysql> select * from test;
+------+---------------------+
| host | ts                  |
+------+---------------------+
| a    | 1970-01-01 00:00:00 |
| b    | 1970-01-01 00:00:00 |
+------+---------------------+
2 rows in set (0.01 sec)
mysql> alter table test drop column host;
Query OK, 0 rows affected (0.03 sec)

mysql> select * from test;
+---------------------+
| ts                  |
+---------------------+
| 1970-01-01 00:00:00 |
| 1970-01-01 00:00:00 |
+---------------------+
2 rows in set (0.01 sec)

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@killme2008 killme2008 marked this pull request as ready for review November 17, 2022 13:32
@killme2008 killme2008 changed the title Fix/alter table in other db feat: drop column for alter table Nov 17, 2022
@codecov
Copy link

codecov bot commented Nov 17, 2022

Codecov Report

Merging #562 (bb03581) into develop (8faa6b0) will decrease coverage by 0.03%.
The diff coverage is 67.79%.

@@             Coverage Diff             @@
##           develop     #562      +/-   ##
===========================================
- Coverage    86.38%   86.35%   -0.04%     
===========================================
  Files          398      398              
  Lines        50042    50165     +123     
===========================================
+ Hits         43229    43320      +91     
- Misses        6813     6845      +32     
Flag Coverage Δ
rust 86.35% <67.79%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/datanode/src/server/grpc/ddl.rs 88.81% <0.00%> (-3.57%) ⬇️
src/sql/src/statements/alter.rs 31.57% <0.00%> (-3.72%) ⬇️
src/table/src/requests.rs 25.00% <ø> (ø)
src/sql/src/parsers/alter_parser.rs 87.83% <90.62%> (+4.11%) ⬆️
src/datanode/src/sql/alter.rs 90.90% <100.00%> (+0.36%) ⬆️
src/mito/src/engine.rs 97.35% <100.00%> (ø)
src/mito/src/table.rs 88.57% <100.00%> (ø)
src/table/src/metadata.rs 96.30% <100.00%> (ø)
src/servers/src/mysql/handler.rs 64.13% <0.00%> (-1.09%) ⬇️
src/frontend/src/table.rs 91.72% <0.00%> (-1.07%) ⬇️
... and 9 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

src/sql/src/parsers/alter_parser.rs Outdated Show resolved Hide resolved
killme2008 and others added 2 commits November 17, 2022 22:10
Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
Copy link
Contributor

@v0y4g3r v0y4g3r left a comment

Choose a reason for hiding this comment

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

LGTM

@v0y4g3r v0y4g3r merged commit f878827 into GreptimeTeam:develop Nov 17, 2022
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* feat: drop column for alter table

* refactor: rename RemoveColumns to DropColumns

* test: alter table

* chore: error msg

Co-authored-by: Ruihang Xia <waynestxia@gmail.com>

* fix: test_parse_alter_drop_column

Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
@killme2008 killme2008 deleted the fix/alter-table-in-other-db branch January 16, 2024 09:42
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.

Supports dropping column in alter table statement
3 participants