Skip to content

Commit

Permalink
More cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
echauchot committed Feb 25, 2025
1 parent 64139b0 commit e7176ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.datasqrl.canonicalizer.Name;
import com.datasqrl.canonicalizer.NamePath;
import com.datasqrl.config.PackageJson.CompilerConfig;
import com.datasqrl.engine.log.LogManager;
import com.datasqrl.engine.server.ServerPhysicalPlan;
import com.datasqrl.schema.Multiplicity;
import com.datasqrl.v2.tables.SqrlFunctionParameter;
Expand Down Expand Up @@ -59,7 +58,7 @@ public class GraphqlSchemaFactory2 {

private final List<GraphQLFieldDefinition> queryFields = new ArrayList<>();
private final List<GraphQLObjectType> objectTypes = new ArrayList<>();
private final Set<String> usedNames = new HashSet<>();
private final Set<String> definedTypeNames = new HashSet<>();
private final boolean extendedScalarTypes;
private final ExecutionGoal goal;
public final Set<String> seen = new HashSet<>();
Expand Down Expand Up @@ -176,7 +175,7 @@ private Optional<GraphQLObjectType> createRootTableFunctionResultType(SqrlTableF
String typeName;
if (tableFunction.getBaseTable().isPresent()) {
final String baseTableName = tableFunction.getBaseTable().get().getName();
if (usedNames.contains(baseTableName)) {// result type was already defined
if (definedTypeNames.contains(baseTableName)) {// result type was already defined
return Optional.empty();
}
else { // new result type using base name
Expand Down Expand Up @@ -220,7 +219,7 @@ private Optional<GraphQLObjectType> createRootTableFunctionResultType(SqrlTableF
.name(typeName)
.fields(fields)
.build();
usedNames.add(typeName);
definedTypeNames.add(typeName);
queryFields.addAll(fields);
return Optional.of(objectType);
}
Expand Down Expand Up @@ -254,7 +253,7 @@ private Optional<GraphQLObjectType> createRelationshipTableFunctionResultType(Sq
.name(typeName)
.fields(fields)
.build();
usedNames.add(typeName);
definedTypeNames.add(typeName);
queryFields.addAll(fields);
return Optional.of(objectType);
}
Expand Down Expand Up @@ -344,8 +343,7 @@ private GraphQLObjectType createRootQueryType(List<SqrlTableFunction> rootTableF
.fields(fields)
.build();

usedNames.add("Query");

definedTypeNames.add("Query");
this.queryFields.addAll(fields);

return rootQueryObjectType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ public static Optional<GraphQLInputType> createInputTypeForRelDataType(RelDataTy
return getGraphQLInputType(type, namePath, seen, extendedScalarTypes);
}

// TODO should not we use getInOutTypeHelper instead, the code seems duplicated ?
private static Optional<GraphQLInputType> getGraphQLInputType(RelDataType type, NamePath namePath, Set<String> seen, boolean extendedScalarTypes) {
switch (type.getSqlTypeName()) {
case BOOLEAN:
Expand Down

0 comments on commit e7176ca

Please sign in to comment.