Source:
private List<Symbol> symbolsFromTargetColumnPositionOrGeneratedExpression(Map<ColumnIdent, Integer> targetColumnMap, List<Reference> targetColumns, List<ColumnIdent> columns, Map<ColumnIdent, GeneratedReference> generatedColumns, Map<ColumnIdent, Reference> defaultExpressionColumns, boolean alwaysRequireColumn) { if (columns.isEmpty()) { return Collections.emptyList(); } List<Symbol> symbols = new ArrayList<>(columns.size()); InputColumns.SourceSymbols sourceSymbols = new InputColumns.SourceSymbols(targetColumns); for (ColumnIdent column : columns) { Integer position = targetColumnMap.get(column); if (position == null) { final Symbol symbol; Reference reference = defaultExpressionColumns.get(column); if (reference != null) { symbol = InputColumns.create( requireNonNull(reference.defaultExpression()), sourceSymbols); } else { GeneratedReference generatedRef = generatedColumns.get(column); if (generatedRef == null) { Reference columnRef = requireNonNull(targetTable.getReference(column), "Column " + column + " must exist in table " + targetTable.ident()); symbol = InputColumns.create(columnRef, sourceSymbols); } else { symbol = InputColumns.create(generatedRef.generatedExpression(), sourceSymbols); } } if (SymbolVisitors.any(Symbols.IS_COLUMN, symbol)) { if (alwaysRequireColumn) { throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Column \"%s\" is required but is missing from the insert statement", column.sqlFqn())); } else { symbols.add(Literal.NULL); } } else { symbols.add(symbol); } } else { symbols.add(new InputColumn(position, targetColumns.get(position).valueType())); } } return symbols; }

Target:
private List<Symbol> symbolsFromTargetColumnPositionOrGeneratedExpression(Map<ColumnIdent, Integer> targetColumnMap, List<Reference> targetColumns, List<ColumnIdent> columns, Map<ColumnIdent, GeneratedReference> generatedColumns, Map<ColumnIdent, Reference> defaultExpressionColumns, boolean alwaysRequireColumn) { if (columns.isEmpty()) { return Collections.emptyList(); } List<Symbol> symbols = new ArrayList<>(columns.size()); InputColumns.SourceSymbols sourceSymbols = new InputColumns.SourceSymbols(targetColumns); for (ColumnIdent column : columns) { Integer position = targetColumnMap.get(column); if (position == null) { final Symbol symbol; Reference reference = defaultExpressionColumns.get(column); if (reference != null) { symbol = InputColumns.create( requireNonNull( reference.defaultExpression(), "Column " + column + " must contain a default expression"), sourceSymbols); } else { GeneratedReference generatedRef = generatedColumns.get(column); if (generatedRef == null) { Reference columnRef = requireNonNull(targetTable.getReference(column), "Column " + column + " must exist in table " + targetTable.ident()); symbol = InputColumns.create(columnRef, sourceSymbols); } else { symbol = InputColumns.create(generatedRef.generatedExpression(), sourceSymbols); } } if (SymbolVisitors.any(Symbols.IS_COLUMN, symbol)) { if (alwaysRequireColumn) { throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Column \"%s\" is required but is missing from the insert statement", column.sqlFqn())); } else { symbols.add(Literal.NULL); } } else { symbols.add(symbol); } } else { symbols.add(new InputColumn(position, targetColumns.get(position).valueType())); } } return symbols; }