Skip to content

Alter table drop not null#6342

Merged
nikvas0 merged 27 commits into
ydb-platform:mainfrom
flown4qqqq:alter-table-drop-not-null
Jul 19, 2024
Merged

Alter table drop not null#6342
nikvas0 merged 27 commits into
ydb-platform:mainfrom
flown4qqqq:alter-table-drop-not-null

Conversation

@flown4qqqq

Copy link
Copy Markdown
Collaborator

Changelog entry

Adding query 'ALTER TABLE table ALTER COLUMN column DROP NOT NULL'

Changelog category

New feature

Additional information

'ALTER TABLE table ALTER COLUMN column SET NOT NULL' in other PR (#6341)

@flown4qqqq flown4qqqq requested a review from a team as a code owner July 5, 2024 12:53
Comment thread ydb/library/yql/sql/v1/node.h Outdated
enum class ETypeOfChange {
Nothing,
SetNullConstraint,
SetFamaly

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

set family ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In set family query calls this constructor

( 2, NULL, 2 );
)sql", NYdb::NQuery::TTxControl::BeginTx().CommitTx()).ExtractValueSync();
UNIT_ASSERT_C(initNullValues.IsSuccess(), initNullValues.GetIssues().ToString());
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

я бы еще добавил тест, который может их (нулы) прочитать. записать хорошо, но еще нужно проверить что значения можно прочитать.

еще обратите пожалуйста внимание на флаг keep in cache = он должен стоять в true при выполнении запросов.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Хорошо, добавлю

@github-actions

github-actions Bot commented Jul 10, 2024

Copy link
Copy Markdown
Contributor

2024-07-10 04:09:00 UTC Pre-commit check for 817364b has started.
2024-07-10 04:11:31 UTC Build linux-x86_64-release-clang14 is running...
🟢 2024-07-10 04:20:38 UTC Build successful.

@github-actions

github-actions Bot commented Jul 10, 2024

Copy link
Copy Markdown
Contributor

2024-07-10 04:09:05 UTC Pre-commit check for 817364b has started.
2024-07-10 04:11:36 UTC Build linux-x86_64-release-asan is running...
🟢 2024-07-10 04:36:54 UTC Build successful.
2024-07-10 04:37:13 UTC Tests are running...
🔴 2024-07-10 06:36:14 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
11840 11236 0 89 337 178

🟡 2024-07-10 06:36:58 UTC ydbd size 5.2 GiB changed* by +365.3 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: ca2f330 merge: 817364b diff diff %
ydbd size 5 611 351 408 Bytes 5 611 725 432 Bytes +365.3 KiB +0.007%
ydbd stripped size 1 206 692 792 Bytes 1 206 798 680 Bytes +103.4 KiB +0.009%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions

github-actions Bot commented Jul 10, 2024

Copy link
Copy Markdown
Contributor

2024-07-10 04:09:15 UTC Pre-commit check for 817364b has started.
2024-07-10 04:11:46 UTC Build linux-x86_64-relwithdebinfo is running...
🟢 2024-07-10 04:52:10 UTC Build successful.
2024-07-10 04:52:30 UTC Tests are running...
🔴 2024-07-10 06:59:49 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
72888 59438 0 5 13428 17

🟡 2024-07-10 07:00:37 UTC ydbd size 8.1 GiB changed* by +386.4 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: ca2f330 merge: 817364b diff diff %
ydbd size 8 721 394 048 Bytes 8 721 789 672 Bytes +386.4 KiB +0.005%
ydbd stripped size 475 016 608 Bytes 475 049 856 Bytes +32.5 KiB +0.007%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

}
}

Y_UNIT_TEST(SeveralCTAS) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Something went wrong here. Maybe bad merge?


