Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shirly121 committed Sep 20, 2024
1 parent 6336c8b commit acb06fd
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import com.alibaba.graphscope.common.ir.meta.procedure.GraphStoredProcedures;
import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema;

import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.Objects;

/**
Expand All @@ -33,18 +31,18 @@ public class IrMeta {
protected final GraphId graphId;
protected final SnapshotId snapshotId;
protected final IrGraphSchema schema;
protected final @Nullable GraphStoredProcedures storedProcedures;
protected final GraphStoredProcedures storedProcedures;

public IrMeta(IrGraphSchema schema) {
this(SnapshotId.createEmpty(), schema);
this(GraphId.DEFAULT, SnapshotId.createEmpty(), schema, new GraphStoredProcedures());
}

public IrMeta(IrGraphSchema schema, GraphStoredProcedures storedProcedures) {
this(GraphId.DEFAULT, SnapshotId.createEmpty(), schema, storedProcedures);
}

public IrMeta(SnapshotId snapshotId, IrGraphSchema schema) {
this(GraphId.DEFAULT, snapshotId, schema, null);
this(GraphId.DEFAULT, snapshotId, schema, new GraphStoredProcedures());
}

public IrMeta(
Expand All @@ -55,7 +53,7 @@ public IrMeta(
this.graphId = graphId;
this.snapshotId = Objects.requireNonNull(snapshotId);
this.schema = Objects.requireNonNull(schema);
this.storedProcedures = storedProcedures;
this.storedProcedures = Objects.requireNonNull(storedProcedures);
}

public IrGraphSchema getSchema() {
Expand All @@ -66,7 +64,7 @@ public SnapshotId getSnapshotId() {
return snapshotId;
}

public @Nullable GraphStoredProcedures getStoredProcedures() {
public GraphStoredProcedures getStoredProcedures() {
return storedProcedures;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,45 +238,47 @@ private static <T> T getValue(
Object value = valueMap.get(config.getKey());
return (value != null) ? (T) value : config.get(new Configs(ImmutableMap.of()));
}
}

public static RelDataType createReturnType(
List config, GSDataTypeConvertor<RelDataType> typeConvertor) {
List<RelDataTypeField> fields = Lists.newArrayList();
if (config == null) {
private static RelDataType createReturnType(
List config, GSDataTypeConvertor<RelDataType> typeConvertor) {
List<RelDataTypeField> fields = Lists.newArrayList();
if (config == null) {
return new RelRecordType(fields);
}
Iterator iterator = config.iterator();
int index = 0;
while (iterator.hasNext()) {
Map<String, Object> field = (Map<String, Object>) iterator.next();
fields.add(
new RelDataTypeFieldImpl(
(String) field.get("name"),
index,
typeConvertor.convert(
new GSDataTypeDesc(
(Map<String, Object>) field.get("type")))));
++index;
}
return new RelRecordType(fields);
}
Iterator iterator = config.iterator();
int index = 0;
while (iterator.hasNext()) {
Map<String, Object> field = (Map<String, Object>) iterator.next();
fields.add(
new RelDataTypeFieldImpl(
(String) field.get("name"),
index,
typeConvertor.convert(
new GSDataTypeDesc((Map<String, Object>) field.get("type")))));
++index;
}
return new RelRecordType(fields);
}

public static List<StoredProcedureMeta.Parameter> createParameters(
List config, GSDataTypeConvertor<RelDataType> typeConvertor) {
List<StoredProcedureMeta.Parameter> parameters = Lists.newArrayList();
if (config == null) {
private static List<StoredProcedureMeta.Parameter> createParameters(
List config, GSDataTypeConvertor<RelDataType> typeConvertor) {
List<StoredProcedureMeta.Parameter> parameters = Lists.newArrayList();
if (config == null) {
return parameters;
}
Iterator iterator = config.iterator();
while (iterator.hasNext()) {
Map<String, Object> field = (Map<String, Object>) iterator.next();
parameters.add(
new StoredProcedureMeta.Parameter(
(String) field.get("name"),
typeConvertor.convert(
new GSDataTypeDesc(
(Map<String, Object>) field.get("type")))));
}
return parameters;
}
Iterator iterator = config.iterator();
while (iterator.hasNext()) {
Map<String, Object> field = (Map<String, Object>) iterator.next();
parameters.add(
new StoredProcedureMeta.Parameter(
(String) field.get("name"),
typeConvertor.convert(
new GSDataTypeDesc((Map<String, Object>) field.get("type")))));
}
return parameters;
}

public enum Mode implements GraphPlanExecutor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ public abstract class GraphOperandTypes {
* @param families
* @return
*/
// public static FamilyOperandTypeChecker family(SqlTypeFamily... families) {
// return new GraphFamilyOperandTypeChecker(ImmutableList.copyOf(families), i -> false);
// }

public static FamilyOperandTypeChecker family(RelDataTypeFamily... families) {
return new GraphFamilyOperandTypeChecker(ImmutableList.copyOf(families), i -> false);
}
Expand Down

0 comments on commit acb06fd

Please sign in to comment.