use of com.alibaba.maxgraph.sdkcommon.compiler.custom.branch.CustomCaseWhenFunction in project GraphScope by alibaba.
the class TreeBuilder method visitLambdaMapStep.
private TreeNode visitLambdaMapStep(LambdaMapStep step, TreeNode prev) {
Function functionObj = step.getMapFunction();
Function mapFunction;
if (functionObj instanceof FunctionTraverser) {
mapFunction = ReflectionUtils.getFieldValue(FunctionTraverser.class, functionObj, "function");
} else {
mapFunction = functionObj;
}
if (mapFunction instanceof CustomCaseWhenFunction) {
CustomCaseWhenFunction customCaseWhenFunction = CustomCaseWhenFunction.class.cast(mapFunction);
return processCaseWhenFunction(prev, customCaseWhenFunction);
} else if (mapFunction instanceof CustomAggregationListTraversal) {
CustomAggregationListTraversal customAggregationListTraversal = CustomAggregationListTraversal.class.cast(mapFunction);
List<Traversal<?, ?>> aggregateTraversalList = customAggregationListTraversal.getTraversalList();
List<TreeNode> aggregateNodeList = Lists.newArrayList();
boolean saveFlag = rootPathFlag;
this.rootPathFlag = false;
for (Traversal<?, ?> traversal : aggregateTraversalList) {
aggregateNodeList.add(travelTraversalAdmin(traversal.asAdmin(), new SourceDelegateNode(prev, schema)));
}
this.rootPathFlag = saveFlag;
return new AggregationListTreeNode(prev, schema, customAggregationListTraversal.getNameList(), aggregateNodeList);
} else if (mapFunction instanceof MapPropFillFunction || mapFunction instanceof RangeSumFunction) {
return new LambdaMapTreeNode(prev, schema, mapFunction, null);
} else {
if (this.lambdaEnableFlag) {
return new LambdaMapTreeNode(prev, schema, mapFunction, buildLambdaIndex(step));
} else {
throw new UnsupportedOperationException("Not support lambda map yet");
}
}
}
Aggregations