-
Notifications
You must be signed in to change notification settings - Fork 104
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
Support alter for rel groups #4764
Conversation
src/catalog/catalog_set.cpp
Outdated
void CatalogSet::alterEntry(Transaction* transaction, const binder::BoundAlterInfo& alterInfo) { | ||
void CatalogSet::alterRelGroupEntry(Transaction* transaction, | ||
const binder::BoundAlterInfo& alterInfo) { | ||
CatalogEntry* entry = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good amount of this is duplicated with alterTableEntry
it might be good to refactor out some of the duplicate logic
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4764 +/- ##
==========================================
- Coverage 86.32% 86.29% -0.03%
==========================================
Files 1397 1397
Lines 59840 60003 +163
Branches 7377 7390 +13
==========================================
+ Hits 51656 51779 +123
- Misses 8017 8057 +40
Partials 167 167 ☔ View full report in Codecov by Sentry. |
KU_ASSERT(tableAlterInfo.tableName.starts_with(relGroupEntry->getName())); | ||
// table name is in format {rel_group_name}{suffix} | ||
// rename to {new_rel_group_name}{suffix} | ||
auto& renameInfo = tableAlterInfo.extraInfo->cast<BoundExtraRenameTableInfo>(); | ||
auto tableNameSuffix = tableEntry->getName().substr(relGroupEntry->getName().size()); | ||
renameInfo.newName.append(tableNameSuffix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want renaming rel group to also rename the child tables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. I guess it's better to also rename children tables so that the naming convention if preserved after ALTER
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also rename the child tables to maintain consistency. Later, we might consider removing table names from the Catalog entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM.
@ray6080 should check if the new record can be omitted and if we need to store alterInfo in TableCatalogEntry.
KU_ASSERT(tableAlterInfo.tableName.starts_with(relGroupEntry->getName())); | ||
// table name is in format {rel_group_name}{suffix} | ||
// rename to {new_rel_group_name}{suffix} | ||
auto& renameInfo = tableAlterInfo.extraInfo->cast<BoundExtraRenameTableInfo>(); | ||
auto tableNameSuffix = tableEntry->getName().substr(relGroupEntry->getName().size()); | ||
renameInfo.newName.append(tableNameSuffix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. I guess it's better to also rename children tables so that the naming convention if preserved after ALTER
const auto* tableEntry = catalog->getTableCatalogEntry(transaction, tableID); | ||
BoundAlterInfo tableAlterInfo = info.copy(); | ||
tableAlterInfo.tableName = tableEntry->getName(); | ||
if (tableAlterInfo.alterType == common::AlterType::RENAME_TABLE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's better to do this in bind_ddl.cpp?
70f3248
to
351e37b
Compare
6d09d27
to
9a5eaf1
Compare
Benchmark ResultMaster commit hash:
|
67cf682
to
0e8cb68
Compare
Benchmark ResultMaster commit hash:
|
@@ -278,7 +278,9 @@ class Binder { | |||
const BoundProjectionBody& boundProjectionBody); | |||
static bool isOrderByKeyTypeSupported(const common::LogicalType& dataType); | |||
|
|||
void validateTableExist(const std::string& tableName) const; | |||
void validateTableExists(const std::string& name) const; | |||
void validateNoIndexOnProperty(const std::string& tableName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two can be hide in bind_ddl.cpp right?
Description
ALTER
on rel groups, propagating the changes to the child tablesTODOs:
rollback.test
)Fixed #4762 as well.
Contributor agreement