Skip to content

Add Analyzer support for DROP COLUMN#14530

Merged
mergify[bot] merged 1 commit intodrop-columnfrom
mt/dropcol-analysis
Aug 3, 2023
Merged

Add Analyzer support for DROP COLUMN#14530
mergify[bot] merged 1 commit intodrop-columnfrom
mt/dropcol-analysis

Conversation

@matriv
Copy link
Contributor

@matriv matriv commented Aug 3, 2023

No description provided.

@Override
public Void visitAlterTableDropColumn(AnalyzedAlterTableDropColumn analysis,
User user) {
Privileges.ensureUserHasPrivilege(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will introduce a AccessControlMayExecute similar to AccessControlMaySeeTest on master, and then add test for drop column later on.

@crate crate deleted a comment from mergify bot Aug 3, 2023
Copy link
Contributor

@BaurzhanSakhariev BaurzhanSakhariev left a comment

Choose a reason for hiding this comment

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

Thanks! Added a comment about another one edge case.

@matriv matriv force-pushed the mt/dropcol-analysis branch from 2167e44 to 07c4ae8 Compare August 3, 2023 12:43
@matriv matriv added ready-to-merge Let Mergify merge the PR once approved and checks pass and removed ready-to-merge Let Mergify merge the PR once approved and checks pass labels Aug 3, 2023
@matriv matriv force-pushed the mt/dropcol-analysis branch from 07c4ae8 to ef39984 Compare August 3, 2023 12:46
@matriv matriv added the ready-to-merge Let Mergify merge the PR once approved and checks pass label Aug 3, 2023
@BaurzhanSakhariev BaurzhanSakhariev removed the ready-to-merge Let Mergify merge the PR once approved and checks pass label Aug 3, 2023
@matriv matriv force-pushed the mt/dropcol-analysis branch from ef39984 to d1aaa7c Compare August 3, 2023 13:29
@matriv
Copy link
Contributor Author

matriv commented Aug 3, 2023

retest this please

@matriv matriv added the ready-to-merge Let Mergify merge the PR once approved and checks pass label Aug 3, 2023
@mergify mergify bot merged commit 102309a into drop-column Aug 3, 2023
@mergify mergify bot deleted the mt/dropcol-analysis branch August 3, 2023 15:11
return new AnalyzedAlterTableAddColumn(table, columns, checks);
}

public AnalyzedAlterTableDropColumn analyze(AlterTableDropColumn<Expression> alterTable) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd move this to AlterTableDropColumnAnalyzer. The TableElementsAnalyzer is intended for new columns. If the columns exist we can use a regular ExpressionAnalyzer with TableReferenceResolver.

Given that the drop column statement also doesn't take any parameters we can resolve Reference directly in the analyze phase, and don't have to bind/eval at all.

The dispatching via a visitor is also not necessary as the DropColumnDefinition contains all info and has no further derived classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx! I chose to follow the new code to be consistent but you're right it's completely unnecessary, opened PR to simplify: #14547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Let Mergify merge the PR once approved and checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants