Source:
public ListenableFuture<?> execute(AddColumn statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getName()); Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName); if (!tableHandle.isPresent()) { throw new SemanticException(MISSING_TABLE, statement, "Table '%s' does not exist", tableName); } ConnectorId connectorId = metadata.getCatalogHandle(session, tableName.getCatalogName()) .orElseThrow(() -> new PrestoException(NOT_FOUND, "Catalog does not exist: " + tableName.getCatalogName())); accessControl.checkCanAddColumns(session.getRequiredTransactionId(), session.getIdentity(), tableName); Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle.get()); ColumnDefinition element = statement.getColumn(); Type type; try { type = metadata.getType(parseTypeSignature(element.getType())); } catch (IllegalArgumentException e) { throw new SemanticException(TYPE_MISMATCH, element, "Unknown type '%s' for column '%s'", element.getType(), element.getName()); } if (type.equals(UNKNOWN)) { throw new SemanticException(TYPE_MISMATCH, element, "Unknown type '%s' for column '%s'", element.getType(), element.getName()); } if (columnHandles.containsKey(element.getName().getValue().toLowerCase(ENGLISH))) { throw new SemanticException(COLUMN_ALREADY_EXISTS, statement, "Column '%s' already exists", element.getName()); } Map<String, Object> columnProperties; if (!element.getProperties().isEmpty()) { Map<String, Expression> sqlProperties = mapFromProperties(element.getProperties()); columnProperties = metadata.getColumnPropertyManager().getProperties( connectorId, tableName.getCatalogName(), sqlProperties, session, metadata, parameters); } else { columnProperties = Collections.emptyMap(); } ColumnMetadata column = new ColumnMetadata(element.getName().getValue(), type, element.getComment().orElse(null), null, false, columnProperties); metadata.addColumn(session, tableHandle.get(), column); return immediateFuture(null); }

Target:
public ListenableFuture<?> execute(AddColumn statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getName()); Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName); if (!tableHandle.isPresent()) { throw new SemanticException(MISSING_TABLE, statement, "Table '%s' does not exist", tableName); } ConnectorId connectorId = metadata.getCatalogHandle(session, tableName.getCatalogName()) .orElseThrow(() -> new PrestoException(NOT_FOUND, "Catalog does not exist: " + tableName.getCatalogName())); accessControl.checkCanAddColumns(session.getRequiredTransactionId(), session.getIdentity(), tableName); Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle.get()); ColumnDefinition element = statement.getColumn(); Type type; try { type = metadata.getType(parseTypeSignature(element.getType())); } catch (IllegalArgumentException e) { throw new SemanticException(TYPE_MISMATCH, element, "Unknown type '%s' for column '%s'", element.getType(), element.getName()); } if (type.equals(UNKNOWN)) { throw new SemanticException(TYPE_MISMATCH, element, "Unknown type '%s' for column '%s'", element.getType(), element.getName()); } if (columnHandles.containsKey(element.getName().getValue().toLowerCase(ENGLISH))) { throw new SemanticException(COLUMN_ALREADY_EXISTS, statement, "Column '%s' already exists", element.getName()); } Map<String, Expression> sqlProperties = mapFromProperties(element.getProperties()); Map<String, Object> columnProperties = metadata.getColumnPropertyManager().getProperties( connectorId, tableName.getCatalogName(), sqlProperties, session, metadata, parameters); ColumnMetadata column = new ColumnMetadata(element.getName().getValue(), type, element.getComment().orElse(null), null, false, columnProperties); metadata.addColumn(session, tableHandle.get(), column); return immediateFuture(null); }