cosmosdb-server icon indicating copy to clipboard operation
cosmosdb-server copied to clipboard

When querying from a azure function using input binding, a query plan request is made that is not mapped

Open LanPodder opened this issue 2 years ago • 1 comments

When creating a function app and a function with cosmosdb input binding and a sqlquery, two post requests are made to "/dbs/:dbId/colls/:collId/docs", one of which has the "x-ms-cosmos-is-query-plan-request: True" header. The Azure function expects a specific response from this request, after which the actual query request will be made. The expected resposne looks like this:

{
    "partitionedQueryExecutionInfoVersion": "2",
    "queryInfo": {
        "distinctType": "None",
        "top": null,
        "offset": null,
        "limit": null,
        "orderBy": [],
        "orderByExpressions": [],
        "groupByExpressions": [],
        "groupByAliases": [],
        "aggregates": [],
        "groupByAliasToAggregateType": {},
        "rewrittenQuery": "",
        "hasSelectValue": false,
        "dCountInfo": null
    },
    "queryRanges": [
        {
            "min": "05C1A3C5D33F20083200",
            "max": "05C1A3C5D33F20083200",
            "isMinInclusive": true,
            "isMaxInclusive": true
        }
    ]
}

with attribute values depending on the specific query, for instance if "order by" is added, the attributes orderBy and orderByExpressions will contain "Ascending/Descending" and the column names respectively

LanPodder avatar Jan 11 '23 16:01 LanPodder

bump

LanPodder avatar Aug 21 '23 10:08 LanPodder