public List <string> Next() { WSqlScript sqlScript = this.GetEndOp().ToSqlScript(); SqlScript = sqlScript.ToString(); GraphViewExecutionOperator op = sqlScript.Batches[0].Compile(null, this.connection); List <RawRecord> rawRecordResults = new List <RawRecord>(); RawRecord outputRec = null; while ((outputRec = op.Next()) != null) { rawRecordResults.Add(outputRec); } List <string> results = new List <string>(); switch (outputFormat) { case OutputFormat.GraphSON: results.Add(GraphSONProjector.ToGraphSON(rawRecordResults, this.connection)); break; default: foreach (var record in rawRecordResults) { FieldObject field = record[0]; results.Add(field.ToString()); } break; } return(results); }
protected UpdatePropertiesBaseOperator(GraphViewExecutionOperator inputOp, GraphViewConnection connection, List <Tuple <WValueExpression, WValueExpression, int> > pPropertiesToBeUpdated, UpdatePropertyMode pMode = UpdatePropertyMode.Set) : base(inputOp, connection) { PropertiesToBeUpdated = pPropertiesToBeUpdated; Mode = pMode; }
protected ChooseWithOptionsOperator(SerializationInfo info, StreamingContext context) { this.inputOp = (GraphViewExecutionOperator)info.GetValue("inputOp", typeof(GraphViewExecutionOperator)); this.targetSubOp = (GraphViewExecutionOperator)info.GetValue("targetSubOp", typeof(GraphViewExecutionOperator)); List <FieldObject> traversalListTuple1 = GraphViewSerializer.DeserializeList <FieldObject>(info, "traversalListTuple1"); List <GraphViewExecutionOperator> traversalListTuple3 = GraphViewSerializer.DeserializeList <GraphViewExecutionOperator>(info, "traversalListTuple3"); this.traversalList = new List <Tuple <FieldObject, Container, GraphViewExecutionOperator> >(); Debug.Assert(traversalListTuple1.Count == traversalListTuple3.Count); for (int i = 0; i < traversalListTuple1.Count; i++) { this.traversalList.Add(new Tuple <FieldObject, Container, GraphViewExecutionOperator>( traversalListTuple1[i], new Container(), traversalListTuple3[i])); } this.optionNoneTraversalOp = (GraphViewExecutionOperator)info.GetValue("optionNoneTraversalOp", typeof(GraphViewExecutionOperator)); this.selectOption = new List <int>(); this.currentIndex = 0; this.outputBuffer = new Queue <RawRecord>(); this.needInitialize = true; }
internal override ScalarFunction CompileToFunction(QueryCompilationContext context, GraphViewConnection dbConnection) { QueryCompilationContext subContext = new QueryCompilationContext(context); GraphViewExecutionOperator subQueryOp = SubQueryExpr.Compile(subContext, dbConnection); return(new ScalarSubqueryFunction(subQueryOp, subContext.OuterContextOp)); }
internal override GraphViewExecutionOperator Compile(QueryCompilationContext context, GraphViewConnection dbConnection) { WScalarSubquery srcSubQuery = this.Parameters[0] as WScalarSubquery; WScalarSubquery sinkSubQuery = this.Parameters[1] as WScalarSubquery; if (srcSubQuery == null || sinkSubQuery == null) { throw new SyntaxErrorException("The first two parameters of AddE can only be WScalarSubquery."); } WValueExpression otherVTagParameter = this.Parameters[2] as WValueExpression; WValueExpression edgeLabel = this.Parameters[3] as WValueExpression; Debug.Assert(otherVTagParameter != null, "otherVTagParameter != null"); // // if otherVTag == 0, this newly added edge's otherV() is the src vertex. // Otherwise, it's the sink vertex // int otherVTag = int.Parse(otherVTagParameter.Value); List <WPropertyExpression> edgeProperties = new List <WPropertyExpression>(); List <string> projectedField = new List <string>(); for (int i = 4; i < this.Parameters.Count; i += 1) { WPropertyExpression addedProperty = this.Parameters[i] as WPropertyExpression; if (addedProperty != null) { edgeProperties.Add(addedProperty); } WValueExpression projectedProperty = this.Parameters[i] as WValueExpression; if (projectedProperty != null) { projectedField.Add(projectedProperty.Value); } } JObject edgeJsonObject = this.ConstructEdgeJsonObject(edgeLabel, edgeProperties); QueryCompilationContext srcSubContext = new QueryCompilationContext(context); GraphViewExecutionOperator srcSubQueryOp = srcSubQuery.SubQueryExpr.Compile(srcSubContext, dbConnection); QueryCompilationContext sinkSubContext = new QueryCompilationContext(context); GraphViewExecutionOperator sinkSubQueryOp = sinkSubQuery.SubQueryExpr.Compile(sinkSubContext, dbConnection); GraphViewExecutionOperator addEOp = new AddEOperator(context.CurrentExecutionOperator, dbConnection, srcSubContext.OuterContextOp, srcSubQueryOp, sinkSubContext.OuterContextOp, sinkSubQueryOp, otherVTag, edgeJsonObject, projectedField); context.CurrentExecutionOperator = addEOp; foreach (string propertyName in projectedField) { ColumnGraphType columnGraphType = GraphViewReservedProperties.IsEdgeReservedProperty(propertyName) ? GraphViewReservedProperties.ReservedEdgePropertiesColumnGraphTypes[propertyName] : ColumnGraphType.Value; context.AddField(this.Alias.Value, propertyName, columnGraphType); } return(addEOp); }
public GroupOperator( GraphViewExecutionOperator inputOp, ScalarFunction groupByKeyFunction, int groupByKeyFieldIndex, ConstantSourceOperator tempSourceOp, ContainerOperator groupedSourceOp, GraphViewExecutionOperator aggregateOp, int elementPropertyProjectionIndex, int carryOnCount) { this.inputOp = inputOp; this.groupByKeyFunction = groupByKeyFunction; this.groupByKeyFieldIndex = groupByKeyFieldIndex; this.tempSourceOp = tempSourceOp; this.groupedSourceOp = groupedSourceOp; this.aggregateOp = aggregateOp; this.elementPropertyProjectionIndex = elementPropertyProjectionIndex; this.carryOnCount = carryOnCount; groupedStates = new Dictionary <FieldObject, List <RawRecord> >(); Open(); }
protected CoalesceOperator(SerializationInfo info, StreamingContext context) { this.traversalList = GraphViewSerializer.DeserializeList <GraphViewExecutionOperator>(info, "traversalList"); this.inputOp = (GraphViewExecutionOperator)info.GetValue("inputOp", typeof(GraphViewExecutionOperator)); this.outputBuffer = new SortedDictionary <int, Queue <RawRecord> >(); this.batchSize = KW_DEFAULT_BATCH_SIZE; }
public GroupFunction(GroupState groupState, GraphViewExecutionOperator aggregateOp, Container container, bool isProjectingACollection) { this.groupState = groupState; this.aggregateOp = aggregateOp; this.container = container; this.isProjectingACollection = isProjectingACollection; }
public DropOperator(GraphViewExecutionOperator dummyInputOp, GraphViewConnection connection, int dropTargetIndex) : base(dummyInputOp, connection) { this.dropTargetIndex = dropTargetIndex; this.connection = connection; this.dummyInputOp = dummyInputOp; }
public PropertiesOperator2( GraphViewExecutionOperator inputOp, List <int> propertiesIndex, List <string> populateMetaproperties) : base(inputOp) { this.propertiesIndex = propertiesIndex; this.populateMetaproperties = populateMetaproperties; }
internal AllPropertiesOperator( GraphViewExecutionOperator inputOp, int inputTargetIndex, List <string> populateMetaProperties) : base(inputOp) { this.inputTargetIndex = inputTargetIndex; this.populateMetaProperties = populateMetaProperties; }
internal GraphTraversalIterator(GraphViewExecutionOperator pCurrentOperator, GraphViewConnection connection, OutputFormat outputFormat) { this.connection = connection; this.currentOperator = pCurrentOperator; this.outputFormat = outputFormat; this.firstCall = true; }
public PropertiesOperator( GraphViewExecutionOperator pInputOperator, List <Tuple <string, int> > pPropertiesList, int pAllPropertyIndex) : base(pInputOperator) { propertyList = pPropertiesList; allPropertyIndex = pAllPropertyIndex; }
internal override BooleanFunction CompileToFunction(QueryCompilationContext context, GraphViewConnection dbConnection) { QueryCompilationContext subContext = new QueryCompilationContext(context); GraphViewExecutionOperator subQueryOp = Subquery.SubQueryExpr.Compile(subContext, dbConnection); ExistsFunction existsFunc = new ExistsFunction(subQueryOp, subContext.OuterContextOp); return(existsFunc); }
internal PropertyMapOperator( GraphViewExecutionOperator inputOp, int inputTargetIndex, List <string> propertyNameList) : base(inputOp) { this.inputTargetIndex = inputTargetIndex; this.propertyNameList = propertyNameList; }
internal UnfoldOperator( GraphViewExecutionOperator pInputOperator, ScalarFunction pUnfoldTarget, List <string> pUnfoldColumns) : base(pInputOperator) { this._unfoldTarget = pUnfoldTarget; this._unfoldColumns = pUnfoldColumns; }
public UnionOperator(GraphViewExecutionOperator inputOp, Container container) { this.inputOp = inputOp; this.traversalList = new List <GraphViewExecutionOperator>(); this.container = container; this.needInitialize = true; this.Open(); }
internal UnfoldOperator( GraphViewExecutionOperator inputOp, ScalarFunction getUnfoldTargetFunc, List <string> unfoldCompose1Columns) : base(inputOp) { this.getUnfoldTargetFunc = getUnfoldTargetFunc; this.unfoldCompose1Columns = unfoldCompose1Columns; }
internal UnfoldOperator( GraphViewExecutionOperator inputOp, ScalarFunction getUnfoldTargetFunc, List <string> populateColumns) : base(inputOp) { this.getUnfoldTargetFunc = getUnfoldTargetFunc; this.populateColumns = populateColumns; }
internal ConstantOperator( GraphViewExecutionOperator inputOp, List <ScalarFunction> constantValues, bool isList) : base(inputOp) { this.constantValues = constantValues; this.isList = isList; }
public CoalesceOperator(GraphViewExecutionOperator inputOp, ContainerWithFlag container) { this.inputOp = inputOp; this.container = container; this.traversalList = new List <GraphViewExecutionOperator>(); this.outputBuffer = new SortedDictionary <int, Queue <RawRecord> >(); this.batchSize = KW_DEFAULT_BATCH_SIZE; this.Open(); }
public PathOperator2(GraphViewExecutionOperator inputOp, List <Tuple <ScalarFunction, bool> > pathStepList, List <ScalarFunction> byFuncList) { this.inputOp = inputOp; this.pathStepList = pathStepList; this.byFuncList = byFuncList; this.Open(); }
internal override ScalarFunction CompileToFunction(QueryCompilationContext context, GraphViewCommand command) { QueryCompilationContext subContext = new QueryCompilationContext(context); Container container = new Container(); subContext.OuterContextOp.SetContainer(container); GraphViewExecutionOperator subQueryOp = SubQueryExpr.Compile(subContext, command); return(new ScalarSubqueryFunction(subQueryOp, container)); }
public UpdateEdgePropertiesOperator( GraphViewExecutionOperator inputOp, GraphViewConnection connection, int srcVertexIdIndex, int edgeOffsetIndex, List <Tuple <WValueExpression, WValueExpression, int> > propertiesList, UpdatePropertyMode pMode = UpdatePropertyMode.Set) : base(inputOp, connection, propertiesList, pMode) { this._srcVertexIdIndex = srcVertexIdIndex; this._edgeOffsetIndex = edgeOffsetIndex; }
public UpdatePropertiesOperator( GraphViewExecutionOperator dummyInputOp, GraphViewConnection connection, int updateTargetIndex, List <WPropertyExpression> updateProperties) : base(dummyInputOp, connection) { this.updateTargetIndex = updateTargetIndex; this.updateProperties = updateProperties; }
protected OptionalOperator(SerializationInfo info, StreamingContext context) { this.inputIndexes = GraphViewSerializer.DeserializeList <int>(info, "inputIndexes"); this.inputOp = (GraphViewExecutionOperator)info.GetValue("inputOp", typeof(GraphViewExecutionOperator)); this.targetSubQueryOp = (GraphViewExecutionOperator)info.GetValue("targetSubQueryOp", typeof(GraphViewExecutionOperator)); this.optionalTraversal = (GraphViewExecutionOperator)info.GetValue("optionalTraversal", typeof(GraphViewExecutionOperator)); this.currentIndex = 0; this.haveOutput = new HashSet <int>(); this.needInitialize = true; }
public QueryDerivedInBatchOperator( GraphViewExecutionOperator inputOp, GraphViewExecutionOperator derivedQueryOp, Container container, ProjectAggregationInBatch projectAggregationInBatchOp, int carryOnCount) : base(inputOp, derivedQueryOp, container, carryOnCount) { this.projectAggregationInBatchOp = projectAggregationInBatchOp; this.outputBuffer = new SortedDictionary <int, RawRecord>(); }
public TreeSideEffectOperator( GraphViewExecutionOperator inputOp, TreeFunction treeState, int pathIndex) { this.inputOp = inputOp; this.TreeState = treeState; this.pathIndex = pathIndex; this.Open(); }
internal override BooleanFunction CompileToFunction(QueryCompilationContext context, GraphViewCommand command) { QueryCompilationContext subContext = new QueryCompilationContext(context); Container container = new Container(); subContext.OuterContextOp.SetContainer(container); GraphViewExecutionOperator subQueryOp = Subquery.SubQueryExpr.Compile(subContext, command); ExistsFunction existsFunc = new ExistsFunction(subQueryOp, container); return(existsFunc); }
public AddEOperator(GraphViewExecutionOperator inputOp, GraphViewConnection connection, ScalarFunction pSrcFunction, ScalarFunction pSinkFunction, int otherVTag, JObject pEdgeJsonObject, List <string> pProjectedFieldList) : base(inputOp, connection) { _srcFunction = pSrcFunction; _sinkFunction = pSinkFunction; _otherVTag = otherVTag; _edgeJsonObject = pEdgeJsonObject; _edgeProperties = pProjectedFieldList; }