Code review comment: I add more uts to cover other operators. I found no problems

Code before review:
public OptExpression visitLogicalTableScan(OptExpression optExpression, Void context) {
LogicalScanOperator scanOperator = optExpression.getOp().cast();
Projection projection = scanOperator.getProjection();
if (projection != null) {
projection.getColumnRefMap().values().forEach(s -> requiredOutputColumns.union(s.getUsedColumns()));
}
Set<ColumnRefOperator> outputColumns =
scanOperator.getColRefToColumnMetaMap().keySet().stream().filter(requiredOutputColumns::contains)
.collect(Collectors.toSet());
outputColumns.addAll(Utils.extractColumnRef(scanOperator.getPredicate()));
if (outputColumns.isEmpty()) {
outputColumns.add(
Utils.findSmallestColumnRefFromTable(scanOperator.getColRefToColumnMetaMap(), scanOperator.getTable()));
}
ImmutableMap.Builder<ColumnRefOperator, Column> columnRefColumnMapBuilder = new ImmutableMap.Builder<>();
scanOperator.getColRefToColumnMetaMap().keySet().stream()
.filter(outputColumns::contains)
.forEach(key -> columnRefColumnMapBuilder.put(key, scanOperator.getColRefToColumnMetaMap().get(key)));
ImmutableMap<ColumnRefOperator, Column> newColumnRefMap = columnRefColumnMapBuilder.build();
if (newColumnRefMap.size() != scanOperator.getColRefToColumnMetaMap().size()) {
Operator.Builder builder = OperatorBuilderFactory.build(scanOperator);
builder.withOperator(scanOperator);
LogicalScanOperator.Builder scanBuilder = (LogicalScanOperator.Builder) builder;
scanBuilder.setColRefToColumnMetaMap(newColumnRefMap);
ColumnRefSet outputRefSet = new ColumnRefSet(outputColumns);
outputRefSet.except(requiredOutputColumns);
if (!outputRefSet.isEmpty() && projection == null) {
Map<ColumnRefOperator, ScalarOperator> projectionMap = Maps.newHashMap();
for (ColumnRefOperator columnRefOperator : outputColumns) {
if (outputRefSet.contains(columnRefOperator)) {
continue;
}
projectionMap.put(columnRefOperator, columnRefOperator);
}
Projection newProjection = new Projection(projectionMap);
builder.setProjection(newProjection);
}
Operator newQueryOp = builder.build();
return OptExpression.create(newQueryOp);
} else {
return optExpression;
}
}

Line under review: }

Code after addressing the review:
public OptExpression visitLogicalTableScan(OptExpression optExpression, Void context) {
LogicalScanOperator scanOperator = optExpression.getOp().cast();
Projection projection = scanOperator.getProjection();
if (projection != null) {
projection.getColumnRefMap().values().forEach(s -> requiredOutputColumns.union(s.getUsedColumns()));
}
Set<ColumnRefOperator> outputColumns =
scanOperator.getColRefToColumnMetaMap().keySet().stream().filter(requiredOutputColumns::contains)
.collect(Collectors.toSet());
outputColumns.addAll(Utils.extractColumnRef(scanOperator.getPredicate()));
if (outputColumns.isEmpty()) {
outputColumns.add(
Utils.findSmallestColumnRefFromTable(scanOperator.getColRefToColumnMetaMap(), scanOperator.getTable()));
}
ImmutableMap.Builder<ColumnRefOperator, Column> columnRefColumnMapBuilder = new ImmutableMap.Builder<>();
scanOperator.getColRefToColumnMetaMap().keySet().stream()
.filter(outputColumns::contains)
.forEach(key -> columnRefColumnMapBuilder.put(key, scanOperator.getColRefToColumnMetaMap().get(key)));
ImmutableMap<ColumnRefOperator, Column> newColumnRefMap = columnRefColumnMapBuilder.build();
if (newColumnRefMap.size() != scanOperator.getColRefToColumnMetaMap().size()) {
Operator.Builder builder = OperatorBuilderFactory.build(scanOperator);
builder.withOperator(scanOperator);
LogicalScanOperator.Builder scanBuilder = (LogicalScanOperator.Builder) builder;
scanBuilder.setColRefToColumnMetaMap(newColumnRefMap);
ColumnRefSet outputRefSet = new ColumnRefSet(outputColumns);
outputRefSet.except(requiredOutputColumns);
if (!outputRefSet.isEmpty() && projection == null) {
Map<ColumnRefOperator, ScalarOperator> projectionMap = Maps.newHashMap();
for (ColumnRefOperator columnRefOperator : outputColumns) {
if (outputRefSet.contains(columnRefOperator)) {
continue;
}
projectionMap.put(columnRefOperator, columnRefOperator);
}
Projection newProjection = new Projection(projectionMap);
builder.setProjection(newProjection);
}
Operator newQueryOp = builder.build();
return OptExpression.create(newQueryOp);
} else {
return optExpression;
}
}