zstan commented on a change in pull request #484: URL: https://github.com/apache/ignite-3/pull/484#discussion_r764578403
########## File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/ddl/DdlSqlToCommandConverter.java ########## @@ -209,6 +210,68 @@ private CreateTableCommand convertCreateTable(IgniteSqlCreateTable createTblNode return createTblCmd; } + /** + * Converts a given IgniteSqlAlterTableAddColumn AST to a AlterTableAddCommand. + * + * @param alterTblNode Root node of the given AST. + * @param ctx Planning context. + */ + private AlterTableAddCommand convertAlterTableAdd(IgniteSqlAlterTableAddColumn alterTblNode, PlanningContext ctx) { + AlterTableAddCommand alterTblCmd = new AlterTableAddCommand(); + + alterTblCmd.schemaName(deriveSchemaName(alterTblNode.name(), ctx)); + alterTblCmd.tableName(deriveObjectName(alterTblNode.name(), ctx, "table name")); + alterTblCmd.ifTableExists(alterTblNode.ifExists()); + alterTblCmd.ifColumnNotExists(alterTblNode.ifNotExistsColumn()); + + IgniteTypeFactory typeFactory = ctx.typeFactory(); + + Set<ColumnDefinition> cols = new HashSet<>(alterTblNode.columns().size()); + + for (SqlNode colNode : alterTblNode.columns()) { + assert colNode instanceof SqlColumnDeclaration : colNode.getClass(); + + SqlColumnDeclaration col = (SqlColumnDeclaration) colNode; + + assert col.name.isSimple(); + assert col.expression == null : "Unexpected column default value" + col.expression; + + String name = col.name.getSimple(); + RelDataType type = ctx.planner().convert(col.dataType); + + ColumnDefinitionBuilder col0 = SchemaBuilders.column(name, typeFactory.columnType(type)) Review comment: the same as above -- 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. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org