Source:
AnalyzedInsertStatement(AnalyzedRelation subQueryRelation, DocTableInfo tableInfo, List<Reference> targetColumns, boolean ignoreDuplicateKeys, Map<Reference, Symbol> onDuplicateKeyAssignments, List<ColumnIdent> outputNames, List<Symbol> returnValues) { this.targetTable = tableInfo; this.subQueryRelation = subQueryRelation; this.ignoreDuplicateKeys = ignoreDuplicateKeys; this.onDuplicateKeyAssignments = onDuplicateKeyAssignments; this.targetColumns = targetColumns; Map<ColumnIdent, Integer> columnPositions = toPositionMap(targetColumns); int clusteredByIdx = MoreObjects.firstNonNull(columnPositions.get(tableInfo.clusteredBy()), -1); if (clusteredByIdx > -1) { clusteredBySymbol = new InputColumn(clusteredByIdx, targetColumns.get(clusteredByIdx).valueType()); } else { clusteredBySymbol = null; } ImmutableMap<ColumnIdent, GeneratedReference> generatedColumns = Maps.uniqueIndex(tableInfo.generatedColumns(), Reference::column); ImmutableMap<ColumnIdent, Reference> defaultExpressionColumns = Maps.uniqueIndex(tableInfo.defaultExpressionColumns(), Reference::column); if (tableInfo.hasAutoGeneratedPrimaryKey()) { this.primaryKeySymbols = Collections.emptyList(); } else { this.primaryKeySymbols = symbolsFromTargetColumnPositionOrGeneratedExpression( columnPositions, targetColumns, tableInfo.primaryKey(), generatedColumns, defaultExpressionColumns, true); } this.partitionedBySymbols = symbolsFromTargetColumnPositionOrGeneratedExpression( columnPositions, targetColumns, tableInfo.partitionedBy(), generatedColumns, defaultExpressionColumns, false); this.returnValues = returnValues; if (!outputNames.isEmpty() && !returnValues.isEmpty()) { this.fields = new ArrayList<>(outputNames.size()); Iterator<Symbol> outputsIterator = returnValues.iterator(); for (ColumnIdent path : outputNames) { fields.add(new Field(new TableRelation(tableInfo), path, outputsIterator.next())); } } else { fields = null; } }

Target:
AnalyzedInsertStatement(AnalyzedRelation subQueryRelation, DocTableInfo tableInfo, List<Reference> targetColumns, boolean ignoreDuplicateKeys, Map<Reference, Symbol> onDuplicateKeyAssignments, List<ColumnIdent> outputNames, List<Symbol> returnValues) { this.targetTable = tableInfo; this.subQueryRelation = subQueryRelation; this.ignoreDuplicateKeys = ignoreDuplicateKeys; this.onDuplicateKeyAssignments = onDuplicateKeyAssignments; this.targetColumns = targetColumns; Map<ColumnIdent, Integer> columnPositions = toPositionMap(targetColumns); int clusteredByIdx = MoreObjects.firstNonNull(columnPositions.get(tableInfo.clusteredBy()), -1); if (clusteredByIdx > -1) { clusteredBySymbol = new InputColumn(clusteredByIdx, targetColumns.get(clusteredByIdx).valueType()); } else { clusteredBySymbol = null; } ImmutableMap<ColumnIdent, GeneratedReference> generatedColumns = Maps.uniqueIndex(tableInfo.generatedColumns(), Reference::column); ImmutableMap<ColumnIdent, Reference> defaultExpressionColumns = Maps.uniqueIndex(tableInfo.defaultExpressionColumns(), Reference::column); if (tableInfo.hasAutoGeneratedPrimaryKey()) { this.primaryKeySymbols = Collections.emptyList(); } else { this.primaryKeySymbols = symbolsFromTargetColumnPositionOrGeneratedExpression( columnPositions, targetColumns, tableInfo.primaryKey(), generatedColumns, defaultExpressionColumns, true); } this.partitionedBySymbols = symbolsFromTargetColumnPositionOrGeneratedExpression( columnPositions, targetColumns, tableInfo.partitionedBy(), generatedColumns, defaultExpressionColumns, false); this.returnValues = returnValues; if (!outputNames.isEmpty() && !returnValues.isEmpty()) { this.fields = new ArrayList<>(outputNames.size()); Iterator<Symbol> outputsIterator = returnValues.iterator(); for (ColumnIdent path : outputNames) { fields.add(new Field(this.subQueryRelation, path, outputsIterator.next())); } } else { fields = null; } }