Y_UNIT_TEST(AlterTable_DropNotNull_WithSetFamily_Valid) {
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableTableServiceConfig()->SetEnableOlapSink(false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you don't need these flags here

Comment thread ydb/library/yql/sql/v1/sql_query.cpp Outdated
break;
}
case TRule_alter_table_action::kAltAlterTableAction17: {
// ALTER COLUMN id SET (NOT NULL | NULL)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

wrong comment?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it will be fixed

@github-actions

github-actions Bot commented Jul 10, 2024

Copy link
Copy Markdown
Contributor

2024-07-10 12:33:07 UTC Pre-commit check for 88f5565 has started.
2024-07-10 12:35:44 UTC Build linux-x86_64-release-asan is running...
🟢 2024-07-10 12:59:34 UTC Build successful.
2024-07-10 12:59:45 UTC Tests are running...
🔴 2024-07-10 14:57:59 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
11853 11240 0 94 341 178

🟡 2024-07-10 14:58:50 UTC ydbd size 5.2 GiB changed* by +372.6 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 483e9ee merge: 88f5565 diff diff %
ydbd size 5 611 370 560 Bytes 5 611 752 088 Bytes +372.6 KiB +0.007%
ydbd stripped size 1 206 696 760 Bytes 1 206 806 840 Bytes +107.5 KiB +0.009%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions

github-actions Bot commented Jul 10, 2024

Copy link
Copy Markdown
Contributor

2024-07-10 12:41:27 UTC Pre-commit check for 88f5565 has started.
2024-07-10 12:44:04 UTC Build linux-x86_64-relwithdebinfo is running...
🟢 2024-07-10 13:23:58 UTC Build successful.
2024-07-10 13:24:08 UTC Tests are running...
🔴 2024-07-10 15:35:25 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
72900 59452 0 3 13429 16

🟡 2024-07-10 15:36:12 UTC ydbd size 8.1 GiB changed* by +361.7 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: d32d5d0 merge: 88f5565 diff diff %
ydbd size 8 721 401 176 Bytes 8 721 771 576 Bytes +361.7 KiB +0.004%
ydbd stripped size 475 017 568 Bytes 475 051 008 Bytes +32.7 KiB +0.007%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions

github-actions Bot commented Jul 10, 2024

Copy link
Copy Markdown
Contributor

2024-07-10 12:42:19 UTC Pre-commit check for 88f5565 has started.
2024-07-10 12:45:03 UTC Build linux-x86_64-release-clang14 is running...
🟢 2024-07-10 12:57:38 UTC Build successful.

nikvas0
nikvas0 previously approved these changes Jul 15, 2024
alter_table_add_column: ADD COLUMN? column_schema;
alter_table_drop_column: DROP COLUMN? an_id;
alter_table_alter_column: ALTER COLUMN an_id SET family_relation;
alter_table_alter_column_drop_not_null: ALTER COLUMN an_id DROP NOT NULL;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

нужны тесты в v1/sql_format/ut на эту часть грамматики

@github-actions

github-actions Bot commented Jul 16, 2024

Copy link
Copy Markdown
Contributor

2024-07-16 13:35:32 UTC Pre-commit check for 9c3e241 has started.
2024-07-16 13:38:10 UTC Build+Tests linux-x86_64-release-asan is running...
🟢 2024-07-16 15:43:22 UTC Build successful.
🔴 2024-07-16 15:45:30 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
11553 10966 0 81 330 176

🟡 2024-07-16 15:46:11 UTC ydbd size 5.2 GiB changed* by +570.3 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: a037131 merge: 9c3e241 diff diff %
ydbd size 5 549 082 616 Bytes 5 549 666 608 Bytes +570.3 KiB +0.011%
ydbd stripped size 1 194 978 736 Bytes 1 195 111 856 Bytes +130.0 KiB +0.011%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions

github-actions Bot commented Jul 16, 2024

Copy link
Copy Markdown
Contributor

2024-07-16 13:35:39 UTC Pre-commit check for 9c3e241 has started.
2024-07-16 13:38:25 UTC Build+Tests linux-x86_64-release-clang14 is running...
🟢 2024-07-16 13:46:08 UTC Build successful.

@github-actions

github-actions Bot commented Jul 16, 2024

Copy link
Copy Markdown
Contributor

2024-07-16 13:35:54 UTC Pre-commit check for 9c3e241 has started.
2024-07-16 13:38:38 UTC Build+Tests linux-x86_64-relwithdebinfo is running...
🟢 2024-07-16 15:53:54 UTC Build successful.
🔴 2024-07-16 16:05:28 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
72602 59148 0 5 13431 18

🟡 2024-07-16 16:06:11 UTC ydbd size 8.0 GiB changed* by +400.7 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: a037131 merge: 9c3e241 diff diff %
ydbd size 8 642 916 472 Bytes 8 643 326 824 Bytes +400.7 KiB +0.005%
ydbd stripped size 470 538 624 Bytes 470 574 432 Bytes +35.0 KiB +0.008%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Igor Koshkaryov added 2 commits July 17, 2024 18:11
@github-actions

github-actions Bot commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

2024-07-17 15:18:35 UTC Pre-commit check for 62c188e has started.
2024-07-17 15:24:22 UTC Build+Tests linux-x86_64-release-clang14 is running...
🟢 2024-07-17 15:31:38 UTC Build successful.

@github-actions

github-actions Bot commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

2024-07-17 15:18:47 UTC Pre-commit check for 62c188e has started.
2024-07-17 15:24:40 UTC Build+Tests linux-x86_64-release-asan is running...
🟢 2024-07-17 17:24:28 UTC Build successful.
🔴 2024-07-17 17:28:29 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
11557 10968 0 82 334 173

🟡 2024-07-17 17:29:20 UTC ydbd size 5.2 GiB changed* by +533.6 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 90eea8d merge: 62c188e diff diff %
ydbd size 5 546 465 168 Bytes 5 547 011 608 Bytes +533.6 KiB +0.010%
ydbd stripped size 1 195 221 168 Bytes 1 195 337 744 Bytes +113.8 KiB +0.010%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions

github-actions Bot commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

2024-07-17 15:19:00 UTC Pre-commit check for 62c188e has started.
2024-07-17 15:21:47 UTC Build+Tests linux-x86_64-relwithdebinfo is running...
🟢 2024-07-17 17:29:57 UTC Build successful.
🔴 2024-07-17 17:39:18 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
72603 59150 0 9 13430 14

🟡 2024-07-17 17:40:01 UTC ydbd size 8.0 GiB changed* by +366.7 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 90eea8d merge: 62c188e diff diff %
ydbd size 8 641 941 496 Bytes 8 642 317 040 Bytes +366.7 KiB +0.004%
ydbd stripped size 470 498 400 Bytes 470 536 256 Bytes +37.0 KiB +0.008%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions

github-actions Bot commented Jul 18, 2024

Copy link
Copy Markdown
Contributor

2024-07-18 10:52:40 UTC Pre-commit check for 286e310 has started.
2024-07-18 10:55:18 UTC Build+Tests linux-x86_64-release-asan is running...
🟢 2024-07-18 12:53:10 UTC Build successful.
🔴 2024-07-18 12:56:43 UTC Some tests failed, follow the links below.

Test history | Ya make output

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
11560 10972 0 79 336 173

🟡 2024-07-18 12:57:35 UTC ydbd size 5.2 GiB changed* by +537.3 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 302e204 merge: 286e310 diff diff %
ydbd size 5 546 914 912 Bytes 5 547 465 144 Bytes +537.3 KiB +0.010%
ydbd stripped size 1 195 315 792 Bytes 1 195 436 592 Bytes +118.0 KiB +0.010%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions

github-actions Bot commented Jul 18, 2024

Copy link
Copy Markdown
Contributor

2024-07-18 10:54:51 UTC Pre-commit check for 286e310 has started.
2024-07-18 10:57:34 UTC Build+Tests linux-x86_64-release-clang14 is running...
🟢 2024-07-18 11:28:09 UTC Build successful.

@github-actions

github-actions Bot commented Jul 18, 2024

Copy link
Copy Markdown
Contributor

2024-07-18 10:55:07 UTC Pre-commit check for 286e310 has started.
2024-07-18 10:57:54 UTC Build+Tests linux-x86_64-relwithdebinfo is running...
🟢 2024-07-18 13:10:43 UTC Build successful.
🔴 2024-07-18 13:18:40 UTC Some tests failed, follow the links below.

Test history | Ya make output

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
72602 59154 0 5 13430 13

🟡 2024-07-18 13:19:26 UTC ydbd size 8.0 GiB changed* by +364.3 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 302e204 merge: 286e310 diff diff %
ydbd size 8 642 536 216 Bytes 8 642 909 288 Bytes +364.3 KiB +0.004%
ydbd stripped size 470 525 536 Bytes 470 563 200 Bytes +36.8 KiB +0.008%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@galnat

galnat commented May 21, 2025

Copy link
Copy Markdown
Collaborator

@flown4qqqq добавьте описание этой фичи в документацию
https://ydb.tech/docs/en/yql/reference/syntax/alter_table/columns?version=v25.1

robot-piglet pushed a commit that referenced this pull request Jul 21, 2025
Когда-то давно (когда еще YQL жил в github) была поставлена задача - поддержать SET/DROP NOT NULL на колонку. DROP NOT NULL был сделан и давно уже существует в main: <#6342>.

Однако с SET NOT NULL возникли определенные сложности, поэтому был сделан отдельный пулл реквест: <#6341>. Как видно, ПР так и не вмержили по причине увольнения автора кода. Недавно задача всплыла вновь, поэтому надо доделать.

В этом пулл реквесте добавляется код в грамматику YQL новое выражение - `ALTER TABLE t ALTER COLUMN c SET NOT NULL`, которая добавляет ограничение `NOT NULL` на колонку.
commit_hash:f310061b13666418c46309ea32032fbce68fb865
robot-piglet pushed a commit to ytsaurus/ytsaurus that referenced this pull request Jul 21, 2025
Когда-то давно (когда еще YQL жил в github) была поставлена задача - поддержать SET/DROP NOT NULL на колонку. DROP NOT NULL был сделан и давно уже существует в main: <ydb-platform/ydb#6342>.

Однако с SET NOT NULL возникли определенные сложности, поэтому был сделан отдельный пулл реквест: <ydb-platform/ydb#6341>. Как видно, ПР так и не вмержили по причине увольнения автора кода. Недавно задача всплыла вновь, поэтому надо доделать.

В этом пулл реквесте добавляется код в грамматику YQL новое выражение - `ALTER TABLE t ALTER COLUMN c SET NOT NULL`, которая добавляет ограничение `NOT NULL` на колонку.
commit_hash:f310061b13666418c46309ea32032fbce68fb865
robot-piglet pushed a commit to ytsaurus/ytsaurus that referenced this pull request Jul 21, 2025
Когда-то давно (когда еще YQL жил в github) была поставлена задача - поддержать SET/DROP NOT NULL на колонку. DROP NOT NULL был сделан и давно уже существует в main: <ydb-platform/ydb#6342>.

Однако с SET NOT NULL возникли определенные сложности, поэтому был сделан отдельный пулл реквест: <ydb-platform/ydb#6341>. Как видно, ПР так и не вмержили по причине увольнения автора кода. Недавно задача всплыла вновь, поэтому надо доделать.

В этом пулл реквесте добавляется код в грамматику YQL новое выражение - `ALTER TABLE t ALTER COLUMN c SET NOT NULL`, которая добавляет ограничение `NOT NULL` на колонку.
commit_hash:f310061b13666418c46309ea32032fbce68fb865
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.

5 participants