diff --git a/GraphView/GraphViewQueryCompiler/CompileSelect.cs b/GraphView/GraphViewQueryCompiler/CompileSelect.cs index a7ba1d4cf..151ca27d8 100644 --- a/GraphView/GraphViewQueryCompiler/CompileSelect.cs +++ b/GraphView/GraphViewQueryCompiler/CompileSelect.cs @@ -1,11 +1,8 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Data; using System.Diagnostics; -using System.IO; using System.Linq; -using System.Text; using GraphView.GraphViewDBPortal; namespace GraphView @@ -446,7 +443,6 @@ private MatchGraph ConstructGraph2(out List nonVertexT UnionFind unionFind = new UnionFind(); Dictionary vertexTableCollection = new Dictionary(StringComparer.OrdinalIgnoreCase); -// Dictionary vertexTableReferencesDict = new Dictionary(); List connectedSubGraphs = new List(); Dictionary subGraphMap = new Dictionary(StringComparer.OrdinalIgnoreCase); Dictionary parent = new Dictionary(StringComparer.OrdinalIgnoreCase); @@ -463,7 +459,6 @@ private MatchGraph ConstructGraph2(out List nonVertexT foreach (WNamedTableReference vertexTableRef in vertexTableList) { vertexTableCollection.GetOrCreate(vertexTableRef.Alias.Value); -// vertexTableReferencesDict[vertexTableRef.Alias.Value] = vertexTableRef; if (!parent.ContainsKey(vertexTableRef.Alias.Value)) parent[vertexTableRef.Alias.Value] = vertexTableRef.Alias.Value; } @@ -588,17 +583,6 @@ private MatchGraph ConstructGraph2(out List nonVertexT { srcNode.DanglingEdges.Add(edgeFromSrcNode); srcNode.Properties.Add(GremlinKeyword.Star); - //if (edgeFromSrcNode.EdgeType == WEdgeType.BothEdge) - //{ - // srcNode.Properties.Add(GremlinKeyword.EdgeAdj); - // srcNode.Properties.Add(GremlinKeyword.ReverseEdgeAdj); - //} - //else if (edgeFromSrcNode.EdgeType == WEdgeType.OutEdge) { - // srcNode.Properties.Add(GremlinKeyword.EdgeAdj); - //} - //else { - // srcNode.Properties.Add(GremlinKeyword.ReverseEdgeAdj); - //} } } if (path.Tail == null) continue; @@ -829,13 +813,6 @@ private static void CheckRemainingPredicatesAndAppendFilterOp(QueryCompilationCo : context.OuterContextOp, predicate.CompileToBatchFunction(context, command))); - //childrenProcessor.Add( - // new FilterOperator( - // childrenProcessor.Count != 0 - // ? childrenProcessor.Last() - // : context.OuterContextOp, - // predicate.CompileToFunction(context, connection))); - toBeRemovedIndexes.Add(i); context.CurrentExecutionOperator = childrenProcessor.Last(); } @@ -1020,8 +997,7 @@ private GraphViewExecutionOperator ConstructOperator2(GraphViewCommand command, currentNode.DanglingEdges[0].AttachedJsonQuery)) : new FetchNodeOperator( command, - currentNode.AttachedJsonQuery - /*currentNode.AttachedJsonQueryOfNodesViaExternalAPI*/); + currentNode.AttachedJsonQuery); // // The graph contains more than one component @@ -1098,7 +1074,6 @@ private GraphViewExecutionOperator ConstructOperator2(GraphViewCommand command, context.LocateColumnReference(traversalEdge.EdgeAlias, GremlinKeyword.Star), this.GetTraversalType(traversalEdge), currentNode.AttachedJsonQuery, - //currentNode.AttachedJsonQueryOfNodesViaExternalAPI, null, booleanFunction)); context.CurrentExecutionOperator = operatorChain.Last(); // @@ -1177,7 +1152,6 @@ private GraphViewExecutionOperator ConstructOperator2(GraphViewCommand command, else if (tableReference is WSchemaObjectFunctionTableReference) { var functionTableReference = tableReference as WSchemaObjectFunctionTableReference; - var functionName = functionTableReference.SchemaObject.Identifiers.Last().ToString(); var tableOp = functionTableReference.Compile(context, command); tableReferences.Add(functionTableReference.Alias.Value); @@ -1255,37 +1229,6 @@ private GraphViewExecutionOperator ConstructOperator2(GraphViewCommand command, projectOperator.AddSelectScalarElement(scalarFunction); } - //// Rebuilds the output layout of the context - //context.ClearField(); - //int i = 0; - //if (context.CarryOn) - //{ - // foreach (var parentFieldPair in context.ParentContextRawRecordLayout) - // { - // context.RawRecordLayout.Add(parentFieldPair.Key, parentFieldPair.Value); - // } - // i = context.ParentContextRawRecordLayout.Count; - //} - - //foreach (var expr in selectScalarExprList) - //{ - // var alias = expr.ColumnName; - // WColumnReferenceExpression columnReference; - // if (alias == null) - // { - // columnReference = expr.SelectExpr as WColumnReferenceExpression; - // if (columnReference == null) - // { - // var value = expr.SelectExpr as WValueExpression; - // columnReference = new WColumnReferenceExpression("", value.Value); - // } - // } - // else - // columnReference = new WColumnReferenceExpression("", alias); - // // TODO: Change to Addfield with correct ColumnGraphType - // context.RawRecordLayout.Add(columnReference, i++); - //} - operatorChain.Add(projectOperator); context.CurrentExecutionOperator = projectOperator; } @@ -1330,7 +1273,6 @@ private GraphViewExecutionOperator ConstructOperator2(GraphViewCommand command, CapAggregate capAggregate = new CapAggregate(); for (int i = 0; i < fcall.Parameters.Count; i += 2) { - WColumnNameList columnNameList = fcall.Parameters[i] as WColumnNameList; WValueExpression capName = fcall.Parameters[i+1] as WValueExpression; IAggregateFunction sideEffectState; @@ -1370,16 +1312,6 @@ private GraphViewExecutionOperator ConstructOperator2(GraphViewCommand command, } } - //// Rebuilds the output layout of the context - //context.ClearField(); - - //foreach (var expr in selectScalarExprList) - //{ - // var alias = expr.ColumnName; - // // TODO: Change to Addfield with correct ColumnGraphType - // context.AddField("", alias ?? GremlinKeyword.TableDefaultColumnName, ColumnGraphType.Value); - //} - operatorChain.Add(projectAggregationOp); context.CurrentExecutionOperator = projectAggregationOp; } @@ -1423,44 +1355,17 @@ public void Union(string a, string b) partial class WWithPathClause { - //internal override GraphViewExecutionOperator Generate(GraphViewConnection dbConnection) - //{ - // foreach (var path in Paths) - // { - // //path.Item2.SelectElements = new List(); - // PathOperators.Add(new Tuple(path.Item1, - // path.Item2.Generate(dbConnection), path.Item3)); - // } - // if (PathOperators.Count != 0) return PathOperators.First().Item2; - // else return null; - //} + } partial class WChoose { - //internal override GraphViewExecutionOperator Generate(GraphViewConnection dbConnection) - //{ - // List Source = new List(); - // foreach (var x in InputExpr) - // { - // Source.Add(x.Generate(dbConnection)); - // } - // return new ConcatenateOperator(Source); - //} + } partial class WCoalesce { - //internal override GraphViewExecutionOperator Generate(GraphViewConnection dbConnection) - //{ - // List Source = new List(); - // foreach (var x in InputExpr) - // { - // Source.Add(x.Generate(dbConnection)); - // } - // var op = new CoalesceOperator(Source, CoalesceNumber); - // return new OutputOperator(op, op.header, null); - //} + } partial class WSqlBatch @@ -1835,12 +1740,10 @@ internal override GraphViewExecutionOperator Compile(QueryCompilationContext con } WSelectQueryBlock.ConstructJsonQueryOnNode(command, matchNode, null, command.Connection.RealPartitionKey); - //WSelectQueryBlock.ConstructJsonQueryOnNodeViaExternalAPI(matchNode, null); FetchNodeOperator fetchNodeOp = new FetchNodeOperator( command, - matchNode.AttachedJsonQuery - /*matchNode.AttachedJsonQueryOfNodesViaExternalAPI*/); + matchNode.AttachedJsonQuery); foreach (string propertyName in matchNode.Properties) { ColumnGraphType columnGraphType = GraphViewReservedProperties.IsNodeReservedProperty(propertyName) @@ -1888,7 +1791,6 @@ internal override GraphViewExecutionOperator Compile(QueryCompilationContext con // if (isSendQueryRequired) { WSelectQueryBlock.ConstructJsonQueryOnNode(command, matchNode, null, command.Connection.RealPartitionKey); - //WSelectQueryBlock.ConstructJsonQueryOnNodeViaExternalAPI(matchNode, null); } WBooleanExpression nodeCondition = null; @@ -1918,7 +1820,7 @@ internal override GraphViewExecutionOperator Compile(QueryCompilationContext con TraversalOperator traversalOp = new TraversalOperator( context.CurrentExecutionOperator, command, edgeFieldIndex, this.GetTraversalTypeParameter(), - matchNode.AttachedJsonQuery/*, matchNode.AttachedJsonQueryOfNodesViaExternalAPI*/, null, booleanFunction); + matchNode.AttachedJsonQuery, null, booleanFunction); context.CurrentExecutionOperator = traversalOp; // Update context's record layout @@ -3655,4 +3557,3 @@ internal override GraphViewExecutionOperator Compile(QueryCompilationContext con } } } -