/** * Replace the column 'from' with 'to' in this materialized view definition's partition, * clustering, or included columns. * @param from the existing column * @param to the new column */ public void renameColumn(ColumnIdentifier from, ColumnIdentifier to) { metadata.renameColumn(from, to); // convert whereClause to Relations, rename ids in Relations, then convert back to whereClause List<Relation> relations = whereClauseToRelations(whereClause); ColumnDefinition.Raw fromRaw = ColumnDefinition.Raw.forQuoted(from.toString()); ColumnDefinition.Raw toRaw = ColumnDefinition.Raw.forQuoted(to.toString()); List<Relation> newRelations = relations.stream() .map(r -> r.renameIdentifier(fromRaw, toRaw)) .collect(Collectors.toList()); this.whereClause = View.relationsToWhereClause(newRelations); String rawSelect = View.buildSelectStatement(baseTableName, metadata.allColumns(), whereClause); this.select = (SelectStatement.RawStatement) QueryProcessor.parseStatement(rawSelect); }
/** * Replace the column 'from' with 'to' in this materialized view definition's partition, * clustering, or included columns. * @param from the existing column * @param to the new column */ public void renameColumn(ColumnIdentifier from, ColumnIdentifier to) { metadata.renameColumn(from, to); // convert whereClause to Relations, rename ids in Relations, then convert back to whereClause List<Relation> relations = whereClauseToRelations(whereClause); ColumnDefinition.Raw fromRaw = ColumnDefinition.Raw.forQuoted(from.toString()); ColumnDefinition.Raw toRaw = ColumnDefinition.Raw.forQuoted(to.toString()); List<Relation> newRelations = relations.stream() .map(r -> r.renameIdentifier(fromRaw, toRaw)) .collect(Collectors.toList()); this.whereClause = View.relationsToWhereClause(newRelations); String rawSelect = View.buildSelectStatement(baseTableName, metadata.allColumns(), whereClause); this.select = (SelectStatement.RawStatement) QueryProcessor.parseStatement(rawSelect); }
/** * Replace the column 'from' with 'to' in this materialized view definition's partition, * clustering, or included columns. * @param from the existing column * @param to the new column */ public void renameColumn(ColumnIdentifier from, ColumnIdentifier to) { metadata.renameColumn(from, to); // convert whereClause to Relations, rename ids in Relations, then convert back to whereClause List<Relation> relations = whereClauseToRelations(whereClause); ColumnDefinition.Raw fromRaw = ColumnDefinition.Raw.forQuoted(from.toString()); ColumnDefinition.Raw toRaw = ColumnDefinition.Raw.forQuoted(to.toString()); List<Relation> newRelations = relations.stream() .map(r -> r.renameIdentifier(fromRaw, toRaw)) .collect(Collectors.toList()); this.whereClause = View.relationsToWhereClause(newRelations); String rawSelect = View.buildSelectStatement(baseTableName, metadata.allColumns(), whereClause); this.select = (SelectStatement.RawStatement) QueryProcessor.parseStatement(rawSelect); }
id = ColumnDefinition.Raw.forQuoted((t!=null?t.getText():null));
id = ColumnDefinition.Raw.forQuoted((t!=null?t.getText():null));
id = ColumnDefinition.Raw.forQuoted((t!=null?t.getText():null));