From c101f7de74cf8364db2c18dbbc1b96eec451a0c8 Mon Sep 17 00:00:00 2001 From: Theo van Kraay Date: Sat, 31 Aug 2024 17:47:06 +0100 Subject: [PATCH] comment out or change SDK code to remove errors --- .../parallelQueryExecutionContextBase.js | 23 +++++++++------- .../pipelinedQueryExecutionContext.js | 27 ++++++++++--------- .../cosmos/dist-esm/src/queryIterator.js | 7 ++--- .../src/routing/smartRoutingMapProvider.js | 5 ++-- src/Explorer/Tree/treeNodeUtil.tsx | 3 ++- 5 files changed, 36 insertions(+), 29 deletions(-) diff --git a/local_dependencies/@azure/cosmos/dist-esm/src/queryExecutionContext/parallelQueryExecutionContextBase.js b/local_dependencies/@azure/cosmos/dist-esm/src/queryExecutionContext/parallelQueryExecutionContextBase.js index e04a01229..bfe2c62bd 100644 --- a/local_dependencies/@azure/cosmos/dist-esm/src/queryExecutionContext/parallelQueryExecutionContextBase.js +++ b/local_dependencies/@azure/cosmos/dist-esm/src/queryExecutionContext/parallelQueryExecutionContextBase.js @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import PriorityQueue from "priorityqueuejs"; import { createClientLogger } from "@azure/logger"; +import PriorityQueue from "priorityqueuejs"; +import semaphore from "semaphore"; import { StatusCodes, SubStatusCodes } from "../common"; -import { QueryRange } from "../routing/QueryRange"; -import { SmartRoutingMapProvider } from "../routing/smartRoutingMapProvider"; -import { DocumentProducer } from "./documentProducer"; -import { getInitialHeader, mergeHeaders } from "./headerUtils"; -import { DiagnosticNodeInternal, DiagnosticNodeType } from "../diagnostics/DiagnosticNodeInternal"; -import { addDignosticChild } from "../utils/diagnostics"; import { MetadataLookUpType } from "../CosmosDiagnostics"; import { CosmosDbDiagnosticLevel } from "../diagnostics/CosmosDbDiagnosticLevel"; +import { DiagnosticNodeInternal, DiagnosticNodeType } from "../diagnostics/DiagnosticNodeInternal"; import { RUCapPerOperationExceededErrorCode, } from "../request/RUCapPerOperationExceededError"; -import semaphore from "semaphore"; +import { QueryRange } from "../routing/QueryRange"; +import { SmartRoutingMapProvider } from "../routing/smartRoutingMapProvider"; +import { addDignosticChild } from "../utils/diagnostics"; +import { DocumentProducer } from "./documentProducer"; +import { getInitialHeader, mergeHeaders } from "./headerUtils"; /** @hidden */ const logger = createClientLogger("parallelQueryExecutionContextBase"); /** @hidden */ @@ -58,7 +58,8 @@ export class ParallelQueryExecutionContextBase { this.err = undefined; this.state = ParallelQueryExecutionContextBase.STATES.started; this.routingProvider = new SmartRoutingMapProvider(this.clientContext); - this.sortOrders = this.partitionedQueryExecutionInfo.queryInfo.orderBy; + //this.sortOrders = this.partitionedQueryExecutionInfo.queryInfo.orderBy; + this.sortOrders = []; this.requestContinuation = options ? options.continuationToken || options.continuation : null; // response headers of undergoing operation this.respHeaders = getInitialHeader(); @@ -81,7 +82,9 @@ export class ParallelQueryExecutionContextBase { async _onTargetPartitionRanges() { // invokes the callback when the target partition ranges are ready const parsedRanges = this.partitionedQueryExecutionInfo.queryRanges; - const queryRanges = parsedRanges.map((item) => QueryRange.parseFromDict(item)); + //const queryRanges = parsedRanges.map((item) => QueryRange.parseFromDict(item)); + //hard coding the partition key ranges to be the parsedRanges + const queryRanges = parsedRanges; return this.routingProvider.getOverlappingRanges(this.collectionLink, queryRanges, this.getDiagnosticNode()); } /** diff --git a/local_dependencies/@azure/cosmos/dist-esm/src/queryExecutionContext/pipelinedQueryExecutionContext.js b/local_dependencies/@azure/cosmos/dist-esm/src/queryExecutionContext/pipelinedQueryExecutionContext.js index fd0bcf7c4..b4d668803 100644 --- a/local_dependencies/@azure/cosmos/dist-esm/src/queryExecutionContext/pipelinedQueryExecutionContext.js +++ b/local_dependencies/@azure/cosmos/dist-esm/src/queryExecutionContext/pipelinedQueryExecutionContext.js @@ -1,10 +1,7 @@ import { Constants } from "../common"; import { RUCapPerOperationExceededErrorCode } from "../request/RUCapPerOperationExceededError"; -import { GroupByEndpointComponent } from "./EndpointComponent/GroupByEndpointComponent"; -import { GroupByValueEndpointComponent } from "./EndpointComponent/GroupByValueEndpointComponent"; import { NonStreamingOrderByDistinctEndpointComponent } from "./EndpointComponent/NonStreamingOrderByDistinctEndpointComponent"; import { NonStreamingOrderByEndpointComponent } from "./EndpointComponent/NonStreamingOrderByEndpointComponent"; -import { OffsetLimitEndpointComponent } from "./EndpointComponent/OffsetLimitEndpointComponent"; import { OrderByEndpointComponent } from "./EndpointComponent/OrderByEndpointComponent"; import { OrderedDistinctEndpointComponent } from "./EndpointComponent/OrderedDistinctEndpointComponent"; import { UnorderedDistinctEndpointComponent } from "./EndpointComponent/UnorderedDistinctEndpointComponent"; @@ -27,13 +24,16 @@ export class PipelinedQueryExecutionContext { this.pageSize = PipelinedQueryExecutionContext.DEFAULT_PAGE_SIZE; } // Pick between Nonstreaming and streaming endpoints - this.nonStreamingOrderBy = partitionedQueryExecutionInfo.queryInfo.hasNonStreamingOrderBy; + // this.nonStreamingOrderBy = partitionedQueryExecutionInfo.queryInfo.hasNonStreamingOrderBy; + this.nonStreamingOrderBy = false; // Pick between parallel vs order by execution context - const sortOrders = partitionedQueryExecutionInfo.queryInfo.orderBy; + // const sortOrders = partitionedQueryExecutionInfo.queryInfo.orderBy; + const sortOrders = []; // TODO: Currently we don't get any field from backend to determine streaming queries if (this.nonStreamingOrderBy) { this.vectorSearchBufferSize = this.calculateVectorSearchBufferSize(partitionedQueryExecutionInfo.queryInfo, options); - const distinctType = partitionedQueryExecutionInfo.queryInfo.distinctType; + //const distinctType = partitionedQueryExecutionInfo.queryInfo.distinctType; + const distinctType = "None"; const context = new ParallelQueryExecutionContext(this.clientContext, this.collectionLink, this.query, this.options, this.partitionedQueryExecutionInfo); if (distinctType === "None") { this.endpoint = new NonStreamingOrderByEndpointComponent(context, sortOrders, this.vectorSearchBufferSize, partitionedQueryExecutionInfo.queryInfo.offset); @@ -51,7 +51,7 @@ export class PipelinedQueryExecutionContext { else { this.endpoint = new ParallelQueryExecutionContext(this.clientContext, this.collectionLink, this.query, this.options, this.partitionedQueryExecutionInfo); } - if (Object.keys(partitionedQueryExecutionInfo.queryInfo.groupByAliasToAggregateType).length > + /*if (Object.keys(partitionedQueryExecutionInfo.queryInfo.groupByAliasToAggregateType).length > 0 || partitionedQueryExecutionInfo.queryInfo.aggregates.length > 0 || partitionedQueryExecutionInfo.queryInfo.groupByExpressions.length > 0) { @@ -61,20 +61,21 @@ export class PipelinedQueryExecutionContext { else { this.endpoint = new GroupByEndpointComponent(this.endpoint, partitionedQueryExecutionInfo.queryInfo); } - } + }*/ // If top then add that to the pipeline. TOP N is effectively OFFSET 0 LIMIT N - const top = partitionedQueryExecutionInfo.queryInfo.top; + /*const top = partitionedQueryExecutionInfo.queryInfo.top; if (typeof top === "number") { this.endpoint = new OffsetLimitEndpointComponent(this.endpoint, 0, top); - } + }*/ // If offset+limit then add that to the pipeline - const limit = partitionedQueryExecutionInfo.queryInfo.limit; + /*const limit = partitionedQueryExecutionInfo.queryInfo.limit; const offset = partitionedQueryExecutionInfo.queryInfo.offset; if (typeof limit === "number" && typeof offset === "number") { this.endpoint = new OffsetLimitEndpointComponent(this.endpoint, offset, limit); - } + }*/ // If distinct then add that to the pipeline - const distinctType = partitionedQueryExecutionInfo.queryInfo.distinctType; + // const distinctType = partitionedQueryExecutionInfo.queryInfo.distinctType; + const distinctType = "None"; if (distinctType === "Ordered") { this.endpoint = new OrderedDistinctEndpointComponent(this.endpoint); } diff --git a/local_dependencies/@azure/cosmos/dist-esm/src/queryIterator.js b/local_dependencies/@azure/cosmos/dist-esm/src/queryIterator.js index 313d14c46..efb2e0f1b 100644 --- a/local_dependencies/@azure/cosmos/dist-esm/src/queryIterator.js +++ b/local_dependencies/@azure/cosmos/dist-esm/src/queryIterator.js @@ -224,10 +224,11 @@ export class QueryIterator { } const queryPlan = queryPlanResponse.result; const queryInfo = queryPlan.queryInfo; - this.nonStreamingOrderBy = queryInfo.hasNonStreamingOrderBy ? true : false; - if (queryInfo.aggregates.length > 0 && queryInfo.hasSelectValue === false) { + //this.nonStreamingOrderBy = queryInfo.hasNonStreamingOrderBy ? true : false; + this.nonStreamingOrderBy = false; + /*if (queryInfo.aggregates.length > 0 && queryInfo.hasSelectValue === false) { throw new Error("Aggregate queries must use the VALUE keyword"); - } + } */ this.queryExecutionContext = new PipelinedQueryExecutionContext(this.clientContext, this.resourceLink, this.query, this.options, queryPlan); } async fetchQueryPlan(diagnosticNode) { diff --git a/local_dependencies/@azure/cosmos/dist-esm/src/routing/smartRoutingMapProvider.js b/local_dependencies/@azure/cosmos/dist-esm/src/routing/smartRoutingMapProvider.js index 35a8520bc..ca94d6a85 100644 --- a/local_dependencies/@azure/cosmos/dist-esm/src/routing/smartRoutingMapProvider.js +++ b/local_dependencies/@azure/cosmos/dist-esm/src/routing/smartRoutingMapProvider.js @@ -57,9 +57,10 @@ export class SmartRoutingMapProvider { */ async getOverlappingRanges(collectionLink, sortedRanges, diagnosticNode) { // validate if the list is non- overlapping and sorted TODO: any PartitionKeyRanges - if (!SmartRoutingMapProvider._isSortedAndNonOverlapping(sortedRanges)) { + /*if (!SmartRoutingMapProvider._isSortedAndNonOverlapping(sortedRanges)) { throw new Error("the list of ranges is not a non-overlapping sorted ranges"); - } + }*/ + sortedRanges = []; let partitionKeyRanges = []; // TODO: any ParitionKeyRanges if (sortedRanges.length === 0) { return partitionKeyRanges; diff --git a/src/Explorer/Tree/treeNodeUtil.tsx b/src/Explorer/Tree/treeNodeUtil.tsx index 8e6c94559..2e1374c7a 100644 --- a/src/Explorer/Tree/treeNodeUtil.tsx +++ b/src/Explorer/Tree/treeNodeUtil.tsx @@ -23,7 +23,8 @@ import { useSelectedNode } from "../useSelectedNode"; export const shouldShowScriptNodes = (): boolean => { return ( - configContext.platform !== Platform.Fabric && (userContext.apiType === "SQL" || userContext.apiType === "Gremlin") + //configContext.platform !== Platform.Fabric && (userContext.apiType === "SQL" || userContext.apiType === "Gremlin") + false ); };