#pragma once
#ifndef __cplusplus
#error "QueryPlanInterop.h must be compiled as C++."
#endif
#include <stddef.h>
#include <stdint.h>
#if defined(_WIN32)
#include <unknwn.h>
#ifdef BUILDING_QUERY_PLAN_INTEROP
#define QUERY_PLAN_INTEROP_API __declspec(dllexport)
#else
#define QUERY_PLAN_INTEROP_API __declspec(dllimport)
#endif
#else
typedef int32_t HRESULT;
typedef uint32_t ULONG;
typedef uint8_t BYTE;
typedef int32_t BOOL;
typedef const wchar_t* LPCWSTR;
typedef const char* LPCSTR;
typedef const wchar_t* LPCWCH;
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef S_OK
#define S_OK ((HRESULT)0x00000000L)
#endif
#ifndef E_FAIL
#define E_FAIL ((HRESULT)0x80004005L)
#endif
#ifndef E_POINTER
#define E_POINTER ((HRESULT)0x80004003L)
#endif
#ifndef E_INVALIDARG
#define E_INVALIDARG ((HRESULT)0x80070057L)
#endif
#ifndef E_OUTOFMEMORY
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#endif
#ifndef E_UNEXPECTED
#define E_UNEXPECTED ((HRESULT)0x8000FFFFL)
#endif
struct IID;
struct IUnknown
{
virtual HRESULT QueryInterface(const IID& riid, void** ppvObject) = 0;
virtual ULONG AddRef() = 0;
virtual ULONG Release() = 0;
};
#define QUERY_PLAN_INTEROP_API __attribute__((visibility("default")))
#endif
#ifndef SUCCEEDED
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
#endif
#ifndef FAILED
#define FAILED(hr) (((HRESULT)(hr)) < 0)
#endif
enum class QueryPlanInteropPartitionKind : int32_t
{
Hash = 0,
Range = 1,
MultiHash = 2,
};
enum class QueryPlanInteropGeospatialType : int32_t
{
Geography = 0,
Geometry = 1,
};
struct QueryPlanInteropPartitionKeyRangesApiOptions
{
BOOL bRequireFormattableOrderByQuery;
BOOL bIsContinuationExpected;
BOOL bAllowNonValueAggregateQuery;
BOOL bHasLogicalPartitionKey;
BOOL bAllowDCount;
BOOL bUseSystemPrefix;
QueryPlanInteropPartitionKind ePartitionKind;
QueryPlanInteropGeospatialType eGeospatialType;
BOOL bHybridSearchSkipOrderByRewrite;
BYTE rgbyReserved[28];
};
static_assert(sizeof(QueryPlanInteropPartitionKeyRangesApiOptions) == 64,
"QueryPlanInteropPartitionKeyRangesApiOptions ABI size must remain 64 bytes");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, bRequireFormattableOrderByQuery) == 0, "ABI offset drift");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, bIsContinuationExpected) == 4, "ABI offset drift");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, bAllowNonValueAggregateQuery) == 8, "ABI offset drift");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, bHasLogicalPartitionKey) == 12, "ABI offset drift");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, bAllowDCount) == 16, "ABI offset drift");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, bUseSystemPrefix) == 20, "ABI offset drift");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, ePartitionKind) == 24, "ABI offset drift");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, eGeospatialType) == 28, "ABI offset drift");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, bHybridSearchSkipOrderByRewrite) == 32, "ABI offset drift");
static_assert(offsetof(QueryPlanInteropPartitionKeyRangesApiOptions, rgbyReserved) == 36, "ABI offset drift");
#ifdef __cplusplus
extern "C" {
#endif
QUERY_PLAN_INTEROP_API HRESULT CreateServiceProvider(
LPCSTR pszConfigJson,
IUnknown** ppServiceProviderOut);
QUERY_PLAN_INTEROP_API HRESULT UpdateServiceProvider(
IUnknown* pServiceProvider,
LPCSTR pszConfigJson);
QUERY_PLAN_INTEROP_API HRESULT GetPartitionKeyRangesFromQuery4(
IUnknown* pServiceProvider,
LPCWSTR pwszQuerySpec,
const QueryPlanInteropPartitionKeyRangesApiOptions options,
LPCWSTR* pPartitionKeyPathTokens,
ULONG rgPartitionKeyPathTokensLengths[],
ULONG nPartitionKeyCount,
LPCWCH pwchVectorEmbeddingPolicy,
ULONG nVectorEmbeddingPolicyLength,
BYTE* pbySerializedPartitionedQueryExecutionInfoBuffer,
ULONG nSerializedPartitionedQueryExecutionInfoBufferLength,
ULONG* pnSerializedPartitionedQueryExecutionInfoResultLength);
#ifdef __cplusplus
} #endif