Beispiel #1
0
        private IGraphQueryStep BuildQueryPlanForMatchNode(MatchPath node)
        {
            var alias = node.Alias;

            if (GraphQuery.WithDocumentQueries.TryGetValue(alias, out var query) == false)
            {
                throw new InvalidOperationException($"BuildQueryPlanForMatchVertex was invoked for allias='{alias}' which is supposed to be a node but no corresponding WITH clause was found.");
            }
            // TODO: we can tell at this point if it is a collection query or not,
            // TODO: in the future, we want to build a diffrent step for collection queries in the future.
            var queryMetadata = new QueryMetadata(query.withQuery, _query.QueryParameters, 0, addSpatialProperties: false);
            var qqs           = new QueryQueryStep(_database.QueryRunner, alias, query.withQuery, queryMetadata, _query.QueryParameters, _context, _resultEtag, this, _token)
            {
                CollectIntermediateResults = CollectIntermediateResults
            };
            var key = qqs.GetQueryString;

            //We only want to cache queries that are not unique so we count them during their creation
            if (IdenticalQueriesCount.TryGetValue(key, out var count))
            {
                count.Value += 1;
            }
            else
            {
                IdenticalQueriesCount.Add(key, new Reference <int>()
                {
                    Value = 1
                });
            }

            return(qqs);
        }
Beispiel #2
0
        public override IGraphQueryStep VisitQueryQueryStep(QueryQueryStep qqs)
        {
            _token.ThrowIfCancellationRequested();
            if (_isVisitingRight && qqs.CanBeConsideredForDestinationOptimization)
            {
                return(QueryQueryStep.ToCollectionDestinationQueryStep(_documentsStorage, qqs, _token));
            }

            return(qqs);
        }
 public override void VisitQueryQueryStep(QueryQueryStep qqs)
 {
     _writer.WriteStartObject();
     _writer.WritePropertyName("Type");
     _writer.WriteString("QueryQueryStep");
     _writer.WriteComma();
     _writer.WritePropertyName("Query");
     _writer.WriteString(qqs.Query.ToString());
     _writer.WriteComma();
     WriteIntermidiateResults(qqs.IntermediateResults);
     _writer.WriteEndObject();
 }
Beispiel #4
0
        public override void VisitQueryQueryStep(QueryQueryStep qqs)
        {
            var name = qqs.GetIndexName;

            if (name.IsNullOrWhiteSpace() == false)
            {
                Indexes.Add(name);
            }
            else
            {
                QueryStepsWithoutExplicitIndex.Add(qqs);
            }
        }
Beispiel #5
0
 public virtual IGraphQueryStep VisitQueryQueryStep(QueryQueryStep qqs)
 {
     _token.ThrowIfCancellationRequested();
     return(qqs);
 }
Beispiel #6
0
 public static CollectionDestinationQueryStep ToCollectionDestinationQueryStep(DocumentsStorage documentsStorage, QueryQueryStep qqs, OperationCancelToken token)
 {
     return(new CollectionDestinationQueryStep(qqs._alias, qqs._queryContext.Documents, documentsStorage, qqs._queryMetadata.CollectionName, token));
 }
Beispiel #7
0
 public virtual void VisitQueryQueryStep(QueryQueryStep qqs)
 {
 }