Skip to content

Commit

Permalink
Remove unnecessary name canonicalizing
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Henneberger <git@danielhenneberger.com>
  • Loading branch information
henneberger committed Oct 27, 2023
1 parent b1546ac commit b07f0a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import com.datasqrl.calcite.schema.sql.SqlBuilders.SqlSelectBuilder;
import com.datasqrl.calcite.visitor.SqlNodeVisitor;
import com.datasqrl.calcite.visitor.SqlRelationVisitor;
import com.datasqrl.canonicalizer.Name;
import com.datasqrl.plan.hints.TopNHint.Type;
import com.datasqrl.util.SqlNameUtil;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -50,19 +50,16 @@

public class SqrlToSql implements SqlRelationVisitor<Result, Context> {
final CatalogReader catalogReader;
final SqlNameUtil nameUtil;
final SqlOperatorTable operatorTable;
final Map<SqlNode, SqlDynamicParam> dynamicParam;
@Getter
final List<FunctionParameter> params;
private final TablePathBuilder tablePathBuilder;

public SqrlToSql(CatalogReader catalogReader, SqlNameUtil nameUtil,
SqlOperatorTable operatorTable, Map<SqlNode, SqlDynamicParam> dynamicParam,
List<FunctionParameter> mutableParams,
public SqrlToSql(CatalogReader catalogReader, SqlOperatorTable operatorTable,
Map<SqlNode, SqlDynamicParam> dynamicParam, List<FunctionParameter> mutableParams,
TablePathBuilder tablePathBuilder) {
this.catalogReader = catalogReader;
this.nameUtil = nameUtil;
this.operatorTable = operatorTable;
this.dynamicParam = dynamicParam;
this.params = new ArrayList<>(mutableParams);
Expand Down Expand Up @@ -97,9 +94,7 @@ public Result visitQuerySpecification(SqlSelect call, Context context) {
.setFrom(result.sqlNode);

List<SqlNode> selectList = new ArrayList<>(call.getSelectList().getList());
Set<String> fieldNames = getFieldNames(selectList).stream()
.map(nameUtil::toName).map(Name::getDisplay)
.collect(Collectors.toSet());
Set<String> fieldNames = new HashSet<>(getFieldNames(selectList));

List<String> columns = catalogReader.getTableFromPath(result.getCurrentPath())
.unwrap(ModifiableTable.class).getRowType().getFieldNames();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public Void visit(SqrlAssignment assignment, Void context) {
validator.getParamMapping(), framework.getUniquePkId());

SqrlToSql sqrlToSql = new SqrlToSql(
planner.getCatalogReader(), nameUtil,
planner.getCatalogReader(),
planner.getOperatorTable(), validator.getDynamicParam(),
validator.getParameters().get(assignment),
tablePathBuilder);
Expand Down

0 comments on commit b07f0a4

Please sign in to comment.