vincentpoon commented on a change in pull request #462: PHOENIX-2787 support IF
EXISTS for ALTER TABLE SET options
URL: https://github.com/apache/phoenix/pull/462#discussion_r264485834
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
##########
@@ -3514,13 +3515,15 @@ private void mutateStringProperty(String tenantId,
String schemaName, String tab
public MutationState addColumn(AddColumnStatement statement) throws
SQLException {
PTable table = FromCompiler.getResolver(statement,
connection).getTables().get(0).getTable();
- return addColumn(table, statement.getColumnDefs(),
statement.getProps(), statement.ifNotExists(), false, statement.getTable(),
statement.getTableType());
+ return addColumn(table, statement.getColumnDefs(),
statement.getProps(),
+ statement.ifNotExists(), false, statement.getTable(),
statement.getTableType(),
+ statement.ifSetOptionExists());
}
public MutationState addColumn(PTable table, List<ColumnDef>
origColumnDefs,
ListMultimap<String, Pair<String, Object>> stmtProperties, boolean
ifNotExists,
- boolean removeTableProps, NamedTableNode namedTableNode,
PTableType tableType)
- throws SQLException {
+ boolean removeTableProps, NamedTableNode namedTableNode,
PTableType tableType,
+ boolean ifSetOptionExist) throws
SQLException {
Review comment:
looks like you created the `ifSetOptionsExist` boolean and passed it all the
way down to here, but never use it?
The overall structure feels wrong. This shouldn't be something specific to
SetOption. It should apply to any "ALTER TABLE" command, including ADD/DROP
column. I think "ALTER TABLE IF EXISTS DROP COLUMN IF EXISTS" should be a
valid command. This is what PostgreSQL does:
https://www.postgresql.org/docs/9.2/sql-altertable.html
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services