From cee7af73d4de126290d738372cdbc0b08f4bf96f Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 17 Jul 2023 13:36:37 -0700 Subject: [PATCH 01/36] First commit. --- .../Query/Core/ClientQL/ClientQLAggregate.cs | 12 + .../ClientQLAggregateEnumerableExpression.cs | 15 ++ .../Core/ClientQL/ClientQLAggregateKind.cs | 12 + .../ClientQL/ClientQLAggregateOperatorKind.cs | 22 ++ .../ClientQL/ClientQLAggregateSignature.cs | 12 + .../ClientQLArrayCreateScalarExpression.cs | 15 ++ .../ClientQLArrayIndexerScalarExpression.cs | 13 + .../Query/Core/ClientQL/ClientQLArrayKind.cs | 16 ++ .../ClientQLBinaryScalarExpression.cs | 15 ++ .../ClientQLBinaryScalarOperatorKind.cs | 29 +++ .../ClientQLBuiltinScalarFunctionKind.cs | 225 ++++++++++++++++++ .../Core/ClientQL/ClientQLDelegateKind.cs | 12 + .../ClientQLDistinctEnumerableExpression.cs | 16 ++ .../ClientQL/ClientQLEnumerableExpression.cs | 11 + .../ClientQLEnumerableExpressionKind.cs | 22 ++ .../Query/Core/ClientQL/ClientQLExpression.cs | 10 + .../ClientQLGroupByEnumerableExpression.cs | 16 ++ .../Query/Core/ClientQL/ClientQLGroupByKey.cs | 11 + .../ClientQLInputEnumerableExpression.cs | 14 ++ .../Core/ClientQL/ClientQLIsOperatorKind.cs | 11 + .../ClientQLIsOperatorScalarExpression.cs | 15 ++ .../ClientQL/ClientQLLetScalarExpression.cs | 16 ++ .../Query/Core/ClientQL/ClientQLLiteral.cs | 11 + .../Core/ClientQL/ClientQLLiteralKind.cs | 28 +++ .../ClientQLLiteralScalarlExpression.cs | 12 + .../ClientQL/ClientQLMuxScalarExpression.cs | 14 ++ .../ClientQLObjectCreateScalarExpression.cs | 15 ++ .../Query/Core/ClientQL/ClientQLObjectKind.cs | 12 + .../Core/ClientQL/ClientQLObjectProperty.cs | 12 + .../ClientQLPropertyRefScalarExpression.cs | 15 ++ .../Core/ClientQL/ClientQLScalarExpression.cs | 11 + .../ClientQL/ClientQLScalarExpressionKind.cs | 25 ++ .../ClientQLSelectEnumerableExpression.cs | 14 ++ ...entQLSystemFunctionCallScalarExpression.cs | 15 ++ .../ClientQLTupleCreateScalarExpression.cs | 14 ++ .../ClientQLTupleItemRefScalarExpression.cs | 13 + .../src/Query/Core/ClientQL/ClientQLType.cs | 11 + .../Query/Core/ClientQL/ClientQLTypeKind.cs | 13 + .../ClientQL/ClientQLUnaryScalarExpression.cs | 13 + .../Query/Core/ClientQL/ClientQLVariable.cs | 12 + .../ClientQLVariableRefScalarExpression.cs | 12 + .../ClietnQLUnaryScalarOperatorKind.cs | 14 ++ .../ClientQL/CoordinatorDistributionPlan.cs | 11 + 43 files changed, 837 insertions(+) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateOperatorKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarOperatorKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinScalarFunctionKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegateKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpressionKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByKey.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLInputEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralScalarlExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleCreateScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLType.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTypeKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariableRefScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClietnQLUnaryScalarOperatorKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/CoordinatorDistributionPlan.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs new file mode 100644 index 0000000000..fdedde6f69 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLAggregate + { + public ClientQLAggregateKind Kind { get; set; } + public string OperatorKind { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs new file mode 100644 index 0000000000..7739c4232d --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System; + + internal class ClientQLAggregateEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLAggregate Aggregate { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateKind.cs new file mode 100644 index 0000000000..a350b1577a --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateKind.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLAggregateKind + { + Builtin, + Tuple, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateOperatorKind.cs new file mode 100644 index 0000000000..956ba52eac --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateOperatorKind.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLAggregateOperatorKind + { + All, + Any, + Array, + CMax, + CMin, + Count, + CSum, + First, + Last, + Max, + Min, + Sum, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs new file mode 100644 index 0000000000..7bd4539adf --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLAggregateSignature + { + public ClientQLTypeKind ItemType { get; set; } + public ClientQLTypeKind ResultType { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs new file mode 100644 index 0000000000..4c0a5d1fd7 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLArrayCreateScalarExpression : ClientQLScalarExpression + { + public ClientQLArrayKind ArrayKind { get; set; } + public List VecItems { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs new file mode 100644 index 0000000000..8f28e711f4 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLArrayIndexerScalarExpression : ClientQLScalarExpression + { + public ClientQLScalarExpression Expression { get; set; } + public int Index { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayKind.cs new file mode 100644 index 0000000000..10e62f414d --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayKind.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLArrayKind + { + Array, + CList, + CMap, + CSet, + CTuple, + MArray + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs new file mode 100644 index 0000000000..1bd102a47e --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLBinaryScalarExpression : ClientQLScalarExpression + { + public ClientQLBinaryScalarOperatorKind OperatorKind { get; set; } + public int MaxDepth { get; set; } + public ClientQLScalarExpression LeftExpression { get; set; } + public ClientQLScalarExpression RightExpression { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarOperatorKind.cs new file mode 100644 index 0000000000..98eb30eae2 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarOperatorKind.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLBinaryScalarOperatorKind + { + Add, + And, + BitwiseAnd, + BitwiseOr, + BitwiseXor, + Divide, + Equal, + GreaterThan, + GreaterThanOrEqual, + LeftShift, + LessThan, + LessThanOrEqual, + Modulo, + Multiply, + NotEqual, + Or, + RightShift, + Subtract, + ZeroFillRightShift + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinScalarFunctionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinScalarFunctionKind.cs new file mode 100644 index 0000000000..491ddb1c0b --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinScalarFunctionKind.cs @@ -0,0 +1,225 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLBuiltinScalarFunctionKind + { + _C_Compare_EQ, + _C_Compare_GT, + _C_Compare_GTE, + _C_Compare_LT, + _C_Compare_LTE, + _C_Compare_NEQ, + _C_ComputeAvg, + _C_ConvertToNumber, + _Compare_Bson_BinaryData, + _Compare_Objects, + _EpkInRange, + _M_Abs, + _M_Acos, + _M_Asin, + _M_Atan, + _M_Atan2, + _M_Binary, + _M_Ceil, + _M_Convert, + _M_Compare_EQ, + _M_Compare_GT, + _M_Compare_GTE, + _M_Compare_LT, + _M_Compare_LTE, + _M_Compare_NEQ, + _M_Cos, + _M_Date, + _M_DegreesToRadians, + _M_Divide, + _M_Double, + _M_Eval_EQ, + _M_Eval_GT, + _M_Eval_GTE, + _M_Eval_IN, + _M_Eval_IsDefined, + _M_Eval_LT, + _M_Eval_LTE, + _M_Eval_NEQ, + _M_Eval_NIN, + _M_Eval_NotIsDefined, + _M_Eval_NotRegex, + _M_Eval_Regex, + _M_Exp, + _M_Floor, + _M_Int32, + _M_Int64, + _M_JavaScript, + _M_Ln, + _M_Log10, + _M_Ltrim, + _M_MaxKey, + _M_MinKey, + _M_Mod, + _M_Multiply, + _M_ObjectId, + _M_Pow, + _M_RadiansToDegrees, + _M_Regex, + _M_Rtrim, + _M_Sin, + _M_Sqrt, + _M_Symbol, + _M_Tan, + _M_Timestamp, + _M_ToBool, + _M_ToDate, + _M_ToDouble, + _M_ToInt, + _M_ToLong, + _M_ToObjectId, + _M_ToString, + _M_Trim, + _M_Undefined, + _ObjectToArray, + _Proxy_Projection, + _Regex_Match, + _ST_Distance, + _ST_Intersects, + _ST_Within, + _Try_Array_Contains, + Abs, + Acos, + All, + Any, + Array, + Array_Concat, + Array_Contains, + Array_Length, + Array_Slice, + Asin, + Atan, + Atn2, + Avg, + C_Binary, + C_Float32, + C_Float64, + C_Guid, + C_Int16, + C_Int32, + C_Int64, + C_Int8, + C_List, + C_ListContains, + C_Map, + C_MapContains, + C_MapContainsKey, + C_MapContainsValue, + C_Set, + C_SetContains, + C_Tuple, + C_Udt, + C_UInt32, + Ceiling, + Choose, + Concat, + Contains, + Cos, + Cot, + Count, + DateTimeAdd, + DateTimeBin, + DateTimeDiff, + DateTimeFromParts, + DateTimePart, + DateTimeToTicks, + DateTimeToTimestamp, + Degrees, + DocumentId, + EndsWith, + Exp, + First, + Floor, + GetCurrentDateTime, + GetCurrentDateTimeStatic, + GetCurrentTicks, + GetCurrentTicksStatic, + GetCurrentTimestamp, + GetCurrentTimestampStatic, + Iif, + Index_Of, + IntAdd, + IntBitAnd, + IntBitLeftShift, + IntBitNot, + IntBitOr, + IntBitRightShift, + IntBitXor, + IntDiv, + IntMod, + IntMul, + IntSub, + Is_Array, + Is_Bool, + Is_DateTime, + Is_Defined, + Is_Finite_Number, + Is_Integer, + Is_Null, + Is_Number, + Is_Object, + Is_Primitive, + Is_String, + Last, + LastIndexOf, + Left, + Length, + Like, + Log, + Log10, + Lower, + Ltrim, + Max, + Min, + NumberBin, + ObjectToArray, + Pi, + Power, + Radians, + Rand, + RegexMatch, + Replace, + Replicate, + Reverse, + Right, + Round, + Rtrim, + SetDifference, + SetIntersect, + SetUnion, + Sign, + Sin, + Sqrt, + Square, + ST_Area, + ST_Distance, + ST_Intersects, + ST_IsValid, + ST_IsValidDetailed, + ST_Within, + StartsWith, + StringEquals, + StringToArray, + StringToBoolean, + StringToNull, + StringToNumber, + StringToObject, + Substring, + Sum, + Tan, + TicksToDateTime, + TimestampToDateTime, + ToString, + Trim, + Trunc, + Upper + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegateKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegateKind.cs new file mode 100644 index 0000000000..b50b1176bd --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegateKind.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLDelegateKind + { + JavaScript, + ScalarExpression, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs new file mode 100644 index 0000000000..ea2b55b109 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLDistinctEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLVariable DeclaredVariable { get; set; } + public List VecExpression { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpression.cs new file mode 100644 index 0000000000..bea893d96f --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpression.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLEnumerableExpression : ClientQLExpression + { + public ClientQLEnumerableExpressionKind Kind { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpressionKind.cs new file mode 100644 index 0000000000..0f95ab453d --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpressionKind.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLEnumerableExpressionKind + { + Aggregate, + Distinct, + GroupBy, + Flatten, + Input, + OrderBy, + ScalarAsEnumerable, + Select, + SelectMany, + Take, + Unwind, + Where, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLExpression.cs new file mode 100644 index 0000000000..0bdaff0ece --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLExpression.cs @@ -0,0 +1,10 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLExpression + { + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs new file mode 100644 index 0000000000..d9048f162a --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLGroupByEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLEnumerableExpression SourceExpression { get; set; } + public List VecKeys { get; set; } + public List VecAggregates { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByKey.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByKey.cs new file mode 100644 index 0000000000..7315507c6c --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByKey.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLGroupByKey + { + public ClientQLType Type { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLInputEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLInputEnumerableExpression.cs new file mode 100644 index 0000000000..d433f94813 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLInputEnumerableExpression.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System; + + internal class ClientQLInputEnumerableExpression : ClientQLEnumerableExpression + { + public string Name { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorKind.cs new file mode 100644 index 0000000000..0e333e9ac1 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorKind.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLIsOperatorKind + { + Defined, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs new file mode 100644 index 0000000000..8d52cdb736 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLIsOperatorScalarExpression : ClientQLScalarExpression + { + public ClientQLIsOperatorKind OperatorKind { get; set; } + public ClientQLScalarExpression Expression { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs new file mode 100644 index 0000000000..952594d62d --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLLetScalarExpression : ClientQLScalarExpression + { + public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLScalarExpression DeclaredVariableExpression { get; set; } + public ClientQLScalarExpression Expression { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteral.cs new file mode 100644 index 0000000000..bfb166a065 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLLiteral + { + public ClientQLTypeKind Kind { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralKind.cs new file mode 100644 index 0000000000..a0c61adba3 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralKind.cs @@ -0,0 +1,28 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLLiteralKind + { + Undefined, + Array, + Binary, + Boolean, + CGuid, + CNumber, + MDateTime, + MJavaScript, + MNumber, + MObjectId, + MRegex, + MSingleton, + MSymbol, + MTimestamp, + Null, + Number, + Object, + String, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralScalarlExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralScalarlExpression.cs new file mode 100644 index 0000000000..ea7ea18ed1 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralScalarlExpression.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLLiteralScalarlExpression : ClientQLScalarExpression + { + public ClientQLLiteral Literal { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs new file mode 100644 index 0000000000..0e751185f0 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLMuxScalarExpression : ClientQLScalarExpression + { + public ClientQLScalarExpression ConditionExpression { get; set; } + public ClientQLScalarExpression LeftExpression { get; set; } + public ClientQLScalarExpression RightExpression { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs new file mode 100644 index 0000000000..9ce783dfb3 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLObjectCreateScalarExpression : ClientQLScalarExpression + { + public List Properties { get; set; } + public ClientQLObjectKind ObjectKind { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectKind.cs new file mode 100644 index 0000000000..9365ca7ed8 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectKind.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLObjectKind + { + CUdt, + Object + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs new file mode 100644 index 0000000000..2d339e63c8 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLObjectProperty + { + public string Name { get; set; } + public ClientQLScalarExpression Expression { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs new file mode 100644 index 0000000000..c1e4f59ce4 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLPropertyRefScalarExpression : ClientQLScalarExpression + { + public ClientQLScalarExpression Expression { get; set; } + public string PropertyName { get; set; } //might need to be changed + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpression.cs new file mode 100644 index 0000000000..021a523f02 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpression.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLScalarExpression : ClientQLExpression + { + public ClientQLEnumerableExpressionKind Kind { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionKind.cs new file mode 100644 index 0000000000..775e8dda35 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionKind.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLScalarExpressionKind + { + ArrayCreate, + ArrayIndexer, + BinaryOperator, + IsOperator, + Let, + Literal, + Mux, + ObjectCreate, + PropertyRef, + SystemFunctionCall, + TupleCreate, + TupleItemRef, + UnaryOperator, + UserDefinedFunctionCall, + VariableRef, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs new file mode 100644 index 0000000000..5276198aa3 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLSelectEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLScalarExpression Expression { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs new file mode 100644 index 0000000000..e41186a95f --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLSystemFunctionCallScalarExpression : ClientQLScalarExpression + { + public ClientQLBuiltinScalarFunctionKind FunctionKind { get; set; } + public List VecArguments { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleCreateScalarExpression.cs new file mode 100644 index 0000000000..da0af9e7a0 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleCreateScalarExpression.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLTupleCreateScalarExpression : ClientQLScalarExpression + { + public List VecItems { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs new file mode 100644 index 0000000000..9a44f145b9 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLTupleItemRefScalarExpression : ClientQLScalarExpression + { + public ClientQLScalarExpression Expression { get; set; } + public int Index { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLType.cs new file mode 100644 index 0000000000..407937d937 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLType.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLType + { + public ClientQLTypeKind Kind { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTypeKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTypeKind.cs new file mode 100644 index 0000000000..50fdf0dfe4 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTypeKind.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLTypeKind + { + Base, + Enum, + Tuple, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs new file mode 100644 index 0000000000..e4cf70dab7 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLUnaryScalarExpression : ClientQLScalarExpression + { + public ClientQLUnaryScalarExpression OperatorKind { get; set; } + public ClientQLScalarExpression Expression { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs new file mode 100644 index 0000000000..ef0f98cfe6 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLVariable + { + public string Name { get; set; } + public int UniqueId { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariableRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariableRefScalarExpression.cs new file mode 100644 index 0000000000..fcaa77fa6f --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariableRefScalarExpression.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLVariableRefScalarExpression : ClientQLScalarExpression + { + public ClientQLVariable Variable { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClietnQLUnaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClietnQLUnaryScalarOperatorKind.cs new file mode 100644 index 0000000000..2e40040120 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClietnQLUnaryScalarOperatorKind.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClietnQLUnaryScalarOperatorKind + { + BitwiseNot, + Minus, + Not, + Plus, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/CoordinatorDistributionPlan.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/CoordinatorDistributionPlan.cs new file mode 100644 index 0000000000..d87b308477 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/CoordinatorDistributionPlan.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class CoordinatorDistributionPlan + { + public ClientQLExpression ClientQL { get; set; } + } +} \ No newline at end of file From 3e5450ce486cad23d368b62715dcfe2503195974 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 31 Jul 2023 12:21:06 -0700 Subject: [PATCH 02/36] Added remaining classes for ClientQL structure --- .../Query/Core/ClientQL/ClientQLAggregate.cs | 1 + .../ClientQLAggregateEnumerableExpression.cs | 1 + .../ClientQL/ClientQLAggregateSignature.cs | 1 + .../ClientQLArrayCreateScalarExpression.cs | 1 + .../ClientQLArrayIndexerScalarExpression.cs | 1 + .../Core/ClientQL/ClientQLArrayLiteral.cs | 11 ++++++++ .../Query/Core/ClientQL/ClientQLBaseType.cs | 11 ++++++++ .../Core/ClientQL/ClientQLBaseTypeKind.cs | 27 +++++++++++++++++++ .../Core/ClientQL/ClientQLBinaryLiteral.cs | 12 +++++++++ .../ClientQLBinaryScalarExpression.cs | 3 +++ .../Core/ClientQL/ClientQLBooleanLiteral.cs | 11 ++++++++ .../Core/ClientQL/ClientQLBuiltinAggregate.cs | 11 ++++++++ .../Core/ClientQL/ClientQLCGuidLiteral.cs | 11 ++++++++ .../Query/Core/ClientQL/ClientQLDelegate.cs | 13 +++++++++ .../ClientQLDistinctEnumerableExpression.cs | 2 ++ .../Query/Core/ClientQL/ClientQLEnumType.cs | 11 ++++++++ .../Core/ClientQL/ClientQLEnumerationKind.cs | 14 ++++++++++ .../ClientQLFlattenEnumerableExpression.cs | 14 ++++++++++ .../ClientQL/ClientQLFunctionIdentifier.cs | 11 ++++++++ .../ClientQLGroupByEnumerableExpression.cs | 2 ++ .../Core/ClientQL/ClientQLILMRegexLiteral.cs | 13 +++++++++ .../ClientQLIsOperatorScalarExpression.cs | 1 + .../ClientQL/ClientQLLetScalarExpression.cs | 2 ++ .../Core/ClientQL/ClientQLMDateTimeLiteral.cs | 11 ++++++++ .../ClientQL/ClientQLMJavaScriptLiteral.cs | 11 ++++++++ .../Core/ClientQL/ClientQLMNumberLiteral.cs | 11 ++++++++ .../ClientQL/ClientQLMSingletonLiteral.cs | 18 +++++++++++++ .../Core/ClientQL/ClientQLMSymbolLiteral.cs | 11 ++++++++ .../ClientQL/ClientQLMuxScalarExpression.cs | 2 ++ .../Core/ClientQL/ClientQLNumberLiteral.cs | 11 ++++++++ .../ClientQLObjectCreateScalarExpression.cs | 1 + .../Core/ClientQL/ClientQLObjectLiteral.cs | 11 ++++++++ .../ClientQL/ClientQLObjectLiteralProperty.cs | 13 +++++++++ .../Core/ClientQL/ClientQLObjectProperty.cs | 1 + .../ClientQLOrderByEnumerableExpression.cs | 18 +++++++++++++ .../Core/ClientQL/ClientQLOrderByItem.cs | 13 +++++++++ .../Query/Core/ClientQL/ClientQLProgram.cs | 11 ++++++++ .../ClientQLPropertyRefScalarExpression.cs | 1 + .../ClientQLScalarAsEnumerableExpression.cs | 16 +++++++++++ .../ClientQLScalarExpressionDelegate.cs | 13 +++++++++ .../ClientQLSelectEnumerableExpression.cs | 2 ++ .../ClientQLSelectManyEnumerableExpression.cs | 18 +++++++++++++ .../Query/Core/ClientQL/ClientQLSortOrder.cs | 12 +++++++++ .../Core/ClientQL/ClientQLStringLiteral.cs | 12 +++++++++ ...entQLSystemFunctionCallScalarExpression.cs | 1 + .../ClientQLTakeEnumerableExpression.cs | 18 +++++++++++++ .../Core/ClientQL/ClientQLTupleAggregate.cs | 11 ++++++++ .../ClientQLTupleItemRefScalarExpression.cs | 1 + .../Query/Core/ClientQL/ClientQLTupleType.cs | 12 +++++++++ .../ClientQL/ClientQLUnaryScalarExpression.cs | 3 ++- .../ClientQLUnaryScalarOperatorKind.cs | 14 ++++++++++ ...UserDefinedFunctionCallScalarExpression.cs | 16 +++++++++++ .../Query/Core/ClientQL/ClientQLVariable.cs | 1 + .../ClientQLWhereEnumerableExpression.cs | 16 +++++++++++ 54 files changed, 494 insertions(+), 1 deletion(-) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseType.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseTypeKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBooleanLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinAggregate.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLCGuidLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegate.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumType.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerationKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFlattenEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFunctionIdentifier.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLILMRegexLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMDateTimeLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMJavaScriptLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMNumberLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSingletonLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSymbolLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLNumberLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteralProperty.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByItem.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLProgram.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarAsEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionDelegate.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectManyEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSortOrder.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLStringLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTakeEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleAggregate.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleType.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarOperatorKind.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLWhereEnumerableExpression.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs index fdedde6f69..50c71f1883 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLAggregate { public ClientQLAggregateKind Kind { get; set; } + public string OperatorKind { get; set; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs index 7739c4232d..d31516521f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs @@ -9,6 +9,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLAggregateEnumerableExpression : ClientQLEnumerableExpression { public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLAggregate Aggregate { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs index 7bd4539adf..8edc0e4d20 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLAggregateSignature { public ClientQLTypeKind ItemType { get; set; } + public ClientQLTypeKind ResultType { get; set; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs index 4c0a5d1fd7..600255f7fa 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs @@ -9,6 +9,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLArrayCreateScalarExpression : ClientQLScalarExpression { public ClientQLArrayKind ArrayKind { get; set; } + public List VecItems { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs index 8f28e711f4..0edf37f95c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLArrayIndexerScalarExpression : ClientQLScalarExpression { public ClientQLScalarExpression Expression { get; set; } + public int Index { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayLiteral.cs new file mode 100644 index 0000000000..ee939825f2 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLArrayLiteral : ClientQLLiteral + { + public List VecItems { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseType.cs new file mode 100644 index 0000000000..bff7f7a7ea --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseType.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLBaseType : ClientQLType + { + public bool ExcludesUndefined { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseTypeKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseTypeKind.cs new file mode 100644 index 0000000000..ac35396ca9 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseTypeKind.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLBaseTypeKind + { + Array, + Binary, + Boolean, + CGuid, + CNumber, + MDateTime, + MJavaScript, + MNumber, + MObjectId, + MRegex, + MSingleton, + MSymbol, + MTimestamp, + Number, + Object, + String, + Variant, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryLiteral.cs new file mode 100644 index 0000000000..906fd66b75 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryLiteral.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLBinaryLiteral : ClientQLLiteral + { + // Dont know what should go inside + //const LinearAllocBuffer m_value; + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs index 1bd102a47e..aa87dd037c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs @@ -7,8 +7,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLBinaryScalarExpression : ClientQLScalarExpression { public ClientQLBinaryScalarOperatorKind OperatorKind { get; set; } + public int MaxDepth { get; set; } + public ClientQLScalarExpression LeftExpression { get; set; } + public ClientQLScalarExpression RightExpression { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBooleanLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBooleanLiteral.cs new file mode 100644 index 0000000000..1ba766fad8 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBooleanLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLBooleanLiteral : ClientQLLiteral + { + public bool Value { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinAggregate.cs new file mode 100644 index 0000000000..179c85b45d --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinAggregate.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLBuiltinAggregate : ClientQLAggregate + { + public ClientQLAggregateOperatorKind OperatorKind { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLCGuidLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLCGuidLiteral.cs new file mode 100644 index 0000000000..2deb03d322 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLCGuidLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLCGuidLiteral : ClientQLLiteral + { + public Guid Value { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegate.cs new file mode 100644 index 0000000000..704244abfa --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegate.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLDelegate + { + public ClientQLDelegateKind Kind { get; set; } + + public ClientQLType Type { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs index ea2b55b109..ee4ddfbc0b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs @@ -9,7 +9,9 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLDistinctEnumerableExpression : ClientQLEnumerableExpression { public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLVariable DeclaredVariable { get; set; } + public List VecExpression { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumType.cs new file mode 100644 index 0000000000..d2401fe074 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumType.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLEnumType : ClientQLType + { + public ClientQLType ItemType { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerationKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerationKind.cs new file mode 100644 index 0000000000..8bfc80fecd --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerationKind.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLEnumerationKind + { + ArrayItems, + PropertyValues, + Children, + Descendants, + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFlattenEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFlattenEnumerableExpression.cs new file mode 100644 index 0000000000..29b63566fd --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFlattenEnumerableExpression.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System; + + internal class ClientQLFlattenEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLEnumerableExpression SourceExpression { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFunctionIdentifier.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFunctionIdentifier.cs new file mode 100644 index 0000000000..af380bdce8 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFunctionIdentifier.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLFunctionIdentifier + { + public string StrName { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs index d9048f162a..09ff560630 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs @@ -9,7 +9,9 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLGroupByEnumerableExpression : ClientQLEnumerableExpression { public ClientQLEnumerableExpression SourceExpression { get; set; } + public List VecKeys { get; set; } + public List VecAggregates { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLILMRegexLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLILMRegexLiteral.cs new file mode 100644 index 0000000000..71532927f1 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLILMRegexLiteral.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLILMRegexLiteral : ClientQLLiteral + { + public string StrPatter { get; set; } + + public string StrOption { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs index 8d52cdb736..34e9d952b2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs @@ -9,6 +9,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLIsOperatorScalarExpression : ClientQLScalarExpression { public ClientQLIsOperatorKind OperatorKind { get; set; } + public ClientQLScalarExpression Expression { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs index 952594d62d..cc89b8d65d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs @@ -9,7 +9,9 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLLetScalarExpression : ClientQLScalarExpression { public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLScalarExpression DeclaredVariableExpression { get; set; } + public ClientQLScalarExpression Expression { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMDateTimeLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMDateTimeLiteral.cs new file mode 100644 index 0000000000..7e0374a0dd --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMDateTimeLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLMDateTimeLiteral : ClientQLLiteral + { + public int Value { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMJavaScriptLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMJavaScriptLiteral.cs new file mode 100644 index 0000000000..287bc52393 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMJavaScriptLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLMJavaScriptLiteral : ClientQLLiteral + { + public string StrName { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMNumberLiteral.cs new file mode 100644 index 0000000000..cab82e5a6f --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMNumberLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLMNumberLiteral : ClientQLLiteral + { + public int Value { get; set; } // might need to be changed MNumber + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSingletonLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSingletonLiteral.cs new file mode 100644 index 0000000000..23f52b43ec --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSingletonLiteral.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLMSingletonLiteral : ClientQLLiteral + { + public enum Kind + { + MaxKey, + MinKey, + Undefined + }; + + public Kind SingletonKind { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSymbolLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSymbolLiteral.cs new file mode 100644 index 0000000000..1c3036fb11 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSymbolLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLMSymbolLiteral : ClientQLLiteral + { + public string StrValue { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs index 0e751185f0..6b1e0c94ee 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs @@ -7,7 +7,9 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLMuxScalarExpression : ClientQLScalarExpression { public ClientQLScalarExpression ConditionExpression { get; set; } + public ClientQLScalarExpression LeftExpression { get; set; } + public ClientQLScalarExpression RightExpression { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLNumberLiteral.cs new file mode 100644 index 0000000000..1a12a066b7 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLNumberLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLNumberLiteral : ClientQLLiteral + { + public Int64 Value { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs index 9ce783dfb3..3d52c93ce8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs @@ -9,6 +9,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLObjectCreateScalarExpression : ClientQLScalarExpression { public List Properties { get; set; } + public ClientQLObjectKind ObjectKind { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteral.cs new file mode 100644 index 0000000000..a7327153ba --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteral.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLObjectLiteral : ClientQLLiteral + { + public List VecProperties { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteralProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteralProperty.cs new file mode 100644 index 0000000000..2cb447ffb1 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteralProperty.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLObjectLiteralProperty : ClientQLLiteral + { + public string StrName { get; set; } + + public ClientQLLiteral Literal { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs index 2d339e63c8..f72f7a1203 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLObjectProperty { public string Name { get; set; } + public ClientQLScalarExpression Expression { get; set; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByEnumerableExpression.cs new file mode 100644 index 0000000000..97acc2b5d7 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByEnumerableExpression.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System; + + internal class ClientQLOrderByEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLEnumerableExpression SourceExpression { get; set; } + + public ClientQLVariable DeclaredVariable { get; set; } + + public List VecItems { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByItem.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByItem.cs new file mode 100644 index 0000000000..e7b72c2792 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByItem.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLOrderByItem + { + public ClientQLScalarExpression Expression { get; set; } + + public ClientQLSortOrder SortOrder { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLProgram.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLProgram.cs new file mode 100644 index 0000000000..4f2ad0a567 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLProgram.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLProgram + { + public ClientQLEnumerableExpression Expression { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs index c1e4f59ce4..6b43787c89 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs @@ -9,6 +9,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLPropertyRefScalarExpression : ClientQLScalarExpression { public ClientQLScalarExpression Expression { get; set; } + public string PropertyName { get; set; } //might need to be changed } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarAsEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarAsEnumerableExpression.cs new file mode 100644 index 0000000000..3d436798e0 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarAsEnumerableExpression.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System; + + internal class ClientQLScalarAsEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLScalarExpression Expression { get; set; } + + public ClientQLEnumerationKind EnumerationKind { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionDelegate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionDelegate.cs new file mode 100644 index 0000000000..0690e66770 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionDelegate.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLScalarExpressionDelegate : ClientQLDelegate + { + public ClientQLVariable DeclaredVariable { get; set; } + + public ClientQLScalarExpression Expression { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs index 5276198aa3..6f1fc9ddcc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs @@ -7,7 +7,9 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLSelectEnumerableExpression : ClientQLEnumerableExpression { public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLScalarExpression Expression { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectManyEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectManyEnumerableExpression.cs new file mode 100644 index 0000000000..9e3affb0dc --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectManyEnumerableExpression.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System; + + internal class ClientQLSelectManyEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLEnumerableExpression SourceExpression { get; set; } + + public ClientQLVariable DeclaredVariable { get; set; } + + public ClientQLEnumerableExpression SelectorExpression { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSortOrder.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSortOrder.cs new file mode 100644 index 0000000000..3626ac5078 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSortOrder.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLSortOrder + { + Ascending, + Descending + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLStringLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLStringLiteral.cs new file mode 100644 index 0000000000..808bcc749a --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLStringLiteral.cs @@ -0,0 +1,12 @@ + +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLStringLiteral : ClientQLLiteral + { + public string StrValue { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs index e41186a95f..17841084b3 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs @@ -9,6 +9,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLSystemFunctionCallScalarExpression : ClientQLScalarExpression { public ClientQLBuiltinScalarFunctionKind FunctionKind { get; set; } + public List VecArguments { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTakeEnumerableExpression.cs new file mode 100644 index 0000000000..7ceb065dea --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTakeEnumerableExpression.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System; + + internal class ClientQLTakeEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLEnumerableExpression SourceExpression { get; set; } + + public int SkipValue { get; set; } + + public int TakeValue { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleAggregate.cs new file mode 100644 index 0000000000..096a980ecf --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleAggregate.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLTupleAggregate : ClientQLAggregate + { + public List VecItems { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs index 9a44f145b9..20eb749675 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLTupleItemRefScalarExpression : ClientQLScalarExpression { public ClientQLScalarExpression Expression { get; set; } + public int Index { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleType.cs new file mode 100644 index 0000000000..2ca808a546 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleType.cs @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLTupleType : ClientQLType + { + public List VecTypes { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs index e4cf70dab7..e1a174e2c2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs @@ -6,7 +6,8 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL { internal class ClientQLUnaryScalarExpression : ClientQLScalarExpression { - public ClientQLUnaryScalarExpression OperatorKind { get; set; } + public ClientQLUnaryScalarOperatorKind OperatorKind { get; set; } + public ClientQLScalarExpression Expression { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarOperatorKind.cs new file mode 100644 index 0000000000..d653774b06 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarOperatorKind.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal enum ClientQLUnaryScalarOperatorKind + { + BitwiseNot, + Minus, + Not, + Plus + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs new file mode 100644 index 0000000000..cdbb40fd8b --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + internal class ClientQLUserDefinedFunctionCallScalarExpression : ClientQLScalarExpression + { + public ClientQLFunctionIdentifier Identifier { get; set; } + + public List VecArguments { get; set; } + + public bool Builtin { get; set; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs index ef0f98cfe6..311f1ef60c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL internal class ClientQLVariable { public string Name { get; set; } + public int UniqueId { get; set; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLWhereEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLWhereEnumerableExpression.cs new file mode 100644 index 0000000000..8bde14e49f --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLWhereEnumerableExpression.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +{ + using System; + + internal class ClientQLWhereEnumerableExpression : ClientQLEnumerableExpression + { + public ClientQLEnumerableExpression SourceExpression { get; set; } + + public ClientQLDelegate Delegate { get; set; } + } + +} \ No newline at end of file From a934da3c7441730d811683984a00deead1fdd4fd Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 31 Jul 2023 16:33:14 -0700 Subject: [PATCH 03/36] Added ClientQLDeserializing class and added CoordinatorDistributionPlan folder --- .../ClientQL/ClientQLAggregate.cs | 2 +- .../ClientQLAggregateEnumerableExpression.cs | 2 +- .../ClientQL/ClientQLAggregateKind.cs | 2 +- .../ClientQL/ClientQLAggregateOperatorKind.cs | 2 +- .../ClientQL/ClientQLAggregateSignature.cs | 2 +- .../ClientQLArrayCreateScalarExpression.cs | 2 +- .../ClientQLArrayIndexerScalarExpression.cs | 2 +- .../ClientQL/ClientQLArrayKind.cs | 2 +- .../ClientQL/ClientQLArrayLiteral.cs | 4 +- .../ClientQL/ClientQLBaseType.cs | 2 +- .../ClientQL/ClientQLBaseTypeKind.cs | 2 +- .../ClientQL/ClientQLBinaryLiteral.cs | 2 +- .../ClientQLBinaryScalarExpression.cs | 2 +- .../ClientQLBinaryScalarOperatorKind.cs | 2 +- .../ClientQL/ClientQLBooleanLiteral.cs | 2 +- .../ClientQL/ClientQLBuiltinAggregate.cs | 4 +- .../ClientQLBuiltinScalarFunctionKind.cs | 2 +- .../ClientQL/ClientQLCGuidLiteral.cs | 4 +- .../ClientQL/ClientQLDelegate.cs | 2 +- .../ClientQL/ClientQLDelegateKind.cs | 2 +- .../ClientQLDistinctEnumerableExpression.cs | 2 +- .../ClientQL/ClientQLEnumType.cs | 2 +- .../ClientQL/ClientQLEnumerableExpression.cs | 2 +- .../ClientQLEnumerableExpressionKind.cs | 2 +- .../ClientQL/ClientQLEnumerationKind.cs | 2 +- .../ClientQL/ClientQLExpression.cs | 2 +- .../ClientQLFlattenEnumerableExpression.cs | 2 +- .../ClientQL/ClientQLFunctionIdentifier.cs | 2 +- .../ClientQLGroupByEnumerableExpression.cs | 2 +- .../ClientQL/ClientQLGroupByKey.cs | 2 +- .../ClientQL/ClientQLILMRegexLiteral.cs | 2 +- .../ClientQLInputEnumerableExpression.cs | 2 +- .../ClientQL/ClientQLIsOperatorKind.cs | 2 +- .../ClientQLIsOperatorScalarExpression.cs | 2 +- .../ClientQL/ClientQLLetScalarExpression.cs | 2 +- .../ClientQL/ClientQLLiteral.cs | 4 +- .../ClientQL/ClientQLLiteralKind.cs | 2 +- .../ClientQLLiteralScalarExpression.cs} | 4 +- .../ClientQL/ClientQLMDateTimeLiteral.cs | 2 +- .../ClientQL/ClientQLMJavaScriptLiteral.cs | 2 +- .../ClientQL/ClientQLMNumberLiteral.cs | 2 +- .../ClientQL/ClientQLMSingletonLiteral.cs | 14 +- .../ClientQL/ClientQLMSymbolLiteral.cs | 2 +- .../ClientQL/ClientQLMuxScalarExpression.cs | 2 +- .../ClientQL/ClientQLNumberLiteral.cs | 4 +- .../ClientQLObjectCreateScalarExpression.cs | 2 +- .../ClientQL/ClientQLObjectKind.cs | 2 +- .../ClientQL/ClientQLObjectLiteral.cs | 4 +- .../ClientQL/ClientQLObjectLiteralProperty.cs | 2 +- .../ClientQL/ClientQLObjectProperty.cs | 2 +- .../ClientQLOrderByEnumerableExpression.cs | 3 +- .../ClientQL/ClientQLOrderByItem.cs | 2 +- .../ClientQL/ClientQLProgram.cs | 2 +- .../ClientQLPropertyRefScalarExpression.cs | 2 +- .../ClientQLScalarAsEnumerableExpression.cs | 2 +- .../ClientQL/ClientQLScalarExpression.cs | 4 +- .../ClientQLScalarExpressionDelegate.cs | 2 +- .../ClientQL/ClientQLScalarExpressionKind.cs | 2 +- .../ClientQLSelectEnumerableExpression.cs | 2 +- .../ClientQLSelectManyEnumerableExpression.cs | 2 +- .../ClientQL/ClientQLSortOrder.cs | 2 +- .../ClientQL/ClientQLStringLiteral.cs | 5 +- ...entQLSystemFunctionCallScalarExpression.cs | 2 +- .../ClientQLTakeEnumerableExpression.cs | 2 +- .../ClientQL/ClientQLTupleAggregate.cs | 4 +- .../ClientQLTupleCreateScalarExpression.cs | 2 +- .../ClientQLTupleItemRefScalarExpression.cs | 2 +- .../ClientQL/ClientQLTupleType.cs | 4 +- .../ClientQL/ClientQLType.cs | 2 +- .../ClientQL/ClientQLTypeKind.cs | 2 +- .../ClientQL/ClientQLUnaryScalarExpression.cs | 2 +- .../ClientQLUnaryScalarOperatorKind.cs | 2 +- ...UserDefinedFunctionCallScalarExpression.cs | 4 +- .../ClientQL/ClientQLVariable.cs | 2 +- .../ClientQLVariableRefScalarExpression.cs | 2 +- .../ClientQLWhereEnumerableExpression.cs | 2 +- .../ClietnQLUnaryScalarOperatorKind.cs | 2 +- .../ClientQL/CoordinatorDistributionPlan.cs | 2 +- .../ClientQLDeserializer.cs | 265 ++++++++++++++++++ 79 files changed, 367 insertions(+), 92 deletions(-) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLAggregate.cs (81%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLAggregateEnumerableExpression.cs (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLAggregateKind.cs (77%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLAggregateOperatorKind.cs (83%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLAggregateSignature.cs (82%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLArrayCreateScalarExpression.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLArrayIndexerScalarExpression.cs (83%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLArrayKind.cs (80%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLArrayLiteral.cs (73%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLBaseType.cs (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLBaseTypeKind.cs (86%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLBinaryLiteral.cs (81%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLBinaryScalarExpression.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLBinaryScalarOperatorKind.cs (88%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLBooleanLiteral.cs (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLBuiltinAggregate.cs (63%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLBuiltinScalarFunctionKind.cs (98%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLCGuidLiteral.cs (67%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLDelegate.cs (81%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLDelegateKind.cs (78%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLDistinctEnumerableExpression.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLEnumType.cs (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLEnumerableExpression.cs (80%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLEnumerableExpressionKind.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLEnumerationKind.cs (80%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLExpression.cs (75%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLFlattenEnumerableExpression.cs (82%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLFunctionIdentifier.cs (78%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLGroupByEnumerableExpression.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLGroupByKey.cs (78%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLILMRegexLiteral.cs (82%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLInputEnumerableExpression.cs (81%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLIsOperatorKind.cs (76%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLIsOperatorScalarExpression.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLLetScalarExpression.cs (86%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLLiteral.cs (64%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLLiteralKind.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ClientQL/ClientQLLiteralScalarlExpression.cs => CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs} (62%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLMDateTimeLiteral.cs (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLMJavaScriptLiteral.cs (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLMNumberLiteral.cs (80%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLMSingletonLiteral.cs (62%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLMSymbolLiteral.cs (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLMuxScalarExpression.cs (86%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLNumberLiteral.cs (67%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLObjectCreateScalarExpression.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLObjectKind.cs (77%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLObjectLiteral.cs (73%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLObjectLiteralProperty.cs (82%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLObjectProperty.cs (81%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLOrderByEnumerableExpression.cs (81%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLOrderByItem.cs (82%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLProgram.cs (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLPropertyRefScalarExpression.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLScalarAsEnumerableExpression.cs (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLScalarExpression.cs (65%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLScalarExpressionDelegate.cs (83%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLScalarExpressionKind.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLSelectEnumerableExpression.cs (86%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLSelectManyEnumerableExpression.cs (86%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLSortOrder.cs (77%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLStringLiteral.cs (62%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLTakeEnumerableExpression.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLTupleAggregate.cs (73%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLTupleCreateScalarExpression.cs (83%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLTupleItemRefScalarExpression.cs (83%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLTupleType.cs (72%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLType.cs (78%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLTypeKind.cs (77%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLUnaryScalarExpression.cs (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLUnaryScalarOperatorKind.cs (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs (80%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLVariable.cs (80%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLVariableRefScalarExpression.cs (80%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClientQLWhereEnumerableExpression.cs (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/ClietnQLUnaryScalarOperatorKind.cs (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/{ => CoordinatorDistributionPlan}/ClientQL/CoordinatorDistributionPlan.cs (79%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs similarity index 81% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs index 50c71f1883..dbdcb6d0d4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLAggregate { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs index d31516521f..b60e86e6eb 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateKind.cs similarity index 77% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateKind.cs index a350b1577a..774a5c1577 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLAggregateKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateOperatorKind.cs similarity index 83% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateOperatorKind.cs index 956ba52eac..94fc4816a5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateOperatorKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLAggregateOperatorKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs similarity index 82% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs index 8edc0e4d20..b1a9c50560 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLAggregateSignature.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLAggregateSignature { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs index 600255f7fa..83240c8794 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs similarity index 83% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs index 0edf37f95c..fdcc4ec4bf 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayIndexerScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLArrayIndexerScalarExpression : ClientQLScalarExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayKind.cs similarity index 80% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayKind.cs index 10e62f414d..731ebcdba2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLArrayKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs similarity index 73% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs index ee939825f2..baff70f0f8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLArrayLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs @@ -2,8 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { + using System.Collections.Generic; + internal class ClientQLArrayLiteral : ClientQLLiteral { public List VecItems { get; set; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseType.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs index bff7f7a7ea..6f2b1debc9 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBaseType : ClientQLType { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseTypeKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseTypeKind.cs similarity index 86% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseTypeKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseTypeKind.cs index ac35396ca9..4d3cec7911 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBaseTypeKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseTypeKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLBaseTypeKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs similarity index 81% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs index 906fd66b75..0030111285 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBinaryLiteral : ClientQLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs index aa87dd037c..e7c2e582de 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBinaryScalarExpression : ClientQLScalarExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarOperatorKind.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarOperatorKind.cs index 98eb30eae2..ec8b2a8529 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBinaryScalarOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarOperatorKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLBinaryScalarOperatorKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBooleanLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBooleanLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs index 1ba766fad8..4136a0294d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBooleanLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBooleanLiteral : ClientQLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs similarity index 63% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs index 179c85b45d..1c946e2e40 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs @@ -2,10 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBuiltinAggregate : ClientQLAggregate { - public ClientQLAggregateOperatorKind OperatorKind { get; set; } + public new ClientQLAggregateOperatorKind OperatorKind { get; set; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinScalarFunctionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinScalarFunctionKind.cs similarity index 98% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinScalarFunctionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinScalarFunctionKind.cs index 491ddb1c0b..6883f7b805 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLBuiltinScalarFunctionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinScalarFunctionKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLBuiltinScalarFunctionKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLCGuidLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLCGuidLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs index 2deb03d322..72d0fee0c0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLCGuidLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs @@ -2,10 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLCGuidLiteral : ClientQLLiteral { - public Guid Value { get; set; } + public System.Guid Value { get; set; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs similarity index 81% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs index 704244abfa..0612124943 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLDelegate { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegateKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs similarity index 78% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegateKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs index b50b1176bd..6475a9c2a6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDelegateKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLDelegateKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs index ee4ddfbc0b..f5cc995bb9 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLDistinctEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumType.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs index d2401fe074..2103e08ca2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLEnumType : ClientQLType { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs similarity index 80% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs index bea893d96f..65bc6bfda1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLEnumerableExpression : ClientQLExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpressionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs index 0f95ab453d..c789774767 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerableExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLEnumerableExpressionKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerationKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerationKind.cs similarity index 80% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerationKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerationKind.cs index 8bfc80fecd..744aff72d4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLEnumerationKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerationKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLEnumerationKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs similarity index 75% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs index 0bdaff0ece..9254dcc071 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFlattenEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs similarity index 82% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFlattenEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs index 29b63566fd..7fd67aba98 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFlattenEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFunctionIdentifier.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs similarity index 78% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFunctionIdentifier.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs index af380bdce8..e6e43833e5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLFunctionIdentifier.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLFunctionIdentifier { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs index 09ff560630..1de96cd184 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByKey.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs similarity index 78% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByKey.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs index 7315507c6c..7ef01cebe1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLGroupByKey.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLGroupByKey { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLILMRegexLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs similarity index 82% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLILMRegexLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs index 71532927f1..440cfd073c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLILMRegexLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLILMRegexLiteral : ClientQLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLInputEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs similarity index 81% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLInputEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs index d433f94813..0b0792bf1f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLInputEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorKind.cs similarity index 76% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorKind.cs index 0e333e9ac1..03fc6fffd6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLIsOperatorKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs index 34e9d952b2..39eb00e6f5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLIsOperatorScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs similarity index 86% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs index cc89b8d65d..ef07c48ac9 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLetScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs similarity index 64% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs index bfb166a065..d16313ebce 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs @@ -2,10 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLLiteral { - public ClientQLTypeKind Kind { get; set; } + public ClientQLLiteralKind Kind { get; set; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralKind.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralKind.cs index a0c61adba3..b1cdbc902b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLLiteralKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralScalarlExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs similarity index 62% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralScalarlExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs index ea7ea18ed1..1786309dbb 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLLiteralScalarlExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - internal class ClientQLLiteralScalarlExpression : ClientQLScalarExpression + internal class ClientQLLiteralScalarExpression : ClientQLScalarExpression { public ClientQLLiteral Literal { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMDateTimeLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMDateTimeLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs index 7e0374a0dd..f7ce620832 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMDateTimeLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMDateTimeLiteral : ClientQLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMJavaScriptLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMJavaScriptLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs index 287bc52393..e32036596d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMJavaScriptLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMJavaScriptLiteral : ClientQLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs similarity index 80% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMNumberLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs index cab82e5a6f..e154ce46d7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMNumberLiteral : ClientQLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSingletonLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs similarity index 62% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSingletonLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs index 23f52b43ec..f68cd66adb 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSingletonLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs @@ -2,16 +2,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMSingletonLiteral : ClientQLLiteral { - public enum Kind - { - MaxKey, - MinKey, - Undefined - }; + public new enum Kind + { + MaxKey, + MinKey, + Undefined + } public Kind SingletonKind { get; set; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSymbolLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSymbolLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs index 1c3036fb11..a9c1723598 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMSymbolLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMSymbolLiteral : ClientQLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs similarity index 86% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs index 6b1e0c94ee..ccae7fe256 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLMuxScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMuxScalarExpression : ClientQLScalarExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLNumberLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs index 1a12a066b7..298b1983cc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs @@ -2,10 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLNumberLiteral : ClientQLLiteral { - public Int64 Value { get; set; } + public System.Int64 Value { get; set; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs index 3d52c93ce8..47af9f2610 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectKind.cs similarity index 77% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectKind.cs index 9365ca7ed8..20fa4a17f4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLObjectKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs similarity index 73% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs index a7327153ba..dc8d2c2741 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs @@ -2,8 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { + using System.Collections.Generic; + internal class ClientQLObjectLiteral : ClientQLLiteral { public List VecProperties { get; set; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteralProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs similarity index 82% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteralProperty.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs index 2cb447ffb1..a3aec1f60c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectLiteralProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLObjectLiteralProperty : ClientQLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs similarity index 81% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs index f72f7a1203..732705b1dc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLObjectProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLObjectProperty { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs similarity index 81% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs index 97acc2b5d7..bbbbc09a3d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs @@ -2,9 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System; + using System.Collections.Generic; internal class ClientQLOrderByEnumerableExpression : ClientQLEnumerableExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByItem.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs similarity index 82% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByItem.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs index e7b72c2792..f3c6b77238 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLOrderByItem.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLOrderByItem { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLProgram.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLProgram.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs index 4f2ad0a567..59d28876d5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLProgram.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLProgram { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs index 6b43787c89..4faa68b996 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLPropertyRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarAsEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarAsEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs index 3d436798e0..caf6a3115f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarAsEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs similarity index 65% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs index 021a523f02..2165b0a36e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs @@ -2,10 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLScalarExpression : ClientQLExpression { - public ClientQLEnumerableExpressionKind Kind { get; set; } + public ClientQLScalarExpressionKind Kind { get; set; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionDelegate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs similarity index 83% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionDelegate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs index 0690e66770..f2d5b57740 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionDelegate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLScalarExpressionDelegate : ClientQLDelegate { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionKind.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionKind.cs index 775e8dda35..74093950cb 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLScalarExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLScalarExpressionKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs similarity index 86% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs index 6f1fc9ddcc..28155c6665 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLSelectEnumerableExpression : ClientQLEnumerableExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectManyEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs similarity index 86% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectManyEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs index 9e3affb0dc..601485cebb 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSelectManyEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSortOrder.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSortOrder.cs similarity index 77% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSortOrder.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSortOrder.cs index 3626ac5078..078b368280 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSortOrder.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSortOrder.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLSortOrder { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLStringLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs similarity index 62% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLStringLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs index 808bcc749a..07db9a193e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLStringLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs @@ -1,9 +1,8 @@ - -//------------------------------------------------------------ +//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLStringLiteral : ClientQLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs index 17841084b3..e8a142431d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTakeEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs index 7ceb065dea..46be0b098f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTakeEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs similarity index 73% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs index 096a980ecf..8e3aa6d4a5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs @@ -2,8 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { + using System.Collections.Generic; + internal class ClientQLTupleAggregate : ClientQLAggregate { public List VecItems { get; set; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs similarity index 83% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs index da0af9e7a0..ad56e507b2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs similarity index 83% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs index 20eb749675..5c9a4c50bf 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleItemRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLTupleItemRefScalarExpression : ClientQLScalarExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs similarity index 72% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleType.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs index 2ca808a546..3e4b7a261d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTupleType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs @@ -2,8 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { + using System.Collections.Generic; + internal class ClientQLTupleType : ClientQLType { public List VecTypes { get; set; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs similarity index 78% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLType.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs index 407937d937..6bc716672e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLType { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTypeKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTypeKind.cs similarity index 77% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTypeKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTypeKind.cs index 50fdf0dfe4..3249ea1dd6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLTypeKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTypeKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLTypeKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs index e1a174e2c2..53fbb8b587 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLUnaryScalarExpression : ClientQLScalarExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarOperatorKind.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarOperatorKind.cs index d653774b06..930cf942d4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUnaryScalarOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarOperatorKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLUnaryScalarOperatorKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs similarity index 80% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs index cdbb40fd8b..c6baf976d2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs @@ -2,8 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { + using System.Collections.Generic; + internal class ClientQLUserDefinedFunctionCallScalarExpression : ClientQLScalarExpression { public ClientQLFunctionIdentifier Identifier { get; set; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs similarity index 80% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs index 311f1ef60c..7df7e888af 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariable.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLVariable { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariableRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs similarity index 80% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariableRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs index fcaa77fa6f..14a26fb031 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLVariableRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLVariableRefScalarExpression : ClientQLScalarExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLWhereEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLWhereEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs index 8bde14e49f..fe37b4b2d8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClientQLWhereEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClietnQLUnaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClietnQLUnaryScalarOperatorKind.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClietnQLUnaryScalarOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClietnQLUnaryScalarOperatorKind.cs index 2e40040120..df9d568e44 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/ClietnQLUnaryScalarOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClietnQLUnaryScalarOperatorKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClietnQLUnaryScalarOperatorKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/CoordinatorDistributionPlan.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/CoordinatorDistributionPlan.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs index d87b308477..4ef465750e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientQL/CoordinatorDistributionPlan.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class CoordinatorDistributionPlan { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs new file mode 100644 index 0000000000..81e1ab71ce --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs @@ -0,0 +1,265 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan +{ + using System; + using System.Collections.Generic; + using ClientQL; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + internal class ClientQLDeserializer : JsonConverter + { + public override bool CanConvert(Type objectType) + { + return objectType == typeof(CoordinatorDistributionPlan); + } + + public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) + { + JObject jsonObject = JObject.Load(reader); + CoordinatorDistributionPlan plan = new CoordinatorDistributionPlan + { + ClientQL = this.DeserializeClientQLEnumerableExpression(jsonObject.GetValue("coordinatorDistributionPlan")["clientQL"], serializer) + }; + + return plan; + } + + public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + string kind = token.Value("Kind"); + + switch (kind) + { + case "Select": + return this.DeserializeSelectExpression(token, serializer); + case "Input": + return this.DeserializeInputExpression(token, serializer); + case "Aggregate": + return this.DeserializeAggregateExpression(token, serializer); + case "GroupBy": + return this.DeserializeGroupByEnumerableExpression(token, serializer); + default: + throw new System.Text.Json.JsonException($"Invalid ClientQLExpression kind: {kind}"); + } + } + + public ClientQLSelectEnumerableExpression DeserializeSelectExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLSelectEnumerableExpression selectExpression = new ClientQLSelectEnumerableExpression + { + Kind = ClientQLEnumerableExpressionKind.Select, + Expression = this.DeserializeScalarExpression(token["Expression"], serializer), + DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"], serializer), + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer) + }; + + return selectExpression; + } + + public ClientQLInputEnumerableExpression DeserializeInputExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLInputEnumerableExpression inputExpression = new ClientQLInputEnumerableExpression + { + Kind = ClientQLEnumerableExpressionKind.Input, + Name = token.Value("Name") + }; + + return inputExpression; + } + + public ClientQLAggregateEnumerableExpression DeserializeAggregateExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLAggregateEnumerableExpression aggregateExpression = new ClientQLAggregateEnumerableExpression + { + Kind = ClientQLEnumerableExpressionKind.Aggregate, + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), + Aggregate = this.DeserializeAggregate(token["Aggregate"], serializer) + }; + + return aggregateExpression; + } + + public ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLGroupByEnumerableExpression groupByExpression = new ClientQLGroupByEnumerableExpression + { + Kind = (ClientQLEnumerableExpressionKind)Enum.Parse(typeof(ClientQLEnumerableExpressionKind), token.Value("Kind")), + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), + //groupByExpression.VecKeys = List(Enum.Parse(token.Value("Kind")));//token["KeyCount"].ToObject>(serializer); // some issue here + VecAggregates = token["Aggregates"].ToObject>(serializer) + }; + + return groupByExpression; + } + + public ClientQLAggregate DeserializeAggregate(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLAggregate aggregate = new ClientQLAggregate + { + Kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), token.Value("Kind")), + OperatorKind = token["OperatorKind"].ToString() + }; + + return aggregate; + } + + public ClientQLObjectCreateScalarExpression DeserializeObjectCreateExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLObjectCreateScalarExpression objectCreateExpression = new ClientQLObjectCreateScalarExpression + { + Kind = ClientQLScalarExpressionKind.ObjectCreate + }; + + string objectKindString = token.Value("ObjectKind"); + if (!Enum.TryParse(objectKindString, out ClientQLObjectKind objectKind)) + { + throw new System.Text.Json.JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); + } + + objectCreateExpression.ObjectKind = objectKind; + + objectCreateExpression.Properties = this.DeserializeObjectProperties(token["Properties"], serializer); + return objectCreateExpression; + } + + public ClientQLVariableRefScalarExpression DeserializeVariableRefExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLVariableRefScalarExpression variableRefExpression = new ClientQLVariableRefScalarExpression + { + Kind = ClientQLScalarExpressionKind.VariableRef, + Variable = this.DeserializeClientQLVariable(token["Variable"], serializer) + }; + + return variableRefExpression; + } + + public ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLTupleItemRefScalarExpression tupleItemRefExpression = new ClientQLTupleItemRefScalarExpression + { + Kind = ClientQLScalarExpressionKind.TupleItemRef, + Expression = this.DeserializeScalarExpression(token["Expression"], serializer), + Index = token.Value("Index") + }; + + return tupleItemRefExpression; + } + + public ClientQLMuxScalarExpression DeserializeMuxExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLMuxScalarExpression muxExpression = new ClientQLMuxScalarExpression + { + Kind = ClientQLScalarExpressionKind.Mux, + ConditionExpression = this.DeserializeScalarExpression(token["ConditionExpression"], serializer), + LeftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer), + RightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer) + }; + + return muxExpression; + } + + public ClientQLBinaryScalarExpression DeserializeBinaryOperatorExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLBinaryScalarExpression binaryExpression = new ClientQLBinaryScalarExpression + { + Kind = ClientQLScalarExpressionKind.BinaryOperator, + OperatorKind = (ClientQLBinaryScalarOperatorKind)Enum.Parse(typeof(ClientQLBinaryScalarOperatorKind), token.Value("OperatorKind")), + MaxDepth = token.Value("MaxDepth"), + LeftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer), + RightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer) + }; + + return binaryExpression; + } + + public ClientQLLiteralScalarExpression DeserializeLiteralExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLLiteralScalarExpression literalExpression = new ClientQLLiteralScalarExpression + { + Kind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), token.Value("Kind")), + Literal = new ClientQLLiteral + { + Kind = (ClientQLLiteralKind)Enum.Parse(typeof(ClientQLLiteralKind), token["Literal"]["Kind"].ToString()) + } + }; + + return literalExpression; + } + + public ClientQLTupleCreateScalarExpression DeserializeTupleCreateExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLTupleCreateScalarExpression tupleCreateExpression = new ClientQLTupleCreateScalarExpression + { + Kind = ClientQLScalarExpressionKind.TupleCreate, + VecItems = token["Items"].ToObject>(serializer) + }; + + return tupleCreateExpression; + } + + public ClientQLVariable DeserializeClientQLVariable(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLVariable variable = new ClientQLVariable + { + Name = token.Value("Name"), + UniqueId = token.Value("UniqueId") + }; + + return variable; + } + + public List DeserializeObjectProperties(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + List properties = new List(); + if (token != null && token.Type == JTokenType.Array) + { + foreach (JToken propertyToken in token) + { + ClientQLObjectProperty property = new ClientQLObjectProperty + { + Name = propertyToken.Value("Name"), + Expression = this.DeserializeScalarExpression(propertyToken["Expression"], serializer) + }; + + properties.Add(property); + } + } + + return properties; + } + + public ClientQLScalarExpression DeserializeScalarExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + { + ClientQLScalarExpressionKind scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), token.Value("Kind")); + + switch (scalarExpressionKind) + { + case ClientQLScalarExpressionKind.ObjectCreate: + return this.DeserializeObjectCreateExpression(token, serializer); + case ClientQLScalarExpressionKind.VariableRef: + return this.DeserializeVariableRefExpression(token, serializer); + case ClientQLScalarExpressionKind.TupleItemRef: + return this.DeserializeTupleItemRefExpression(token, serializer); + case ClientQLScalarExpressionKind.Mux: + return this.DeserializeMuxExpression(token, serializer); + case ClientQLScalarExpressionKind.BinaryOperator: + return this.DeserializeBinaryOperatorExpression(token, serializer); + case ClientQLScalarExpressionKind.Literal: + return this.DeserializeLiteralExpression(token, serializer); + case ClientQLScalarExpressionKind.TupleCreate: + return this.DeserializeTupleCreateExpression(token, serializer); + default: + throw new System.Text.Json.JsonException($"Invalid ClientQLScalarExpressionKind: {scalarExpressionKind}"); + } + } + } +} \ No newline at end of file From 4fd31d47e1f7f1e2f422c9d037a27586885bd515 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Wed, 16 Aug 2023 09:15:29 -0700 Subject: [PATCH 04/36] Added support for all Enumerable and Scalar Expressions --- .../ClientQL/ClientQLExpression.cs | 1 + .../ClientQLLiteralScalarlExpression.cs | 13 + .../ClientQLDeserializer.cs | 472 ++++++++++++++---- 3 files changed, 400 insertions(+), 86 deletions(-) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarlExpression.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs index 9254dcc071..478d7f4975 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs @@ -6,5 +6,6 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLExpression { + // Decided to keep this empty as it does not provide new information } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarlExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarlExpression.cs new file mode 100644 index 0000000000..9eeabeeb92 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarlExpression.cs @@ -0,0 +1,13 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +{ + using System.Collections.Generic; + + internal class ClientQLLiteralScalarlExpression : ClientQLScalarExpression + { + public ClientQLLiteral Literal { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs index 81e1ab71ce..7ad3370752 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs @@ -6,6 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan { using System; using System.Collections.Generic; + using System.Linq; using ClientQL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -33,39 +34,89 @@ public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, throw new NotImplementedException(); } - public ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, JsonSerializer serializer) { string kind = token.Value("Kind"); switch (kind) { - case "Select": - return this.DeserializeSelectExpression(token, serializer); - case "Input": - return this.DeserializeInputExpression(token, serializer); case "Aggregate": - return this.DeserializeAggregateExpression(token, serializer); + return this.DeserializeAggregateEnumerableExpression(token, serializer); + case "Distinct": + return this.DeserializeDistinctEnumerableExpression(token, serializer); case "GroupBy": return this.DeserializeGroupByEnumerableExpression(token, serializer); + case "Flatten": + return this.DeserializeFlattenEnumerableExpression(token, serializer); + case "Input": + return this.DeserializeInputEnumerableExpression(token, serializer); + case "OrderBy": + return this.DeserializeOrderByEnumerableExpression(token, serializer); + case "ScalarAsEnumerable": + return this.DeserializeScalarAsEnumerableExpression(token, serializer); + case "Select": + return this.DeserializeSelectEnumerableExpression(token, serializer); + case "SelectMany": + return this.DeserializeSelectManyExpression(token, serializer); + case "Take": + return this.DeserializeTakeEnumerableExpression(token, serializer); + case "Where": + return this.DeserializeWhereEnumerableExpression(token, serializer); default: - throw new System.Text.Json.JsonException($"Invalid ClientQLExpression kind: {kind}"); + throw new JsonException($"Invalid ClientQLExpression kind: {kind}"); } } - public ClientQLSelectEnumerableExpression DeserializeSelectExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLSelectEnumerableExpression selectExpression = new ClientQLSelectEnumerableExpression + ClientQLAggregateEnumerableExpression aggregateExpression = new ClientQLAggregateEnumerableExpression { - Kind = ClientQLEnumerableExpressionKind.Select, - Expression = this.DeserializeScalarExpression(token["Expression"], serializer), - DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"], serializer), + Kind = ClientQLEnumerableExpressionKind.Aggregate, + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), + Aggregate = this.DeserializeAggregate(token["Aggregate"]) + }; + + return aggregateExpression; + } + + public ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(JToken token, JsonSerializer serializer) + { + ClientQLDistinctEnumerableExpression distinctExpression = new ClientQLDistinctEnumerableExpression + { + Kind = ClientQLEnumerableExpressionKind.Distinct, + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), + DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), + VecExpression = token["VecExpression"].ToObject>(serializer) + }; + + return distinctExpression; + } + + public ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, JsonSerializer serializer) + { + ClientQLGroupByEnumerableExpression groupByExpression = new ClientQLGroupByEnumerableExpression + { + Kind = ClientQLEnumerableExpressionKind.GroupBy, + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), + VecKeys = this.DeserializeGroupByKeys(token["VecKeys"]), + VecAggregates = this.DeserializeAggregates(token["VecAggregates"]) + }; + + return groupByExpression; + } + + public ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpression(JToken token, JsonSerializer serializer) + { + ClientQLFlattenEnumerableExpression flattenExpression = new ClientQLFlattenEnumerableExpression + { + Kind = ClientQLEnumerableExpressionKind.Flatten, SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer) }; - return selectExpression; + return flattenExpression; } - public ClientQLInputEnumerableExpression DeserializeInputExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(JToken token, JsonSerializer serializer) { ClientQLInputEnumerableExpression inputExpression = new ClientQLInputEnumerableExpression { @@ -76,98 +127,150 @@ public ClientQLInputEnumerableExpression DeserializeInputExpression(JToken token return inputExpression; } - public ClientQLAggregateEnumerableExpression DeserializeAggregateExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLAggregateEnumerableExpression aggregateExpression = new ClientQLAggregateEnumerableExpression + ClientQLOrderByEnumerableExpression orderByExpression = new ClientQLOrderByEnumerableExpression { - Kind = ClientQLEnumerableExpressionKind.Aggregate, + Kind = ClientQLEnumerableExpressionKind.OrderBy, SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), - Aggregate = this.DeserializeAggregate(token["Aggregate"], serializer) + DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), + VecItems = this.DeserializeOrderByItems(token["VecItems"], serializer) }; - return aggregateExpression; + return orderByExpression; } - public ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLGroupByEnumerableExpression groupByExpression = new ClientQLGroupByEnumerableExpression + ClientQLScalarAsEnumerableExpression scalarAsEnumerableExpression = new ClientQLScalarAsEnumerableExpression { - Kind = (ClientQLEnumerableExpressionKind)Enum.Parse(typeof(ClientQLEnumerableExpressionKind), token.Value("Kind")), - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), - //groupByExpression.VecKeys = List(Enum.Parse(token.Value("Kind")));//token["KeyCount"].ToObject>(serializer); // some issue here - VecAggregates = token["Aggregates"].ToObject>(serializer) + Kind = ClientQLEnumerableExpressionKind.ScalarAsEnumerable, + Expression = this.DeserializeScalarExpression(token["Expression"], serializer), + EnumerationKind = (ClientQLEnumerationKind)Enum.Parse(typeof(ClientQLEnumerationKind), token.Value("EnumerationKind")) }; - return groupByExpression; + return scalarAsEnumerableExpression; } - public ClientQLAggregate DeserializeAggregate(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLSelectEnumerableExpression DeserializeSelectEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLAggregate aggregate = new ClientQLAggregate + ClientQLSelectEnumerableExpression selectExpression = new ClientQLSelectEnumerableExpression { - Kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), token.Value("Kind")), - OperatorKind = token["OperatorKind"].ToString() + Kind = ClientQLEnumerableExpressionKind.Select, + Expression = this.DeserializeScalarExpression(token["Expression"], serializer), + DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer) }; - return aggregate; + return selectExpression; } - public ClientQLObjectCreateScalarExpression DeserializeObjectCreateExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpression(JToken token, JsonSerializer serializer) { - ClientQLObjectCreateScalarExpression objectCreateExpression = new ClientQLObjectCreateScalarExpression + ClientQLSelectManyEnumerableExpression selectManyExpression = new ClientQLSelectManyEnumerableExpression { - Kind = ClientQLScalarExpressionKind.ObjectCreate + Kind = ClientQLEnumerableExpressionKind.SelectMany, + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), + DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), + SelectorExpression = this.DeserializeClientQLEnumerableExpression(token["SelectorExpression"], serializer) }; - string objectKindString = token.Value("ObjectKind"); - if (!Enum.TryParse(objectKindString, out ClientQLObjectKind objectKind)) + return selectManyExpression; + } + + public ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(JToken token, JsonSerializer serializer) + { + ClientQLTakeEnumerableExpression takeExpression = new ClientQLTakeEnumerableExpression { - throw new System.Text.Json.JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); - } + Kind = ClientQLEnumerableExpressionKind.Take, - objectCreateExpression.ObjectKind = objectKind; + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), + SkipValue = token.Value("SkipValue"), + TakeValue = token.Value("TakeValue") + }; - objectCreateExpression.Properties = this.DeserializeObjectProperties(token["Properties"], serializer); - return objectCreateExpression; + return takeExpression; } - public ClientQLVariableRefScalarExpression DeserializeVariableRefExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLVariableRefScalarExpression variableRefExpression = new ClientQLVariableRefScalarExpression + ClientQLWhereEnumerableExpression whereExpression = new ClientQLWhereEnumerableExpression { - Kind = ClientQLScalarExpressionKind.VariableRef, - Variable = this.DeserializeClientQLVariable(token["Variable"], serializer) + Kind = ClientQLEnumerableExpressionKind.Where, + + SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), + Delegate = this.DeserializeDelegateExpression(token["Delegate"]) }; - return variableRefExpression; + return whereExpression; } - public ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLTupleItemRefScalarExpression tupleItemRefExpression = new ClientQLTupleItemRefScalarExpression + object scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), token.Value("Kind")); + + switch (scalarExpressionKind) { - Kind = ClientQLScalarExpressionKind.TupleItemRef, - Expression = this.DeserializeScalarExpression(token["Expression"], serializer), - Index = token.Value("Index") + case ClientQLScalarExpressionKind.ArrayCreate: + return this.DeserializeArrayCreateScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.ArrayIndexer: + return this.DeserializeArrayIndexerScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.BinaryOperator: + return this.DeserializeBinaryOperatorScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.IsOperator: + return this.DeserializeIsOperatorScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.Let: + return this.DeserializeLetScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.Literal: + return this.DeserializeLiteralScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.Mux: + return this.DeserializeMuxScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.ObjectCreate: + return this.DeserializeObjectCreateScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.PropertyRef: + return this.DeserializePropertyRefScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.SystemFunctionCall: + return this.DeserializeSystemFunctionCallScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.TupleCreate: + return this.DeserializeTupleCreateScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.TupleItemRef: + return this.DeserializeTupleItemRefScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.UnaryOperator: + return this.DeserializeUnaryScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.UserDefinedFunctionCall: + return this.DeserializeUserDefinedFunctionCallScalarExpression(token, serializer); + case ClientQLScalarExpressionKind.VariableRef: + return this.DeserializeVariableRefScalarExpression(token, serializer); + default: + throw new JsonException($"Invalid ClientQLScalarExpressionKind: {scalarExpressionKind}"); + } + } + + public ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLArrayCreateScalarExpression arrayCreateExpression = new ClientQLArrayCreateScalarExpression + { + Kind = ClientQLScalarExpressionKind.ArrayCreate, + ArrayKind = token.Value("ArrayKind"), + VecItems = token["VecItems"].ToObject>(serializer) }; - return tupleItemRefExpression; + return arrayCreateExpression; } - public ClientQLMuxScalarExpression DeserializeMuxExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLMuxScalarExpression muxExpression = new ClientQLMuxScalarExpression + ClientQLArrayIndexerScalarExpression arrayIndexerExpression = new ClientQLArrayIndexerScalarExpression { - Kind = ClientQLScalarExpressionKind.Mux, - ConditionExpression = this.DeserializeScalarExpression(token["ConditionExpression"], serializer), - LeftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer), - RightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer) + Kind = ClientQLScalarExpressionKind.ArrayIndexer, + Expression = this.DeserializeScalarExpression(token["Expression"], serializer), + Index = token.Value("Index") }; - return muxExpression; + return arrayIndexerExpression; } - public ClientQLBinaryScalarExpression DeserializeBinaryOperatorExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(JToken token, JsonSerializer serializer) { ClientQLBinaryScalarExpression binaryExpression = new ClientQLBinaryScalarExpression { @@ -181,21 +284,104 @@ public ClientQLBinaryScalarExpression DeserializeBinaryOperatorExpression(JToken return binaryExpression; } - public ClientQLLiteralScalarExpression DeserializeLiteralExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLIsOperatorScalarExpression isOperatorExpression = new ClientQLIsOperatorScalarExpression + { + Kind = ClientQLScalarExpressionKind.IsOperator, + OperatorKind = (ClientQLIsOperatorKind)Enum.Parse(typeof(ClientQLIsOperatorKind), token.Value("OperatorKind")), + Expression = this.DeserializeScalarExpression(token["Expression"], serializer) + }; + + return isOperatorExpression; + } + + public ClientQLLetScalarExpression DeserializeLetScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLLetScalarExpression letExpression = new ClientQLLetScalarExpression + { + Kind = ClientQLScalarExpressionKind.Let, + DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), + DeclaredVariableExpression = this.DeserializeScalarExpression(token["DeclaredVariableExpression"], serializer), + Expression = this.DeserializeScalarExpression(token["Expression"], serializer) + }; + + return letExpression; + } + + public ClientQLLiteralScalarlExpression DeserializeLiteralScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLLiteralScalarExpression literalExpression = new ClientQLLiteralScalarExpression + ClientQLLiteralScalarlExpression literalExpression = new ClientQLLiteralScalarlExpression { Kind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), token.Value("Kind")), Literal = new ClientQLLiteral { - Kind = (ClientQLLiteralKind)Enum.Parse(typeof(ClientQLLiteralKind), token["Literal"]["Kind"].ToString()) + Kind = (ClientQLLiteralKind)ClientQLScalarExpressionKind.Literal } }; return literalExpression; } - public ClientQLTupleCreateScalarExpression DeserializeTupleCreateExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLMuxScalarExpression DeserializeMuxScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLMuxScalarExpression muxExpression = new ClientQLMuxScalarExpression + { + Kind = ClientQLScalarExpressionKind.Mux, + ConditionExpression = this.DeserializeScalarExpression(token["ConditionExpression"], serializer), + LeftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer), + RightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer) + }; + + return muxExpression; + } + + public ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLObjectCreateScalarExpression objectCreateExpression = new ClientQLObjectCreateScalarExpression + { + Kind = ClientQLScalarExpressionKind.ObjectCreate + }; + + string objectKindString = token.Value("ObjectKind"); + if (!Enum.TryParse(objectKindString, out ClientQLObjectKind objectKind)) + { + throw new JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); + } + + objectCreateExpression.ObjectKind = objectKind; + objectCreateExpression.Properties = this.DeserializeObjectProperties(token["Properties"], serializer); + + return objectCreateExpression; + } + + public ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLPropertyRefScalarExpression propertyRefExpression = new ClientQLPropertyRefScalarExpression + { + Kind = ClientQLScalarExpressionKind.PropertyRef, + Expression = this.DeserializeScalarExpression(token["Expression"], serializer), + PropertyName = token.Value("PropertyName") + }; + + return propertyRefExpression; + } + + public ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLSystemFunctionCallScalarExpression functionCallExpression = new ClientQLSystemFunctionCallScalarExpression + { + Kind = ClientQLScalarExpressionKind.SystemFunctionCall, + FunctionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), token.Value("FunctionKind")), + VecArguments = token["VecArguments"] + .Select(argToken => this.DeserializeScalarExpression(argToken, serializer)) + .ToList() + }; + + return functionCallExpression; + } + + public ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(JToken token, JsonSerializer serializer) { ClientQLTupleCreateScalarExpression tupleCreateExpression = new ClientQLTupleCreateScalarExpression { @@ -206,7 +392,108 @@ public ClientQLTupleCreateScalarExpression DeserializeTupleCreateExpression(JTok return tupleCreateExpression; } - public ClientQLVariable DeserializeClientQLVariable(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLTupleItemRefScalarExpression tupleItemRefExpression = new ClientQLTupleItemRefScalarExpression + { + Kind = ClientQLScalarExpressionKind.TupleItemRef, + Expression = this.DeserializeScalarExpression(token["Expression"], serializer), + Index = token.Value("Index") + }; + + return tupleItemRefExpression; + } + + public ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLUnaryScalarExpression unaryExpression = new ClientQLUnaryScalarExpression + { + Kind = ClientQLScalarExpressionKind.UnaryOperator, + OperatorKind = (ClientQLUnaryScalarOperatorKind)Enum.Parse(typeof(ClientQLUnaryScalarOperatorKind), token.Value("OperatorKind")), + Expression = this.DeserializeScalarExpression(token["Expression"], serializer) + }; + + return unaryExpression; + } + + public ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLUserDefinedFunctionCallScalarExpression userDefinedFunctionCallExpression = new ClientQLUserDefinedFunctionCallScalarExpression + { + Kind = ClientQLScalarExpressionKind.UserDefinedFunctionCall, + Identifier = token["Identifier"].ToObject(serializer), + VecArguments = token["VecArguments"].ToObject>(serializer), + Builtin = token.Value("Builtin") + }; + + return userDefinedFunctionCallExpression; + } + + public ClientQLVariableRefScalarExpression DeserializeVariableRefScalarExpression(JToken token, JsonSerializer serializer) + { + ClientQLVariableRefScalarExpression variableRefExpression = new ClientQLVariableRefScalarExpression + { + Kind = ClientQLScalarExpressionKind.VariableRef, + Variable = this.DeserializeClientQLVariable(token["Variable"]) + }; + + return variableRefExpression; + } + + private List DeserializeOrderByItems(JToken token, JsonSerializer serializer) + { + List orderByItems = new List(); + + if (token != null && token.Type == JTokenType.Array) + { + foreach (JToken itemToken in token) + { + ClientQLOrderByItem orderByItem = new ClientQLOrderByItem + { + Expression = this.DeserializeScalarExpression(itemToken["Expression"], serializer), + SortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), itemToken.Value("SortOrder")) + }; + + orderByItems.Add(orderByItem); + } + } + + return orderByItems; + } + + public ClientQLDelegate DeserializeDelegateExpression(JToken token) + { + ClientQLDelegate delegateExpression = new ClientQLDelegate + { + Kind = (ClientQLDelegateKind)Enum.Parse(typeof(ClientQLDelegateKind), token.Value("Kind")), + Type = this.DeserializeType(token["Type"]) + }; + + return delegateExpression; + } + + private ClientQLType DeserializeType(JToken token) + { + ClientQLType type = new ClientQLType + { + Kind = (ClientQLTypeKind)Enum.Parse(typeof(ClientQLTypeKind), token.Value("Kind")) + }; + + return type; + } + + public ClientQLAggregate DeserializeAggregate(JToken token) + { + ClientQLAggregate aggregate = new ClientQLAggregate + { + Kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), token.Value("Kind")), + OperatorKind = token["OperatorKind"].ToString() + }; + + return aggregate; + } + + public ClientQLVariable DeserializeClientQLVariable(JToken token) { ClientQLVariable variable = new ClientQLVariable { @@ -217,7 +504,7 @@ public ClientQLVariable DeserializeClientQLVariable(JToken token, Newtonsoft.Jso return variable; } - public List DeserializeObjectProperties(JToken token, Newtonsoft.Json.JsonSerializer serializer) + public List DeserializeObjectProperties(JToken token, JsonSerializer serializer) { List properties = new List(); if (token != null && token.Type == JTokenType.Array) @@ -229,7 +516,6 @@ public List DeserializeObjectProperties(JToken token, Ne Name = propertyToken.Value("Name"), Expression = this.DeserializeScalarExpression(propertyToken["Expression"], serializer) }; - properties.Add(property); } } @@ -237,29 +523,43 @@ public List DeserializeObjectProperties(JToken token, Ne return properties; } - public ClientQLScalarExpression DeserializeScalarExpression(JToken token, Newtonsoft.Json.JsonSerializer serializer) + private List DeserializeGroupByKeys(JToken token) { - ClientQLScalarExpressionKind scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), token.Value("Kind")); + List groupByKeys = new List(); - switch (scalarExpressionKind) + if (token != null && token.Type == JTokenType.Array) { - case ClientQLScalarExpressionKind.ObjectCreate: - return this.DeserializeObjectCreateExpression(token, serializer); - case ClientQLScalarExpressionKind.VariableRef: - return this.DeserializeVariableRefExpression(token, serializer); - case ClientQLScalarExpressionKind.TupleItemRef: - return this.DeserializeTupleItemRefExpression(token, serializer); - case ClientQLScalarExpressionKind.Mux: - return this.DeserializeMuxExpression(token, serializer); - case ClientQLScalarExpressionKind.BinaryOperator: - return this.DeserializeBinaryOperatorExpression(token, serializer); - case ClientQLScalarExpressionKind.Literal: - return this.DeserializeLiteralExpression(token, serializer); - case ClientQLScalarExpressionKind.TupleCreate: - return this.DeserializeTupleCreateExpression(token, serializer); - default: - throw new System.Text.Json.JsonException($"Invalid ClientQLScalarExpressionKind: {scalarExpressionKind}"); + foreach (JToken keyToken in token) + { + ClientQLGroupByKey groupByKey = new ClientQLGroupByKey + { + Type = this.DeserializeType(keyToken["Type"]) + }; + groupByKeys.Add(groupByKey); + } } + + return groupByKeys; + } + + private List DeserializeAggregates(JToken token) + { + List aggregates = new List(); + + if (token != null && token.Type == JTokenType.Array) + { + foreach (JToken aggregateToken in token) + { + ClientQLAggregate aggregate = new ClientQLAggregate + { + Kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), aggregateToken.Value("Kind")), + OperatorKind = aggregateToken.Value("OperatorKind") + }; + aggregates.Add(aggregate); + } + } + + return aggregates; } } } \ No newline at end of file From 1ad1d8252bd1cf81b644de0d197bc981a8236f2f Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Fri, 18 Aug 2023 15:10:12 -0700 Subject: [PATCH 05/36] Added baseline tests for testing CoordinatorDistributionPlan deserializing --- ...oordinatorDistributionPlanDeserializer.cs} | 18 +- ...ordinatorDistributionPlanDeserializing.xml | 318 ++++++++++++++++++ ...oordinatorDistributionPlanBaselineTests.cs | 115 +++++++ 3 files changed, 438 insertions(+), 13 deletions(-) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQLDeserializer.cs => CoordinatorDistributionPlanDeserializer.cs} (97%) create mode 100644 Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml create mode 100644 Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs similarity index 97% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 7ad3370752..17c5aa2076 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQLDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -11,29 +11,21 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan using Newtonsoft.Json; using Newtonsoft.Json.Linq; - internal class ClientQLDeserializer : JsonConverter + internal class CoordinatorDistributionPlanDeserializer { - public override bool CanConvert(Type objectType) + public CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string jsonString) { - return objectType == typeof(CoordinatorDistributionPlan); - } + JObject token = JObject.Parse(jsonString); + JsonSerializer serializer = new JsonSerializer(); - public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) - { - JObject jsonObject = JObject.Load(reader); CoordinatorDistributionPlan plan = new CoordinatorDistributionPlan { - ClientQL = this.DeserializeClientQLEnumerableExpression(jsonObject.GetValue("coordinatorDistributionPlan")["clientQL"], serializer) + ClientQL = this.DeserializeClientQLEnumerableExpression(token["coordinatorDistributionPlan"]["clientQL"], serializer) }; return plan; } - public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) - { - throw new NotImplementedException(); - } - public ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, JsonSerializer serializer) { string kind = token.Value("Kind"); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml new file mode 100644 index 0000000000..c64edff5a7 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml @@ -0,0 +1,318 @@ + + + + Input Expression + {"coordinatorDistributionPlan": {"clientQL": {"Kind": "Input","Name": "root"}}} + + + { + "ClientQL": { + "Name": "root", + "Kind": 4 + } +} + + + + + Aggregate and ObjectCreate Expressions + {"coordinatorDistributionPlan": {"clientQL": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a","Expression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6}}}]},"SourceExpression": {"Kind": "Aggregate","Aggregate": {"Kind": "Builtin","OperatorKind": "Sum"},"SourceExpression": {"Kind": "Input","Name": "root"}}}}} + + + { + "ClientQL": { + "SourceExpression": { + "SourceExpression": { + "Name": "root", + "Kind": 4 + }, + "Aggregate": { + "Kind": 0, + "OperatorKind": "Sum" + }, + "Kind": 0 + }, + "DeclaredVariable": { + "Name": "v0", + "UniqueId": 6 + }, + "Expression": { + "Properties": [ + { + "Name": "count_a", + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 6 + }, + "Kind": 14 + } + } + ], + "ObjectKind": 1, + "Kind": 7 + }, + "Kind": 7 + } +} + + + + + Select, Aggregate and BinaryOperator Expressions + {"coordinatorDistributionPlan": {"clientQL": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 10 }, "Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [ {"Name": "F1","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "FieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "FieldSum", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 1 }},{ "Name": "FieldAvg", "Expression": {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "Equal", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }, "RightExpression": {"Kind": "Literal","Literal": { "Kind": "Number", "Value": 0} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Undefined" }},"RightExpression": { "Kind": "BinaryOperator", "OperatorKind": "Divide", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 0 }, "RightExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }}}}]}}, {"Name": "F2","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "OtherFieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "OtherFieldMax", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 3 }} ]} }] }, "SourceExpression": {"Kind": "GroupBy","KeyCount": 1,"Aggregates": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Tuple","Items": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Builtin","OperatorKind": "Sum" }] }, {"Kind": "Builtin","OperatorKind": "Max" }],"SourceExpression": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 16 }, "Expression": {"Kind": "TupleCreate","Items": [ {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 0 }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} }, {"Kind": "TupleCreate","Items": [ {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 2 }, "Index": 0} }, {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 1 }] }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16}},"Index": 3}, "Index": 0}}]}, "SourceExpression": {"Kind": "Input","Name": "root"}}}}}} + + + { + "ClientQL": { + "SourceExpression": { + "SourceExpression": { + "SourceExpression": { + "Name": "root", + "Kind": 4 + }, + "DeclaredVariable": { + "Name": "v0", + "UniqueId": 16 + }, + "Expression": { + "VecItems": [ + { + "Kind": 11 + }, + { + "Kind": 6 + }, + { + "Kind": 10 + }, + { + "Kind": 6 + } + ], + "Kind": 10 + }, + "Kind": 7 + }, + "VecKeys": [], + "VecAggregates": [], + "Kind": 2 + }, + "DeclaredVariable": { + "Name": "v0", + "UniqueId": 10 + }, + "Expression": { + "Properties": [ + { + "Name": "F1", + "Expression": { + "Properties": [ + { + "Name": "FieldA", + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 10 + }, + "Kind": 14 + }, + "Index": 0, + "Kind": 11 + } + }, + { + "Name": "FieldSum", + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 10 + }, + "Kind": 14 + }, + "Index": 1, + "Kind": 11 + } + }, + { + "Name": "FieldAvg", + "Expression": { + "ConditionExpression": { + "OperatorKind": 6, + "MaxDepth": 0, + "LeftExpression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 10 + }, + "Kind": 14 + }, + "Index": 2, + "Kind": 11 + }, + "Index": 1, + "Kind": 11 + }, + "RightExpression": { + "Literal": { + "Kind": 5 + }, + "Kind": 5 + }, + "Kind": 2 + }, + "LeftExpression": { + "Literal": { + "Kind": 5 + }, + "Kind": 5 + }, + "RightExpression": { + "OperatorKind": 5, + "MaxDepth": 0, + "LeftExpression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 10 + }, + "Kind": 14 + }, + "Index": 2, + "Kind": 11 + }, + "Index": 0, + "Kind": 11 + }, + "RightExpression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 10 + }, + "Kind": 14 + }, + "Index": 2, + "Kind": 11 + }, + "Index": 1, + "Kind": 11 + }, + "Kind": 2 + }, + "Kind": 6 + } + } + ], + "ObjectKind": 1, + "Kind": 7 + } + }, + { + "Name": "F2", + "Expression": { + "Properties": [ + { + "Name": "OtherFieldA", + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 10 + }, + "Kind": 14 + }, + "Index": 0, + "Kind": 11 + } + }, + { + "Name": "OtherFieldMax", + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 10 + }, + "Kind": 14 + }, + "Index": 3, + "Kind": 11 + } + } + ], + "ObjectKind": 1, + "Kind": 7 + } + } + ], + "ObjectKind": 1, + "Kind": 7 + }, + "Kind": 7 + } +} + + + + + Select, Sum and VariableRef Expressions + {"coordinatorDistributionPlan": {"clientQL": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a_plus_five","Expression": {"Kind": "BinaryOperator","OperatorKind": "Add","LeftExpression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6 }}, "RightExpression": { "Kind": "Literal", "Literal": { "Kind": "Number", "Value": 5 }}}}]}, "SourceExpression": { "Kind": "Aggregate", "Aggregate": { "Kind": "Builtin", "OperatorKind": "Sum" }, "SourceExpression": { "Kind": "Input", "Name": "root" }}}}} + + + { + "ClientQL": { + "SourceExpression": { + "SourceExpression": { + "Name": "root", + "Kind": 4 + }, + "Aggregate": { + "Kind": 0, + "OperatorKind": "Sum" + }, + "Kind": 0 + }, + "DeclaredVariable": { + "Name": "v0", + "UniqueId": 6 + }, + "Expression": { + "Properties": [ + { + "Name": "count_a_plus_five", + "Expression": { + "OperatorKind": 0, + "MaxDepth": 0, + "LeftExpression": { + "Variable": { + "Name": "v0", + "UniqueId": 6 + }, + "Kind": 14 + }, + "RightExpression": { + "Literal": { + "Kind": 5 + }, + "Kind": 5 + }, + "Kind": 2 + } + } + ], + "ObjectKind": 1, + "Kind": 7 + }, + "Kind": 7 + } +} + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs new file mode 100644 index 0000000000..a550a4e415 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs @@ -0,0 +1,115 @@ +namespace Microsoft.Azure.Cosmos.Tests.Query +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Threading; + using System.Threading.Tasks; + using System.Xml; + using Microsoft.Azure.Cosmos.Query.Core; + using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan; + using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL; + using Microsoft.Azure.Cosmos.Query.Core.Monads; + using Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination; + using Microsoft.Azure.Cosmos.Query.Core.QueryClient; + using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; + using Microsoft.Azure.Cosmos.Test.BaselineTest; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.Azure.Documents; + using Microsoft.Azure.Documents.Routing; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + [TestClass] + public class CoordinatorDistributionPlanBaselineTests : BaselineTests + { + [TestMethod] + [Owner("akotalwar")] + public void TestCoordinatorDistributionPlanDeserializing() + { + List testVariations = new List + { + CreateInput( + description: @"Input Expression", + coordinatorPlanJson: "{\"coordinatorDistributionPlan\": {\"clientQL\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}"), + + CreateInput( + description: @"Aggregate and ObjectCreate Expressions", + coordinatorPlanJson: "{\"coordinatorDistributionPlan\": {\"clientQL\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a\",\"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6}}}]},\"SourceExpression\": {\"Kind\": \"Aggregate\",\"Aggregate\": {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\"},\"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}"), + + CreateInput( + description: @"Select, Aggregate and BinaryOperator Expressions", + coordinatorPlanJson: "{\"coordinatorDistributionPlan\": {\"clientQL\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 10 }, \"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [ {\"Name\": \"F1\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"FieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"FieldSum\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 1 }},{ \"Name\": \"FieldAvg\", \"Expression\": {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Equal\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }, \"RightExpression\": {\"Kind\": \"Literal\",\"Literal\": { \"Kind\": \"Number\", \"Value\": 0} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Undefined\" }},\"RightExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Divide\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 0 }, \"RightExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }}}}]}}, {\"Name\": \"F2\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"OtherFieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"OtherFieldMax\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 3 }} ]} }] }, \"SourceExpression\": {\"Kind\": \"GroupBy\",\"KeyCount\": 1,\"Aggregates\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Tuple\",\"Items\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }] }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Max\" }],\"SourceExpression\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 16 }, \"Expression\": {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 0 }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} }, {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 2 }, \"Index\": 0} }, {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 1 }] }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16}},\"Index\": 3}, \"Index\": 0}}]}, \"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}}"), + + CreateInput( + description: @"Select, Sum and VariableRef Expressions", + coordinatorPlanJson: "{\"coordinatorDistributionPlan\": {\"clientQL\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a_plus_five\",\"Expression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"Add\",\"LeftExpression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6 }}, \"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": { \"Kind\": \"Number\", \"Value\": 5 }}}}]}, \"SourceExpression\": { \"Kind\": \"Aggregate\", \"Aggregate\": { \"Kind\": \"Builtin\", \"OperatorKind\": \"Sum\" }, \"SourceExpression\": { \"Kind\": \"Input\", \"Name\": \"root\" }}}}}"), + }; + + this.ExecuteTestSuite(testVariations); + } + + + private static CoordinatorDistributionPlanTestInput CreateInput( + string description, + string coordinatorPlanJson) + { + return new CoordinatorDistributionPlanTestInput(description, coordinatorPlanJson); + } + + public override CoordinatorDistributionPlanTestOutput ExecuteTest(CoordinatorDistributionPlanTestInput input) + { + + CoordinatorDistributionPlanDeserializer deserializer = new CoordinatorDistributionPlanDeserializer(); + JsonSerializerSettings settings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented + }; + + CoordinatorDistributionPlan distributionPlan = deserializer.DeserializeCoordinatorDistributionPlan(input.CoordinatorPlanJson); + string serializedDistributionPlan = JsonConvert.SerializeObject(distributionPlan, settings); + + return new CoordinatorDistributionPlanTestOutput(serializedDistributionPlan); + } + + public sealed class CoordinatorDistributionPlanTestOutput : BaselineTestOutput + { + public CoordinatorDistributionPlanTestOutput(string serializedCoordinatorPlanJson) + { + this.SerializedCoordinatorPlanJson = serializedCoordinatorPlanJson; + } + + public string SerializedCoordinatorPlanJson { get; } + + public override void SerializeAsXml(XmlWriter xmlWriter) + { + JObject jObject = JObject.Parse(this.SerializedCoordinatorPlanJson); + string jsonString = jObject.ToString(); + xmlWriter.WriteStartElement("SerializedCoordinatorPlanJson"); + xmlWriter.WriteString(jsonString); + xmlWriter.WriteEndElement(); + } + } + + public sealed class CoordinatorDistributionPlanTestInput : BaselineTestInput + { + internal string CoordinatorPlanJson { get; set; } + + internal CoordinatorDistributionPlanTestInput( + string description, + string coordinatorPlanJson) + : base(description) + { + this.CoordinatorPlanJson = coordinatorPlanJson; + } + + public override void SerializeAsXml(XmlWriter xmlWriter) + { + xmlWriter.WriteElementString("Description", this.Description); + xmlWriter.WriteElementString("CoordinatorDistributionPlanJson", this.CoordinatorPlanJson); + } + } + } +} From 15c5ee93783b89854625274921c2ff8841709954 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 21 Aug 2023 13:39:16 -0700 Subject: [PATCH 06/36] Made ClientQL objects immutable --- .../ClientQL/ClientQLAggregate.cs | 10 +- .../ClientQLAggregateEnumerableExpression.cs | 13 +- .../ClientQL/ClientQLAggregateSignature.cs | 10 +- .../ClientQLArrayCreateScalarExpression.cs | 11 +- .../ClientQLArrayIndexerScalarExpression.cs | 11 +- .../ClientQL/ClientQLArrayLiteral.cs | 8 +- .../ClientQL/ClientQLBaseType.cs | 8 +- .../ClientQL/ClientQLBinaryLiteral.cs | 12 +- .../ClientQLBinaryScalarExpression.cs | 17 +- .../ClientQL/ClientQLBooleanLiteral.cs | 8 +- .../ClientQL/ClientQLBuiltinAggregate.cs | 8 +- .../ClientQL/ClientQLCGuidLiteral.cs | 8 +- .../ClientQL/ClientQLDelegate.cs | 10 +- .../ClientQLDistinctEnumerableExpression.cs | 14 +- .../ClientQL/ClientQLEnumType.cs | 8 +- .../ClientQL/ClientQLEnumerableExpression.cs | 7 +- .../ClientQLFlattenEnumerableExpression.cs | 10 +- .../ClientQL/ClientQLFunctionIdentifier.cs | 2 +- .../ClientQLGroupByEnumerableExpression.cs | 14 +- .../ClientQL/ClientQLGroupByKey.cs | 7 +- .../ClientQL/ClientQLILMRegexLiteral.cs | 11 +- .../ClientQLInputEnumerableExpression.cs | 10 +- .../ClientQLIsOperatorScalarExpression.cs | 11 +- .../ClientQL/ClientQLLetScalarExpression.cs | 14 +- .../ClientQL/ClientQLLiteral.cs | 7 +- .../ClientQLLiteralScalarExpression.cs | 8 +- .../ClientQLLiteralScalarlExpression.cs | 13 - .../ClientQL/ClientQLMDateTimeLiteral.cs | 8 +- .../ClientQL/ClientQLMJavaScriptLiteral.cs | 8 +- .../ClientQL/ClientQLMNumberLiteral.cs | 8 +- .../ClientQL/ClientQLMSingletonLiteral.cs | 8 +- .../ClientQL/ClientQLMSymbolLiteral.cs | 8 +- .../ClientQL/ClientQLMuxScalarExpression.cs | 14 +- .../ClientQL/ClientQLNumberLiteral.cs | 10 +- .../ClientQLObjectCreateScalarExpression.cs | 11 +- .../ClientQL/ClientQLObjectLiteral.cs | 8 +- .../ClientQL/ClientQLObjectLiteralProperty.cs | 12 +- .../ClientQL/ClientQLObjectProperty.cs | 10 +- .../ClientQLOrderByEnumerableExpression.cs | 15 +- .../ClientQL/ClientQLOrderByItem.cs | 10 +- .../ClientQL/ClientQLProgram.cs | 2 +- .../ClientQLPropertyRefScalarExpression.cs | 11 +- .../ClientQLScalarAsEnumerableExpression.cs | 13 +- .../ClientQL/ClientQLScalarExpression.cs | 7 +- .../ClientQLScalarExpressionDelegate.cs | 11 +- .../ClientQLSelectEnumerableExpression.cs | 14 +- .../ClientQLSelectManyEnumerableExpression.cs | 16 +- .../ClientQL/ClientQLStringLiteral.cs | 8 +- ...entQLSystemFunctionCallScalarExpression.cs | 11 +- .../ClientQLTakeEnumerableExpression.cs | 16 +- .../ClientQL/ClientQLTupleAggregate.cs | 8 +- .../ClientQLTupleCreateScalarExpression.cs | 8 +- .../ClientQLTupleItemRefScalarExpression.cs | 11 +- .../ClientQL/ClientQLTupleType.cs | 8 +- .../ClientQL/ClientQLType.cs | 7 +- .../ClientQL/ClientQLUnaryScalarExpression.cs | 11 +- ...UserDefinedFunctionCallScalarExpression.cs | 14 +- .../ClientQL/ClientQLVariable.cs | 10 +- .../ClientQLVariableRefScalarExpression.cs | 8 +- .../ClientQLWhereEnumerableExpression.cs | 13 +- .../ClientQL/CoordinatorDistributionPlan.cs | 7 +- ...CoordinatorDistributionPlanDeserializer.cs | 408 ++++++------------ ...ordinatorDistributionPlanDeserializing.xml | 221 +++++++++- 63 files changed, 837 insertions(+), 406 deletions(-) delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarlExpression.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs index dbdcb6d0d4..dca6a9480a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs @@ -6,8 +6,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLAggregate { - public ClientQLAggregateKind Kind { get; set; } + public ClientQLAggregate(ClientQLAggregateKind kind, string operatorKind) + { + this.Kind = kind; + this.OperatorKind = operatorKind; + } + + public ClientQLAggregateKind Kind { get; } - public string OperatorKind { get; set; } + public string OperatorKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs index b60e86e6eb..920f961a86 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs @@ -4,13 +4,18 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - using System; - internal class ClientQLAggregateEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLAggregateEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLAggregate aggregate) + : base(ClientQLEnumerableExpressionKind.Aggregate) + { + this.SourceExpression = sourceExpression; + this.Aggregate = aggregate; + } + + public ClientQLEnumerableExpression SourceExpression { get; } - public ClientQLAggregate Aggregate { get; set; } + public ClientQLAggregate Aggregate { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs index b1a9c50560..c900e6b515 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs @@ -6,8 +6,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLAggregateSignature { - public ClientQLTypeKind ItemType { get; set; } + public ClientQLAggregateSignature(ClientQLTypeKind itemType, ClientQLTypeKind resultType) + { + this.ItemType = itemType; + this.ResultType = resultType; + } + + public ClientQLTypeKind ItemType { get; } - public ClientQLTypeKind ResultType { get; set; } + public ClientQLTypeKind ResultType { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs index 83240c8794..40d2ce097c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs @@ -8,9 +8,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLArrayCreateScalarExpression : ClientQLScalarExpression { - public ClientQLArrayKind ArrayKind { get; set; } + public ClientQLArrayCreateScalarExpression(ClientQLArrayKind arrayKind, List vecItems) + : base(ClientQLScalarExpressionKind.ArrayCreate) + { + this.ArrayKind = arrayKind; + this.VecItems = vecItems; + } + + public ClientQLArrayKind ArrayKind { get; } - public List VecItems { get; set; } + public List VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs index fdcc4ec4bf..045a5c3bb8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs @@ -6,9 +6,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLArrayIndexerScalarExpression : ClientQLScalarExpression { - public ClientQLScalarExpression Expression { get; set; } + public ClientQLArrayIndexerScalarExpression(ClientQLScalarExpression expression, int index) + : base(ClientQLScalarExpressionKind.ArrayIndexer) + { + this.Expression = expression; + this.Index = index; + } + + public ClientQLScalarExpression Expression { get; } - public int Index { get; set; } + public int Index { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs index baff70f0f8..64ace0a45e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs @@ -8,6 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLArrayLiteral : ClientQLLiteral { - public List VecItems { get; set; } + public ClientQLArrayLiteral(List vecItems) + : base(ClientQLLiteralKind.Array) + { + this.VecItems = vecItems; + } + + public List VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs index 6f2b1debc9..00704ed595 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBaseType : ClientQLType { - public bool ExcludesUndefined { get; set; } + public ClientQLBaseType(bool excludesUndefined) + : base(ClientQLTypeKind.Base) + { + this.ExcludesUndefined = excludesUndefined; + } + + public bool ExcludesUndefined { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs index 0030111285..13105e58c3 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs @@ -4,9 +4,17 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { + using System; + using System.Collections.Generic; + internal class ClientQLBinaryLiteral : ClientQLLiteral { - // Dont know what should go inside - //const LinearAllocBuffer m_value; + public ClientQLBinaryLiteral(List value) + : base(ClientQLLiteralKind.Binary) + { + this.Value = value; + } + + public List Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs index e7c2e582de..e0860af181 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs @@ -6,13 +6,22 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBinaryScalarExpression : ClientQLScalarExpression { - public ClientQLBinaryScalarOperatorKind OperatorKind { get; set; } + public ClientQLBinaryScalarExpression(ClientQLBinaryScalarOperatorKind operatorKind, int maxDepth, ClientQLScalarExpression leftExpression, ClientQLScalarExpression rightExpression) + : base(ClientQLScalarExpressionKind.BinaryOperator) + { + this.OperatorKind = operatorKind; + this.MaxDepth = maxDepth; + this.LeftExpression = leftExpression; + this.RightExpression = rightExpression; + } - public int MaxDepth { get; set; } + public ClientQLBinaryScalarOperatorKind OperatorKind { get; } - public ClientQLScalarExpression LeftExpression { get; set; } + public int MaxDepth { get; } + + public ClientQLScalarExpression LeftExpression { get; } - public ClientQLScalarExpression RightExpression { get; set; } + public ClientQLScalarExpression RightExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs index 4136a0294d..0cd571cfac 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBooleanLiteral : ClientQLLiteral { - public bool Value { get; set; } + public ClientQLBooleanLiteral(bool value) + : base(ClientQLLiteralKind.Boolean) + { + this.Value = value; + } + + public bool Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs index 1c946e2e40..8dbc42ea75 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBuiltinAggregate : ClientQLAggregate { - public new ClientQLAggregateOperatorKind OperatorKind { get; set; } + public ClientQLBuiltinAggregate(string operatorKind, ClientQLAggregateOperatorKind aggregateOperatorKind) + : base(ClientQLAggregateKind.Builtin, operatorKind) + { + this.AggregateOperatorKind = aggregateOperatorKind; + } + + public ClientQLAggregateOperatorKind AggregateOperatorKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs index 72d0fee0c0..3e6a12c597 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLCGuidLiteral : ClientQLLiteral { - public System.Guid Value { get; set; } + public ClientQLCGuidLiteral(System.Guid value) + : base(ClientQLLiteralKind.CGuid) + { + this.Value = value; + } + + public System.Guid Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs index 0612124943..a2ca8d378e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs @@ -6,8 +6,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLDelegate { - public ClientQLDelegateKind Kind { get; set; } + public ClientQLDelegate(ClientQLDelegateKind kind, ClientQLType type) + { + this.Kind = kind; + this.Type = type; + } + + public ClientQLDelegateKind Kind { get; } - public ClientQLType Type { get; set; } + public ClientQLType Type { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs index f5cc995bb9..42300ca329 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs @@ -8,11 +8,19 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLDistinctEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLDistinctEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, List vecExpression) + : base(ClientQLEnumerableExpressionKind.Distinct) + { + this.SourceExpression = sourceExpression; + this.DeclaredVariable = declaredVariable; + this.VecExpression = vecExpression; + } - public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLEnumerableExpression SourceExpression { get; } + + public ClientQLVariable DeclaredVariable { get; } - public List VecExpression { get; set; } + public List VecExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs index 2103e08ca2..1179ff82c6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLEnumType : ClientQLType { - public ClientQLType ItemType { get; set; } + public ClientQLEnumType(ClientQLType itemType) + : base(ClientQLTypeKind.Enum) + { + this.ItemType = itemType; + } + + public ClientQLType ItemType { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs index 65bc6bfda1..c2ed7305c7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs @@ -6,6 +6,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLEnumerableExpression : ClientQLExpression { - public ClientQLEnumerableExpressionKind Kind { get; set; } + public ClientQLEnumerableExpression(ClientQLEnumerableExpressionKind kind) + { + this.Kind = kind; + } + + public ClientQLEnumerableExpressionKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs index 7fd67aba98..653e32659a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs @@ -4,11 +4,15 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - using System; - internal class ClientQLFlattenEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLFlattenEnumerableExpression(ClientQLEnumerableExpression sourceExpression) + : base(ClientQLEnumerableExpressionKind.Flatten) + { + this.SourceExpression = sourceExpression; + } + + public ClientQLEnumerableExpression SourceExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs index e6e43833e5..10e0ea1232 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs @@ -6,6 +6,6 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLFunctionIdentifier { - public string StrName { get; set; } + public string StrName { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs index 1de96cd184..eef08f232f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs @@ -8,11 +8,19 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLGroupByEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, List vecKeys, List vecAggregates) + : base(ClientQLEnumerableExpressionKind.GroupBy) + { + this.SourceExpression = sourceExpression; + this.VecKeys = vecKeys; + this.VecAggregates = vecAggregates; + } - public List VecKeys { get; set; } + public ClientQLEnumerableExpression SourceExpression { get; } + + public List VecKeys { get; } - public List VecAggregates { get; set; } + public List VecAggregates { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs index 7ef01cebe1..04deb6bdab 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs @@ -6,6 +6,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLGroupByKey { - public ClientQLType Type { get; set; } + public ClientQLGroupByKey(ClientQLType type) + { + this.Type = type; + } + + public ClientQLType Type { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs index 440cfd073c..d17817ea1d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs @@ -6,8 +6,15 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLILMRegexLiteral : ClientQLLiteral { - public string StrPatter { get; set; } + public ClientQLILMRegexLiteral(string strPatter, string strOption) + : base(ClientQLLiteralKind.MRegex) + { + this.StrPatter = strPatter; + this.StrOption = strOption; + } + + public string StrPatter { get; } - public string StrOption { get; set; } + public string StrOption { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs index 0b0792bf1f..2c33292402 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs @@ -4,11 +4,15 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - using System; - internal class ClientQLInputEnumerableExpression : ClientQLEnumerableExpression { - public string Name { get; set; } + public ClientQLInputEnumerableExpression(string name) + : base(ClientQLEnumerableExpressionKind.Input) + { + this.Name = name; + } + + public string Name { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs index 39eb00e6f5..dc7c8f71ea 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs @@ -8,9 +8,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLIsOperatorScalarExpression : ClientQLScalarExpression { - public ClientQLIsOperatorKind OperatorKind { get; set; } + public ClientQLIsOperatorScalarExpression(ClientQLIsOperatorKind operatorKind, ClientQLScalarExpression expression) + : base(ClientQLScalarExpressionKind.IsOperator) + { + this.OperatorKind = operatorKind; + this.Expression = expression; + } + + public ClientQLIsOperatorKind OperatorKind { get; } - public ClientQLScalarExpression Expression { get; set; } + public ClientQLScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs index ef07c48ac9..f3b4b864ab 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs @@ -8,11 +8,19 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLLetScalarExpression : ClientQLScalarExpression { - public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLLetScalarExpression(ClientQLVariable declaredVariable, ClientQLScalarExpression declaredVariableExpression, ClientQLScalarExpression expression) + : base(ClientQLScalarExpressionKind.Let) + { + this.DeclaredVariable = declaredVariable; + this.DeclaredVariableExpression = declaredVariableExpression; + this.Expression = expression; + } - public ClientQLScalarExpression DeclaredVariableExpression { get; set; } + public ClientQLVariable DeclaredVariable { get; } + + public ClientQLScalarExpression DeclaredVariableExpression { get; } - public ClientQLScalarExpression Expression { get; set; } + public ClientQLScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs index d16313ebce..02bf828c50 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs @@ -6,6 +6,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLLiteral { - public ClientQLLiteralKind Kind { get; set; } + public ClientQLLiteral(ClientQLLiteralKind kind) + { + this.Kind = kind; + } + + public ClientQLLiteralKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs index 1786309dbb..838baeb436 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs @@ -6,7 +6,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLLiteralScalarExpression : ClientQLScalarExpression { - public ClientQLLiteral Literal { get; set; } + public ClientQLLiteralScalarExpression(ClientQLLiteral literal) + : base(ClientQLScalarExpressionKind.Let) + { + this.Literal = literal; + } + + public ClientQLLiteral Literal { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarlExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarlExpression.cs deleted file mode 100644 index 9eeabeeb92..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarlExpression.cs +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - using System.Collections.Generic; - - internal class ClientQLLiteralScalarlExpression : ClientQLScalarExpression - { - public ClientQLLiteral Literal { get; set; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs index f7ce620832..08c906b53a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMDateTimeLiteral : ClientQLLiteral { - public int Value { get; set; } + public ClientQLMDateTimeLiteral(int value) + : base(ClientQLLiteralKind.MDateTime) + { + this.Value = value; + } + + public int Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs index e32036596d..de355477ac 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMJavaScriptLiteral : ClientQLLiteral { - public string StrName { get; set; } + public ClientQLMJavaScriptLiteral(string strName) + : base(ClientQLLiteralKind.MJavaScript) + { + this.StrName = strName; + } + + public string StrName { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs index e154ce46d7..a5b1bd5d6a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMNumberLiteral : ClientQLLiteral { - public int Value { get; set; } // might need to be changed MNumber + public ClientQLMNumberLiteral(int value) + : base(ClientQLLiteralKind.MNumber) + { + this.Value = value; + } + + public int Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs index f68cd66adb..70409a0629 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMSingletonLiteral : ClientQLLiteral { + public ClientQLMSingletonLiteral(Kind singletonKind) + : base(ClientQLLiteralKind.MSingleton) + { + this.SingletonKind = singletonKind; + } + public new enum Kind { MaxKey, @@ -13,6 +19,6 @@ internal class ClientQLMSingletonLiteral : ClientQLLiteral Undefined } - public Kind SingletonKind { get; set; } + public Kind SingletonKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs index a9c1723598..7f730a11e6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMSymbolLiteral : ClientQLLiteral { - public string StrValue { get; set; } + public ClientQLMSymbolLiteral(string strValue) + : base(ClientQLLiteralKind.MSymbol) + { + this.StrValue = strValue; + } + + public string StrValue { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs index ccae7fe256..630db72d53 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs @@ -6,11 +6,19 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMuxScalarExpression : ClientQLScalarExpression { - public ClientQLScalarExpression ConditionExpression { get; set; } + public ClientQLMuxScalarExpression(ClientQLScalarExpression conditionExpression, ClientQLScalarExpression leftExpression, ClientQLScalarExpression rightExpression) + : base(ClientQLScalarExpressionKind.Mux) + { + this.ConditionExpression = conditionExpression; + this.LeftExpression = leftExpression; + this.RightExpression = rightExpression; + } - public ClientQLScalarExpression LeftExpression { get; set; } + public ClientQLScalarExpression ConditionExpression { get; } + + public ClientQLScalarExpression LeftExpression { get; } - public ClientQLScalarExpression RightExpression { get; set; } + public ClientQLScalarExpression RightExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs index 298b1983cc..0ef8d5c1f0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs @@ -4,8 +4,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { + using System.Collections.Generic; + internal class ClientQLNumberLiteral : ClientQLLiteral { - public System.Int64 Value { get; set; } + public ClientQLNumberLiteral(long value) + : base(ClientQLLiteralKind.Number) + { + this.Value = value; + } + + public long Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs index 47af9f2610..c14073fb7d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs @@ -8,9 +8,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLObjectCreateScalarExpression : ClientQLScalarExpression { - public List Properties { get; set; } + public ClientQLObjectCreateScalarExpression(List properties, ClientQLObjectKind objectKind) + : base(ClientQLScalarExpressionKind.ObjectCreate) + { + this.Properties = properties; + this.ObjectKind = objectKind; + } + + public List Properties { get; } - public ClientQLObjectKind ObjectKind { get; set; } + public ClientQLObjectKind ObjectKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs index dc8d2c2741..fe5ed3199b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs @@ -8,6 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLObjectLiteral : ClientQLLiteral { - public List VecProperties { get; set; } + public ClientQLObjectLiteral(List vecProperties) + : base(ClientQLLiteralKind.Object) + { + this.VecProperties = vecProperties; + } + + public List VecProperties { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs index a3aec1f60c..3b569a85cd 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs @@ -4,10 +4,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - internal class ClientQLObjectLiteralProperty : ClientQLLiteral + internal class ClientQLObjectLiteralProperty { - public string StrName { get; set; } + public ClientQLObjectLiteralProperty(string strName, ClientQLLiteral literal) + { + this.StrName = strName; + this.Literal = literal; + } - public ClientQLLiteral Literal { get; set; } + public string StrName { get; } + + public ClientQLLiteral Literal { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs index 732705b1dc..b947b7fbac 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs @@ -6,8 +6,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLObjectProperty { - public string Name { get; set; } + public ClientQLObjectProperty(string name, ClientQLScalarExpression expression) + { + this.Name = name; + this.Expression = expression; + } + + public string Name { get; } - public ClientQLScalarExpression Expression { get; set; } + public ClientQLScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs index bbbbc09a3d..6c2a641143 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs @@ -4,16 +4,23 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - using System; using System.Collections.Generic; internal class ClientQLOrderByEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLOrderByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, List vecItems) + : base(ClientQLEnumerableExpressionKind.OrderBy) + { + this.SourceExpression = sourceExpression; + this.DeclaredVariable = declaredVariable; + this.VecItems = vecItems; + } - public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLEnumerableExpression SourceExpression { get; } + + public ClientQLVariable DeclaredVariable { get; } - public List VecItems { get; set; } + public List VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs index f3c6b77238..18042582af 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs @@ -6,8 +6,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLOrderByItem { - public ClientQLScalarExpression Expression { get; set; } + public ClientQLOrderByItem(ClientQLScalarExpression expression, ClientQLSortOrder sortOrder) + { + this.Expression = expression; + this.SortOrder = sortOrder; + } + + public ClientQLScalarExpression Expression { get; } - public ClientQLSortOrder SortOrder { get; set; } + public ClientQLSortOrder SortOrder { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs index 59d28876d5..ad33a22439 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs @@ -6,6 +6,6 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLProgram { - public ClientQLEnumerableExpression Expression { get; set; } + public ClientQLEnumerableExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs index 4faa68b996..ed56e51fe9 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs @@ -8,9 +8,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLPropertyRefScalarExpression : ClientQLScalarExpression { - public ClientQLScalarExpression Expression { get; set; } + public ClientQLPropertyRefScalarExpression(ClientQLScalarExpression expression, string propertyName) + : base(ClientQLScalarExpressionKind.PropertyRef) + { + this.Expression = expression; + this.PropertyName = propertyName; + } + + public ClientQLScalarExpression Expression { get; } - public string PropertyName { get; set; } //might need to be changed + public string PropertyName { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs index caf6a3115f..36433b707f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs @@ -4,13 +4,18 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - using System; - internal class ClientQLScalarAsEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLScalarExpression Expression { get; set; } + public ClientQLScalarAsEnumerableExpression(ClientQLScalarExpression expression, ClientQLEnumerationKind enumerationKind) + : base(ClientQLEnumerableExpressionKind.ScalarAsEnumerable) + { + this.Expression = expression; + this.EnumerationKind = enumerationKind; + } + + public ClientQLScalarExpression Expression { get; } - public ClientQLEnumerationKind EnumerationKind { get; set; } + public ClientQLEnumerationKind EnumerationKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs index 2165b0a36e..e0299827cf 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs @@ -6,6 +6,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLScalarExpression : ClientQLExpression { - public ClientQLScalarExpressionKind Kind { get; set; } + public ClientQLScalarExpression(ClientQLScalarExpressionKind kind) + { + this.Kind = kind; + } + + public ClientQLScalarExpressionKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs index f2d5b57740..456f336e3d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs @@ -6,8 +6,15 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLScalarExpressionDelegate : ClientQLDelegate { - public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLScalarExpressionDelegate(ClientQLType type, ClientQLVariable declaredVariable, ClientQLScalarExpression expression) + : base(ClientQLDelegateKind.ScalarExpression, type) + { + this.DeclaredVariable = declaredVariable; + this.Expression = expression; + } + + public ClientQLVariable DeclaredVariable { get; } - public ClientQLScalarExpression Expression { get; set; } + public ClientQLScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs index 28155c6665..29ca8d88ec 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs @@ -6,11 +6,19 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLSelectEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLSelectEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, ClientQLScalarExpression expression) + : base(ClientQLEnumerableExpressionKind.Select) + { + this.SourceExpression = sourceExpression; + this.DeclaredVariable = declaredVariable; + this.Expression = expression; + } - public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLEnumerableExpression SourceExpression { get; } + + public ClientQLVariable DeclaredVariable { get; } - public ClientQLScalarExpression Expression { get; set; } + public ClientQLScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs index 601485cebb..93a6c917c8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs @@ -4,15 +4,21 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - using System; - internal class ClientQLSelectManyEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLSelectManyEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, ClientQLEnumerableExpression selectorExpression) + : base(ClientQLEnumerableExpressionKind.SelectMany) + { + this.SourceExpression = sourceExpression; + this.DeclaredVariable = declaredVariable; + this.SelectorExpression = selectorExpression; + } + + public ClientQLEnumerableExpression SourceExpression { get; } - public ClientQLVariable DeclaredVariable { get; set; } + public ClientQLVariable DeclaredVariable { get; } - public ClientQLEnumerableExpression SelectorExpression { get; set; } + public ClientQLEnumerableExpression SelectorExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs index 07db9a193e..66bedbf81e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs @@ -6,6 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLStringLiteral : ClientQLLiteral { - public string StrValue { get; set; } + public ClientQLStringLiteral(string strValue) + : base(ClientQLLiteralKind.String) + { + this.StrValue = strValue; + } + + public string StrValue { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs index e8a142431d..7e9fd13906 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs @@ -8,9 +8,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLSystemFunctionCallScalarExpression : ClientQLScalarExpression { - public ClientQLBuiltinScalarFunctionKind FunctionKind { get; set; } + public ClientQLSystemFunctionCallScalarExpression(ClientQLBuiltinScalarFunctionKind functionKind, List vecArguments) + : base(ClientQLScalarExpressionKind.SystemFunctionCall) + { + this.FunctionKind = functionKind; + this.VecArguments = vecArguments; + } + + public ClientQLBuiltinScalarFunctionKind FunctionKind { get; } - public List VecArguments { get; set; } + public List VecArguments { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs index 46be0b098f..9b2ffb8b5f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs @@ -4,15 +4,21 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - using System; - internal class ClientQLTakeEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLTakeEnumerableExpression(ClientQLEnumerableExpression sourceExpression, int skipValue, int takeValue) + : base(ClientQLEnumerableExpressionKind.Take) + { + this.SourceExpression = sourceExpression; + this.SkipValue = skipValue; + this.TakeValue = takeValue; + } + + public ClientQLEnumerableExpression SourceExpression { get; } - public int SkipValue { get; set; } + public int SkipValue { get; } - public int TakeValue { get; set; } + public int TakeValue { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs index 8e3aa6d4a5..3162b5425b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs @@ -8,6 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleAggregate : ClientQLAggregate { - public List VecItems { get; set; } + public ClientQLTupleAggregate(string operatorKind, List vecItems) + : base(ClientQLAggregateKind.Tuple, operatorKind) + { + this.VecItems = vecItems; + } + + public List VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs index ad56e507b2..590abf0c29 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs @@ -8,7 +8,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleCreateScalarExpression : ClientQLScalarExpression { - public List VecItems { get; set; } + public ClientQLTupleCreateScalarExpression(List vecItems) + : base(ClientQLScalarExpressionKind.TupleCreate) + { + this.VecItems = vecItems; + } + + public List VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs index 5c9a4c50bf..65fb2ca3f2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs @@ -6,9 +6,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLTupleItemRefScalarExpression : ClientQLScalarExpression { - public ClientQLScalarExpression Expression { get; set; } + public ClientQLTupleItemRefScalarExpression(ClientQLScalarExpression expression, int index) + : base(ClientQLScalarExpressionKind.TupleItemRef) + { + this.Expression = expression; + this.Index = index; + } + + public ClientQLScalarExpression Expression { get; } - public int Index { get; set; } + public int Index { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs index 3e4b7a261d..e78c761f24 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs @@ -8,7 +8,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleType : ClientQLType { - public List VecTypes { get; set; } + public ClientQLTupleType(List vecTypes) + : base(ClientQLTypeKind.Tuple) + { + this.VecTypes = vecTypes; + } + + public List VecTypes { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs index 6bc716672e..f0ffadc3f3 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs @@ -6,6 +6,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLType { - public ClientQLTypeKind Kind { get; set; } + public ClientQLType(ClientQLTypeKind kind) + { + this.Kind = kind; + } + + public ClientQLTypeKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs index 53fbb8b587..9f9ae1cf76 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs @@ -6,9 +6,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLUnaryScalarExpression : ClientQLScalarExpression { - public ClientQLUnaryScalarOperatorKind OperatorKind { get; set; } + public ClientQLUnaryScalarExpression(ClientQLUnaryScalarOperatorKind operatorKind, ClientQLScalarExpression expression) + : base(ClientQLScalarExpressionKind.UnaryOperator) + { + this.OperatorKind = operatorKind; + this.Expression = expression; + } + + public ClientQLUnaryScalarOperatorKind OperatorKind { get; } - public ClientQLScalarExpression Expression { get; set; } + public ClientQLScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs index c6baf976d2..6100329ea4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs @@ -8,11 +8,19 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLUserDefinedFunctionCallScalarExpression : ClientQLScalarExpression { - public ClientQLFunctionIdentifier Identifier { get; set; } + public ClientQLUserDefinedFunctionCallScalarExpression(ClientQLFunctionIdentifier identifier, List vecArguments, bool builtin) + : base(ClientQLScalarExpressionKind.UserDefinedFunctionCall) + { + this.Identifier = identifier; + this.VecArguments = vecArguments; + this.Builtin = builtin; + } - public List VecArguments { get; set; } + public ClientQLFunctionIdentifier Identifier { get; } + + public List VecArguments { get; } - public bool Builtin { get; set; } + public bool Builtin { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs index 7df7e888af..4d81df0526 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs @@ -6,8 +6,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLVariable { - public string Name { get; set; } + public ClientQLVariable(string name, int uniqueId) + { + this.Name = name; + this.UniqueId = uniqueId; + } + + public string Name { get; } - public int UniqueId { get; set; } + public int UniqueId { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs index 14a26fb031..f5ac5414ba 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs @@ -6,7 +6,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLVariableRefScalarExpression : ClientQLScalarExpression { - public ClientQLVariable Variable { get; set; } + public ClientQLVariableRefScalarExpression(ClientQLVariable variable) + : base(ClientQLScalarExpressionKind.VariableRef) + { + this.Variable = variable; + } + + public ClientQLVariable Variable { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs index fe37b4b2d8..e6856f2d6e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs @@ -4,13 +4,18 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - using System; - internal class ClientQLWhereEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLEnumerableExpression SourceExpression { get; set; } + public ClientQLWhereEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLDelegate clientQLDelegate) + : base(ClientQLEnumerableExpressionKind.Where) + { + this.SourceExpression = sourceExpression; + this.Delegate = clientQLDelegate; + } + + public ClientQLEnumerableExpression SourceExpression { get; } - public ClientQLDelegate Delegate { get; set; } + public ClientQLDelegate Delegate { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs index 4ef465750e..7dea7be63f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs @@ -6,6 +6,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class CoordinatorDistributionPlan { - public ClientQLExpression ClientQL { get; set; } + public CoordinatorDistributionPlan(ClientQLExpression clientQL) + { + this.ClientQL = clientQL; + } + + public ClientQLExpression ClientQL { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 17c5aa2076..c4f5b30375 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -6,7 +6,6 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan { using System; using System.Collections.Generic; - using System.Linq; using ClientQL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -18,12 +17,9 @@ public CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string JObject token = JObject.Parse(jsonString); JsonSerializer serializer = new JsonSerializer(); - CoordinatorDistributionPlan plan = new CoordinatorDistributionPlan - { - ClientQL = this.DeserializeClientQLEnumerableExpression(token["coordinatorDistributionPlan"]["clientQL"], serializer) - }; + ClientQLExpression clientQL = this.DeserializeClientQLEnumerableExpression(token["coordinatorDistributionPlan"]["clientQL"], serializer); - return plan; + return new CoordinatorDistributionPlan(clientQL); } public ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, JsonSerializer serializer) @@ -61,140 +57,92 @@ public ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JTok public ClientQLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLAggregateEnumerableExpression aggregateExpression = new ClientQLAggregateEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.Aggregate, - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), - Aggregate = this.DeserializeAggregate(token["Aggregate"]) - }; + ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLAggregate aggregate = this.DeserializeAggregate(token["Aggregate"]); - return aggregateExpression; + return new ClientQLAggregateEnumerableExpression(sourceExpression, aggregate); } public ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLDistinctEnumerableExpression distinctExpression = new ClientQLDistinctEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.Distinct, - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), - DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), - VecExpression = token["VecExpression"].ToObject>(serializer) - }; + ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); + List vecExpressions = this.DeserializeScalarExpressionArray(token["VecExpression"], serializer); - return distinctExpression; + return new ClientQLDistinctEnumerableExpression(sourceExpression, declaredVariable, vecExpressions); } public ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLGroupByEnumerableExpression groupByExpression = new ClientQLGroupByEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.GroupBy, - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), - VecKeys = this.DeserializeGroupByKeys(token["VecKeys"]), - VecAggregates = this.DeserializeAggregates(token["VecAggregates"]) - }; + ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + List vecKeys = this.DeserializeGroupByKeys(token["VecKeys"]); + List vecAggregates = this.DeserializeAggregates(token["VecAggregates"]); - return groupByExpression; + return new ClientQLGroupByEnumerableExpression(sourceExpression, vecKeys, vecAggregates); } public ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLFlattenEnumerableExpression flattenExpression = new ClientQLFlattenEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.Flatten, - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer) - }; + ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - return flattenExpression; + return new ClientQLFlattenEnumerableExpression(sourceExpression); } public ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLInputEnumerableExpression inputExpression = new ClientQLInputEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.Input, - Name = token.Value("Name") - }; - - return inputExpression; + return new ClientQLInputEnumerableExpression(token.Value("Name")); } public ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLOrderByEnumerableExpression orderByExpression = new ClientQLOrderByEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.OrderBy, - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), - DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), - VecItems = this.DeserializeOrderByItems(token["VecItems"], serializer) - }; + ClientQLEnumerableExpression source = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); + List orderByItems = this.DeserializeOrderByItems(token["VecItems"], serializer); - return orderByExpression; + return new ClientQLOrderByEnumerableExpression(source, declaredVariable, orderByItems); } public ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarAsEnumerableExpression scalarAsEnumerableExpression = new ClientQLScalarAsEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.ScalarAsEnumerable, - Expression = this.DeserializeScalarExpression(token["Expression"], serializer), - EnumerationKind = (ClientQLEnumerationKind)Enum.Parse(typeof(ClientQLEnumerationKind), token.Value("EnumerationKind")) - }; + ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + ClientQLEnumerationKind enumerationKind = (ClientQLEnumerationKind)Enum.Parse(typeof(ClientQLEnumerationKind), token.Value("EnumerationKind")); - return scalarAsEnumerableExpression; + return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); } public ClientQLSelectEnumerableExpression DeserializeSelectEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLSelectEnumerableExpression selectExpression = new ClientQLSelectEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.Select, - Expression = this.DeserializeScalarExpression(token["Expression"], serializer), - DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer) - }; + ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); + ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); - return selectExpression; + return new ClientQLSelectEnumerableExpression(sourceExpression, declaredVariable, expression); } public ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpression(JToken token, JsonSerializer serializer) { - ClientQLSelectManyEnumerableExpression selectManyExpression = new ClientQLSelectManyEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.SelectMany, - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), - DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), - SelectorExpression = this.DeserializeClientQLEnumerableExpression(token["SelectorExpression"], serializer) - }; + ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); + ClientQLEnumerableExpression selectorExpression = this.DeserializeClientQLEnumerableExpression(token["SelectorExpression"], serializer); - return selectManyExpression; + return new ClientQLSelectManyEnumerableExpression(sourceExpression, declaredVariable, selectorExpression); } public ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLTakeEnumerableExpression takeExpression = new ClientQLTakeEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.Take, - - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), - SkipValue = token.Value("SkipValue"), - TakeValue = token.Value("TakeValue") - }; - - return takeExpression; + ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + int skipValue = token.Value("SkipValue"); + int takeExpression = token.Value("TakeValue"); + + return new ClientQLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); } public ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLWhereEnumerableExpression whereExpression = new ClientQLWhereEnumerableExpression - { - Kind = ClientQLEnumerableExpressionKind.Where, + ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLDelegate clientDelegate = this.DeserializeDelegateExpression(token["Delegate"]); - SourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer), - Delegate = this.DeserializeDelegateExpression(token["Delegate"]) - }; - - return whereExpression; + return new ClientQLWhereEnumerableExpression(sourceExpression, clientDelegate); } public ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSerializer serializer) @@ -240,260 +188,161 @@ public ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSe public ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLArrayCreateScalarExpression arrayCreateExpression = new ClientQLArrayCreateScalarExpression - { - Kind = ClientQLScalarExpressionKind.ArrayCreate, - ArrayKind = token.Value("ArrayKind"), - VecItems = token["VecItems"].ToObject>(serializer) - }; + ClientQLArrayKind arrayKind = token.Value("ArrayKind"); + List vecItems = this.DeserializeScalarExpressionArray(token["VecItems"], serializer); - return arrayCreateExpression; + return new ClientQLArrayCreateScalarExpression(arrayKind, vecItems); } public ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLArrayIndexerScalarExpression arrayIndexerExpression = new ClientQLArrayIndexerScalarExpression - { - Kind = ClientQLScalarExpressionKind.ArrayIndexer, - Expression = this.DeserializeScalarExpression(token["Expression"], serializer), - Index = token.Value("Index") - }; - - return arrayIndexerExpression; + ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + int index = token.Value("Index"); + + return new ClientQLArrayIndexerScalarExpression(expression, index); } public ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLBinaryScalarExpression binaryExpression = new ClientQLBinaryScalarExpression - { - Kind = ClientQLScalarExpressionKind.BinaryOperator, - OperatorKind = (ClientQLBinaryScalarOperatorKind)Enum.Parse(typeof(ClientQLBinaryScalarOperatorKind), token.Value("OperatorKind")), - MaxDepth = token.Value("MaxDepth"), - LeftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer), - RightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer) - }; + ClientQLBinaryScalarOperatorKind operatorKind = (ClientQLBinaryScalarOperatorKind)Enum.Parse(typeof(ClientQLBinaryScalarOperatorKind), token.Value("OperatorKind")); + int maxDepth = token.Value("MaxDepth"); + ClientQLScalarExpression leftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer); + ClientQLScalarExpression rightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer); - return binaryExpression; + return new ClientQLBinaryScalarExpression(operatorKind, maxDepth, leftExpression, rightExpression); } public ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLIsOperatorScalarExpression isOperatorExpression = new ClientQLIsOperatorScalarExpression - { - Kind = ClientQLScalarExpressionKind.IsOperator, - OperatorKind = (ClientQLIsOperatorKind)Enum.Parse(typeof(ClientQLIsOperatorKind), token.Value("OperatorKind")), - Expression = this.DeserializeScalarExpression(token["Expression"], serializer) - }; + ClientQLIsOperatorKind operatorKind = (ClientQLIsOperatorKind)Enum.Parse(typeof(ClientQLIsOperatorKind), token.Value("OperatorKind")); + ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); - return isOperatorExpression; + return new ClientQLIsOperatorScalarExpression(operatorKind, expression); } public ClientQLLetScalarExpression DeserializeLetScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLLetScalarExpression letExpression = new ClientQLLetScalarExpression - { - Kind = ClientQLScalarExpressionKind.Let, - DeclaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]), - DeclaredVariableExpression = this.DeserializeScalarExpression(token["DeclaredVariableExpression"], serializer), - Expression = this.DeserializeScalarExpression(token["Expression"], serializer) - }; + ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); + ClientQLScalarExpression declaredVariableExpression = this.DeserializeScalarExpression(token["DeclaredVariableExpression"], serializer); + ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); - return letExpression; + return new ClientQLLetScalarExpression(declaredVariable, declaredVariableExpression, expression); } - public ClientQLLiteralScalarlExpression DeserializeLiteralScalarExpression(JToken token, JsonSerializer serializer) + public ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLLiteralScalarlExpression literalExpression = new ClientQLLiteralScalarlExpression - { - Kind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), token.Value("Kind")), - Literal = new ClientQLLiteral - { - Kind = (ClientQLLiteralKind)ClientQLScalarExpressionKind.Literal - } - }; + ClientQLLiteral literal = new ClientQLLiteral((ClientQLLiteralKind)ClientQLScalarExpressionKind.Literal); - return literalExpression; + return new ClientQLLiteralScalarExpression(literal); + } public ClientQLMuxScalarExpression DeserializeMuxScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLMuxScalarExpression muxExpression = new ClientQLMuxScalarExpression - { - Kind = ClientQLScalarExpressionKind.Mux, - ConditionExpression = this.DeserializeScalarExpression(token["ConditionExpression"], serializer), - LeftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer), - RightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer) - }; + ClientQLScalarExpression conditionExpression = this.DeserializeScalarExpression(token["ConditionExpression"], serializer); + ClientQLScalarExpression leftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer); + ClientQLScalarExpression rightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer); - return muxExpression; + return new ClientQLMuxScalarExpression(conditionExpression, leftExpression, rightExpression); } public ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLObjectCreateScalarExpression objectCreateExpression = new ClientQLObjectCreateScalarExpression - { - Kind = ClientQLScalarExpressionKind.ObjectCreate - }; - string objectKindString = token.Value("ObjectKind"); if (!Enum.TryParse(objectKindString, out ClientQLObjectKind objectKind)) { throw new JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); } - objectCreateExpression.ObjectKind = objectKind; - objectCreateExpression.Properties = this.DeserializeObjectProperties(token["Properties"], serializer); + List properties = this.DeserializeObjectProperties(token["Properties"], serializer); - return objectCreateExpression; + return new ClientQLObjectCreateScalarExpression(properties, objectKind); } public ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLPropertyRefScalarExpression propertyRefExpression = new ClientQLPropertyRefScalarExpression - { - Kind = ClientQLScalarExpressionKind.PropertyRef, - Expression = this.DeserializeScalarExpression(token["Expression"], serializer), - PropertyName = token.Value("PropertyName") - }; + ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + string propertyName = token.Value("PropertyName"); - return propertyRefExpression; + return new ClientQLPropertyRefScalarExpression(expression, propertyName); } public ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLSystemFunctionCallScalarExpression functionCallExpression = new ClientQLSystemFunctionCallScalarExpression - { - Kind = ClientQLScalarExpressionKind.SystemFunctionCall, - FunctionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), token.Value("FunctionKind")), - VecArguments = token["VecArguments"] - .Select(argToken => this.DeserializeScalarExpression(argToken, serializer)) - .ToList() - }; + ClientQLBuiltinScalarFunctionKind functionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), token.Value("FunctionKind")); + List vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); - return functionCallExpression; + return new ClientQLSystemFunctionCallScalarExpression(functionKind, vecArguments); } public ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLTupleCreateScalarExpression tupleCreateExpression = new ClientQLTupleCreateScalarExpression - { - Kind = ClientQLScalarExpressionKind.TupleCreate, - VecItems = token["Items"].ToObject>(serializer) - }; + List vecItems = this.DeserializeScalarExpressionArray(token["Items"], serializer); - return tupleCreateExpression; + return new ClientQLTupleCreateScalarExpression(vecItems); } public ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLTupleItemRefScalarExpression tupleItemRefExpression = new ClientQLTupleItemRefScalarExpression - { - Kind = ClientQLScalarExpressionKind.TupleItemRef, - Expression = this.DeserializeScalarExpression(token["Expression"], serializer), - Index = token.Value("Index") - }; + ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + int index = token.Value("Index"); - return tupleItemRefExpression; + return new ClientQLTupleItemRefScalarExpression(expression, index); } public ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLUnaryScalarExpression unaryExpression = new ClientQLUnaryScalarExpression - { - Kind = ClientQLScalarExpressionKind.UnaryOperator, - OperatorKind = (ClientQLUnaryScalarOperatorKind)Enum.Parse(typeof(ClientQLUnaryScalarOperatorKind), token.Value("OperatorKind")), - Expression = this.DeserializeScalarExpression(token["Expression"], serializer) - }; + ClientQLUnaryScalarOperatorKind operatorKind = (ClientQLUnaryScalarOperatorKind)Enum.Parse(typeof(ClientQLUnaryScalarOperatorKind), token.Value("OperatorKind")); + ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); - return unaryExpression; + return new ClientQLUnaryScalarExpression(operatorKind, expression); } public ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLUserDefinedFunctionCallScalarExpression userDefinedFunctionCallExpression = new ClientQLUserDefinedFunctionCallScalarExpression - { - Kind = ClientQLScalarExpressionKind.UserDefinedFunctionCall, - Identifier = token["Identifier"].ToObject(serializer), - VecArguments = token["VecArguments"].ToObject>(serializer), - Builtin = token.Value("Builtin") - }; + ClientQLFunctionIdentifier identifier = token["Identifier"].ToObject(serializer); + List vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); + bool builtin = token.Value("Builtin"); - return userDefinedFunctionCallExpression; + return new ClientQLUserDefinedFunctionCallScalarExpression(identifier, vecArguments, builtin); } public ClientQLVariableRefScalarExpression DeserializeVariableRefScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLVariableRefScalarExpression variableRefExpression = new ClientQLVariableRefScalarExpression - { - Kind = ClientQLScalarExpressionKind.VariableRef, - Variable = this.DeserializeClientQLVariable(token["Variable"]) - }; - - return variableRefExpression; - } - - private List DeserializeOrderByItems(JToken token, JsonSerializer serializer) - { - List orderByItems = new List(); - - if (token != null && token.Type == JTokenType.Array) - { - foreach (JToken itemToken in token) - { - ClientQLOrderByItem orderByItem = new ClientQLOrderByItem - { - Expression = this.DeserializeScalarExpression(itemToken["Expression"], serializer), - SortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), itemToken.Value("SortOrder")) - }; + ClientQLVariable variable = this.DeserializeClientQLVariable(token["Variable"]); - orderByItems.Add(orderByItem); - } - } - - return orderByItems; + return new ClientQLVariableRefScalarExpression(variable); } public ClientQLDelegate DeserializeDelegateExpression(JToken token) { - ClientQLDelegate delegateExpression = new ClientQLDelegate - { - Kind = (ClientQLDelegateKind)Enum.Parse(typeof(ClientQLDelegateKind), token.Value("Kind")), - Type = this.DeserializeType(token["Type"]) - }; + ClientQLDelegateKind kind = (ClientQLDelegateKind)Enum.Parse(typeof(ClientQLDelegateKind), token.Value("Kind")); + ClientQLType type = this.DeserializeType(token["Type"]); - return delegateExpression; + return new ClientQLDelegate(kind, type); } private ClientQLType DeserializeType(JToken token) { - ClientQLType type = new ClientQLType - { - Kind = (ClientQLTypeKind)Enum.Parse(typeof(ClientQLTypeKind), token.Value("Kind")) - }; + ClientQLTypeKind kind = (ClientQLTypeKind)Enum.Parse(typeof(ClientQLTypeKind), token.Value("Kind")); - return type; + return new ClientQLType(kind); } public ClientQLAggregate DeserializeAggregate(JToken token) { - ClientQLAggregate aggregate = new ClientQLAggregate - { - Kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), token.Value("Kind")), - OperatorKind = token["OperatorKind"].ToString() - }; + ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), token.Value("Kind")); + string operatorKind = token["OperatorKind"].ToString(); - return aggregate; + return new ClientQLAggregate(kind, operatorKind); } public ClientQLVariable DeserializeClientQLVariable(JToken token) { - ClientQLVariable variable = new ClientQLVariable - { - Name = token.Value("Name"), - UniqueId = token.Value("UniqueId") - }; + string name = token.Value("Name"); + int uniqueId = token.Value("UniqueId"); - return variable; + return new ClientQLVariable(name, uniqueId); } public List DeserializeObjectProperties(JToken token, JsonSerializer serializer) @@ -503,55 +352,70 @@ public List DeserializeObjectProperties(JToken token, Js { foreach (JToken propertyToken in token) { - ClientQLObjectProperty property = new ClientQLObjectProperty - { - Name = propertyToken.Value("Name"), - Expression = this.DeserializeScalarExpression(propertyToken["Expression"], serializer) - }; - properties.Add(property); + string name = propertyToken.Value("Name"); + ClientQLScalarExpression expression = this.DeserializeScalarExpression(propertyToken["Expression"], serializer); + properties.Add(new ClientQLObjectProperty(name, expression)); } } - return properties; } private List DeserializeGroupByKeys(JToken token) { List groupByKeys = new List(); - if (token != null && token.Type == JTokenType.Array) { foreach (JToken keyToken in token) { - ClientQLGroupByKey groupByKey = new ClientQLGroupByKey - { - Type = this.DeserializeType(keyToken["Type"]) - }; - groupByKeys.Add(groupByKey); + ClientQLType type = this.DeserializeType(keyToken["Type"]); + groupByKeys.Add(new ClientQLGroupByKey(type)); } } - return groupByKeys; } private List DeserializeAggregates(JToken token) { List aggregates = new List(); - if (token != null && token.Type == JTokenType.Array) { foreach (JToken aggregateToken in token) { - ClientQLAggregate aggregate = new ClientQLAggregate - { - Kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), aggregateToken.Value("Kind")), - OperatorKind = aggregateToken.Value("OperatorKind") - }; - aggregates.Add(aggregate); + ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), aggregateToken.Value("Kind")); + string operatorKind = aggregateToken.Value("OperatorKind"); + aggregates.Add(new ClientQLAggregate(kind, operatorKind)); } } - return aggregates; } + + private List DeserializeOrderByItems(JToken token, JsonSerializer serializer) + { + List orderByItems = new List(); + if (token != null && token.Type == JTokenType.Array) + { + foreach (JToken itemToken in token) + { + ClientQLScalarExpression expression = this.DeserializeScalarExpression(itemToken["Expression"], serializer); + ClientQLSortOrder sortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), itemToken.Value("SortOrder")); + orderByItems.Add(new ClientQLOrderByItem(expression, sortOrder)); + } + } + return orderByItems; + } + + private List DeserializeScalarExpressionArray(JToken token, JsonSerializer serializer) + { + List properties = new List(); + if (token != null) + { + foreach (JToken propertyToken in token) + { + ClientQLScalarExpression expression = this.DeserializeScalarExpression(propertyToken, serializer); + properties.Add(expression); + } + } + return properties; + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml index c64edff5a7..b141c28ba6 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml @@ -78,15 +78,230 @@ "Expression": { "VecItems": [ { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 0, "Kind": 11 }, { + "ConditionExpression": { + "OperatorKind": 1, + "MaxDepth": 0, + "LeftExpression": { + "OperatorKind": 14, + "MaxDepth": 0, + "LeftExpression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 1, + "Kind": 11 + }, + "Index": 1, + "Kind": 11 + }, + "RightExpression": { + "Literal": { + "Kind": 5 + }, + "Kind": 4 + }, + "Kind": 2 + }, + "RightExpression": { + "OperatorKind": 2, + "Expression": { + "FunctionKind": 154, + "VecArguments": [], + "Kind": 9 + }, + "Kind": 12 + }, + "Kind": 2 + }, + "LeftExpression": { + "Literal": { + "Kind": 5 + }, + "Kind": 4 + }, + "RightExpression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 1, + "Kind": 11 + }, + "Index": 0, + "Kind": 11 + }, "Kind": 6 }, { + "VecItems": [ + { + "ConditionExpression": { + "OperatorKind": 1, + "MaxDepth": 0, + "LeftExpression": { + "OperatorKind": 14, + "MaxDepth": 0, + "LeftExpression": { + "Expression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 2, + "Kind": 11 + }, + "Index": 0, + "Kind": 11 + }, + "Index": 1, + "Kind": 11 + }, + "RightExpression": { + "Literal": { + "Kind": 5 + }, + "Kind": 4 + }, + "Kind": 2 + }, + "RightExpression": { + "OperatorKind": 2, + "Expression": { + "FunctionKind": 154, + "VecArguments": [], + "Kind": 9 + }, + "Kind": 12 + }, + "Kind": 2 + }, + "LeftExpression": { + "Literal": { + "Kind": 5 + }, + "Kind": 4 + }, + "RightExpression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 2, + "Kind": 11 + }, + "Index": 0, + "Kind": 11 + }, + "Kind": 6 + }, + { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 2, + "Kind": 11 + }, + "Index": 1, + "Kind": 11 + } + ], "Kind": 10 }, { + "ConditionExpression": { + "OperatorKind": 1, + "MaxDepth": 0, + "LeftExpression": { + "OperatorKind": 14, + "MaxDepth": 0, + "LeftExpression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 3, + "Kind": 11 + }, + "Index": 1, + "Kind": 11 + }, + "RightExpression": { + "Literal": { + "Kind": 5 + }, + "Kind": 4 + }, + "Kind": 2 + }, + "RightExpression": { + "OperatorKind": 2, + "Expression": { + "FunctionKind": 154, + "VecArguments": [], + "Kind": 9 + }, + "Kind": 12 + }, + "Kind": 2 + }, + "LeftExpression": { + "Literal": { + "Kind": 5 + }, + "Kind": 4 + }, + "RightExpression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 3, + "Kind": 11 + }, + "Index": 0, + "Kind": 11 + }, "Kind": 6 } ], @@ -161,7 +376,7 @@ "Literal": { "Kind": 5 }, - "Kind": 5 + "Kind": 4 }, "Kind": 2 }, @@ -169,7 +384,7 @@ "Literal": { "Kind": 5 }, - "Kind": 5 + "Kind": 4 }, "RightExpression": { "OperatorKind": 5, @@ -301,7 +516,7 @@ "Literal": { "Kind": 5 }, - "Kind": 5 + "Kind": 4 }, "Kind": 2 } From c5d2109f572c3bd05f533ce5fa839799d3cf8796 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 21 Aug 2023 15:09:54 -0700 Subject: [PATCH 07/36] Added error and null checks for Value calls --- ...CoordinatorDistributionPlanDeserializer.cs | 71 ++++++++++++------- 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index c4f5b30375..0c6714eb81 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -6,6 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan { using System; using System.Collections.Generic; + using System.Reflection; using ClientQL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -24,7 +25,7 @@ public CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string public ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, JsonSerializer serializer) { - string kind = token.Value("Kind"); + string kind = TryGetValue(token, "Kind"); switch (kind) { @@ -90,7 +91,7 @@ public ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpressio public ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(JToken token, JsonSerializer serializer) { - return new ClientQLInputEnumerableExpression(token.Value("Name")); + return new ClientQLInputEnumerableExpression(TryGetValue(token, "Name")); } public ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(JToken token, JsonSerializer serializer) @@ -105,7 +106,7 @@ public ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpressio public ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(JToken token, JsonSerializer serializer) { ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); - ClientQLEnumerationKind enumerationKind = (ClientQLEnumerationKind)Enum.Parse(typeof(ClientQLEnumerationKind), token.Value("EnumerationKind")); + ClientQLEnumerationKind enumerationKind = (ClientQLEnumerationKind)Enum.Parse(typeof(ClientQLEnumerationKind), TryGetValue(token, "EnumerationKind")); return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); } @@ -131,9 +132,9 @@ public ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpression(JT public ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(JToken token, JsonSerializer serializer) { ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - int skipValue = token.Value("SkipValue"); - int takeExpression = token.Value("TakeValue"); - + int skipValue = TryGetValue(token, "SkipValue"); + int takeExpression = TryGetValue(token, "TakeValue"); + return new ClientQLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); } @@ -147,7 +148,7 @@ public ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(JT public ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSerializer serializer) { - object scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), token.Value("Kind")); + object scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), TryGetValue(token, "Kind")); switch (scalarExpressionKind) { @@ -188,7 +189,7 @@ public ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSe public ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLArrayKind arrayKind = token.Value("ArrayKind"); + ClientQLArrayKind arrayKind = TryGetValue(token, "ArrayKind"); List vecItems = this.DeserializeScalarExpressionArray(token["VecItems"], serializer); return new ClientQLArrayCreateScalarExpression(arrayKind, vecItems); @@ -197,15 +198,15 @@ public ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpressio public ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(JToken token, JsonSerializer serializer) { ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); - int index = token.Value("Index"); + int index = TryGetValue(token, "Index"); return new ClientQLArrayIndexerScalarExpression(expression, index); } public ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLBinaryScalarOperatorKind operatorKind = (ClientQLBinaryScalarOperatorKind)Enum.Parse(typeof(ClientQLBinaryScalarOperatorKind), token.Value("OperatorKind")); - int maxDepth = token.Value("MaxDepth"); + ClientQLBinaryScalarOperatorKind operatorKind = (ClientQLBinaryScalarOperatorKind)Enum.Parse(typeof(ClientQLBinaryScalarOperatorKind), TryGetValue(token, "OperatorKind")); + int maxDepth = TryGetValue(token, "MaxDepth"); ClientQLScalarExpression leftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer); ClientQLScalarExpression rightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer); @@ -214,7 +215,7 @@ public ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression( public ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLIsOperatorKind operatorKind = (ClientQLIsOperatorKind)Enum.Parse(typeof(ClientQLIsOperatorKind), token.Value("OperatorKind")); + ClientQLIsOperatorKind operatorKind = (ClientQLIsOperatorKind)Enum.Parse(typeof(ClientQLIsOperatorKind), TryGetValue(token, "OperatorKind")); ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); return new ClientQLIsOperatorScalarExpression(operatorKind, expression); @@ -248,7 +249,7 @@ public ClientQLMuxScalarExpression DeserializeMuxScalarExpression(JToken token, public ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(JToken token, JsonSerializer serializer) { - string objectKindString = token.Value("ObjectKind"); + string objectKindString = TryGetValue(token, "ObjectKind"); if (!Enum.TryParse(objectKindString, out ClientQLObjectKind objectKind)) { throw new JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); @@ -262,14 +263,14 @@ public ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpress public ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(JToken token, JsonSerializer serializer) { ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); - string propertyName = token.Value("PropertyName"); + string propertyName = TryGetValue(token, "PropertyName"); return new ClientQLPropertyRefScalarExpression(expression, propertyName); } public ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLBuiltinScalarFunctionKind functionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), token.Value("FunctionKind")); + ClientQLBuiltinScalarFunctionKind functionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), TryGetValue(token, "FunctionKind")); List vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); return new ClientQLSystemFunctionCallScalarExpression(functionKind, vecArguments); @@ -285,14 +286,14 @@ public ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpressio public ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(JToken token, JsonSerializer serializer) { ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); - int index = token.Value("Index"); + int index = TryGetValue(token, "Index"); return new ClientQLTupleItemRefScalarExpression(expression, index); } public ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLUnaryScalarOperatorKind operatorKind = (ClientQLUnaryScalarOperatorKind)Enum.Parse(typeof(ClientQLUnaryScalarOperatorKind), token.Value("OperatorKind")); + ClientQLUnaryScalarOperatorKind operatorKind = (ClientQLUnaryScalarOperatorKind)Enum.Parse(typeof(ClientQLUnaryScalarOperatorKind), TryGetValue(token, "OperatorKind")); ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); return new ClientQLUnaryScalarExpression(operatorKind, expression); @@ -302,7 +303,7 @@ public ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFun { ClientQLFunctionIdentifier identifier = token["Identifier"].ToObject(serializer); List vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); - bool builtin = token.Value("Builtin"); + bool builtin = TryGetValue(token, "Builtin"); return new ClientQLUserDefinedFunctionCallScalarExpression(identifier, vecArguments, builtin); } @@ -316,7 +317,7 @@ public ClientQLVariableRefScalarExpression DeserializeVariableRefScalarExpressio public ClientQLDelegate DeserializeDelegateExpression(JToken token) { - ClientQLDelegateKind kind = (ClientQLDelegateKind)Enum.Parse(typeof(ClientQLDelegateKind), token.Value("Kind")); + ClientQLDelegateKind kind = (ClientQLDelegateKind)Enum.Parse(typeof(ClientQLDelegateKind), TryGetValue(token, "Kind")); ClientQLType type = this.DeserializeType(token["Type"]); return new ClientQLDelegate(kind, type); @@ -324,14 +325,14 @@ public ClientQLDelegate DeserializeDelegateExpression(JToken token) private ClientQLType DeserializeType(JToken token) { - ClientQLTypeKind kind = (ClientQLTypeKind)Enum.Parse(typeof(ClientQLTypeKind), token.Value("Kind")); + ClientQLTypeKind kind = (ClientQLTypeKind)Enum.Parse(typeof(ClientQLTypeKind), TryGetValue(token, "Kind")); return new ClientQLType(kind); } public ClientQLAggregate DeserializeAggregate(JToken token) { - ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), token.Value("Kind")); + ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), TryGetValue(token, "Kind")); string operatorKind = token["OperatorKind"].ToString(); return new ClientQLAggregate(kind, operatorKind); @@ -339,8 +340,8 @@ public ClientQLAggregate DeserializeAggregate(JToken token) public ClientQLVariable DeserializeClientQLVariable(JToken token) { - string name = token.Value("Name"); - int uniqueId = token.Value("UniqueId"); + string name = TryGetValue(token, "Name"); + int uniqueId = TryGetValue(token, "UniqueId"); return new ClientQLVariable(name, uniqueId); } @@ -352,7 +353,7 @@ public List DeserializeObjectProperties(JToken token, Js { foreach (JToken propertyToken in token) { - string name = propertyToken.Value("Name"); + string name = TryGetValue(propertyToken, "Name"); ClientQLScalarExpression expression = this.DeserializeScalarExpression(propertyToken["Expression"], serializer); properties.Add(new ClientQLObjectProperty(name, expression)); } @@ -381,8 +382,8 @@ private List DeserializeAggregates(JToken token) { foreach (JToken aggregateToken in token) { - ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), aggregateToken.Value("Kind")); - string operatorKind = aggregateToken.Value("OperatorKind"); + ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), TryGetValue(aggregateToken, "Kind")); + string operatorKind = TryGetValue(aggregateToken, "OperatorKind"); aggregates.Add(new ClientQLAggregate(kind, operatorKind)); } } @@ -397,7 +398,7 @@ private List DeserializeOrderByItems(JToken token, JsonSeri foreach (JToken itemToken in token) { ClientQLScalarExpression expression = this.DeserializeScalarExpression(itemToken["Expression"], serializer); - ClientQLSortOrder sortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), itemToken.Value("SortOrder")); + ClientQLSortOrder sortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), TryGetValue(itemToken, "SortOrder")); orderByItems.Add(new ClientQLOrderByItem(expression, sortOrder)); } } @@ -417,5 +418,21 @@ private List DeserializeScalarExpressionArray(JToken t } return properties; } + + private static T TryGetValue(JToken token, string expression) + { + try + { + return token.Value(expression); + } + catch (Exception ex) + { + Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; + string clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; + throw new ArgumentNullException($"Customer SDK version is {clientSDKVersion}. Please upgrade if need be. " + + $"Error occured during deserialization of distribution plan. Please reach out to the CosmosDB query team to fix this. " + + $"Error Message: {ex.InnerException}"); + } + } } } \ No newline at end of file From 4efdc24a6dcd6c51fa346756635a7f1899908d35 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 21 Aug 2023 15:22:54 -0700 Subject: [PATCH 08/36] Updated List<> with IReadOnlyList<> --- .../ClientQLArrayCreateScalarExpression.cs | 4 ++-- .../ClientQL/ClientQLArrayLiteral.cs | 4 ++-- .../ClientQL/ClientQLBinaryLiteral.cs | 4 ++-- .../ClientQLDistinctEnumerableExpression.cs | 4 ++-- .../ClientQLGroupByEnumerableExpression.cs | 6 +++--- .../ClientQLObjectCreateScalarExpression.cs | 4 ++-- .../ClientQL/ClientQLObjectLiteral.cs | 4 ++-- .../ClientQLOrderByEnumerableExpression.cs | 4 ++-- ...ientQLSystemFunctionCallScalarExpression.cs | 4 ++-- .../ClientQL/ClientQLTupleAggregate.cs | 4 ++-- .../ClientQLTupleCreateScalarExpression.cs | 4 ++-- .../ClientQL/ClientQLTupleType.cs | 4 ++-- ...LUserDefinedFunctionCallScalarExpression.cs | 4 ++-- .../CoordinatorDistributionPlanDeserializer.cs | 18 +++++++++--------- 14 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs index 40d2ce097c..9c4f630a3f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs @@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLArrayCreateScalarExpression : ClientQLScalarExpression { - public ClientQLArrayCreateScalarExpression(ClientQLArrayKind arrayKind, List vecItems) + public ClientQLArrayCreateScalarExpression(ClientQLArrayKind arrayKind, IReadOnlyList vecItems) : base(ClientQLScalarExpressionKind.ArrayCreate) { this.ArrayKind = arrayKind; @@ -17,7 +17,7 @@ public ClientQLArrayCreateScalarExpression(ClientQLArrayKind arrayKind, List VecItems { get; } + public IReadOnlyList VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs index 64ace0a45e..912e9e8bdc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs @@ -8,12 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLArrayLiteral : ClientQLLiteral { - public ClientQLArrayLiteral(List vecItems) + public ClientQLArrayLiteral(IReadOnlyList vecItems) : base(ClientQLLiteralKind.Array) { this.VecItems = vecItems; } - public List VecItems { get; } + public IReadOnlyList VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs index 13105e58c3..d11fb75fcf 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs @@ -9,12 +9,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLBinaryLiteral : ClientQLLiteral { - public ClientQLBinaryLiteral(List value) + public ClientQLBinaryLiteral(IReadOnlyList value) : base(ClientQLLiteralKind.Binary) { this.Value = value; } - public List Value { get; } + public IReadOnlyList Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs index 42300ca329..fc99a96b0c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs @@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLDistinctEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLDistinctEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, List vecExpression) + public ClientQLDistinctEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, IReadOnlyList vecExpression) : base(ClientQLEnumerableExpressionKind.Distinct) { this.SourceExpression = sourceExpression; @@ -20,7 +20,7 @@ public ClientQLDistinctEnumerableExpression(ClientQLEnumerableExpression sourceE public ClientQLVariable DeclaredVariable { get; } - public List VecExpression { get; } + public IReadOnlyList VecExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs index eef08f232f..4c411d18ea 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs @@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLGroupByEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, List vecKeys, List vecAggregates) + public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, IReadOnlyList vecKeys, IReadOnlyList vecAggregates) : base(ClientQLEnumerableExpressionKind.GroupBy) { this.SourceExpression = sourceExpression; @@ -18,9 +18,9 @@ public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceEx public ClientQLEnumerableExpression SourceExpression { get; } - public List VecKeys { get; } + public IReadOnlyList VecKeys { get; } - public List VecAggregates { get; } + public IReadOnlyList VecAggregates { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs index c14073fb7d..12c01b160a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs @@ -8,14 +8,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLObjectCreateScalarExpression : ClientQLScalarExpression { - public ClientQLObjectCreateScalarExpression(List properties, ClientQLObjectKind objectKind) + public ClientQLObjectCreateScalarExpression(IReadOnlyList properties, ClientQLObjectKind objectKind) : base(ClientQLScalarExpressionKind.ObjectCreate) { this.Properties = properties; this.ObjectKind = objectKind; } - public List Properties { get; } + public IReadOnlyList Properties { get; } public ClientQLObjectKind ObjectKind { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs index fe5ed3199b..2f08630b2e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs @@ -8,12 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLObjectLiteral : ClientQLLiteral { - public ClientQLObjectLiteral(List vecProperties) + public ClientQLObjectLiteral(IReadOnlyList vecProperties) : base(ClientQLLiteralKind.Object) { this.VecProperties = vecProperties; } - public List VecProperties { get; } + public IReadOnlyList VecProperties { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs index 6c2a641143..9f980b4b62 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs @@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLOrderByEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLOrderByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, List vecItems) + public ClientQLOrderByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, IReadOnlyList vecItems) : base(ClientQLEnumerableExpressionKind.OrderBy) { this.SourceExpression = sourceExpression; @@ -20,7 +20,7 @@ public ClientQLOrderByEnumerableExpression(ClientQLEnumerableExpression sourceEx public ClientQLVariable DeclaredVariable { get; } - public List VecItems { get; } + public IReadOnlyList VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs index 7e9fd13906..9bb4d493f8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs @@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLSystemFunctionCallScalarExpression : ClientQLScalarExpression { - public ClientQLSystemFunctionCallScalarExpression(ClientQLBuiltinScalarFunctionKind functionKind, List vecArguments) + public ClientQLSystemFunctionCallScalarExpression(ClientQLBuiltinScalarFunctionKind functionKind, IReadOnlyList vecArguments) : base(ClientQLScalarExpressionKind.SystemFunctionCall) { this.FunctionKind = functionKind; @@ -17,7 +17,7 @@ public ClientQLSystemFunctionCallScalarExpression(ClientQLBuiltinScalarFunctionK public ClientQLBuiltinScalarFunctionKind FunctionKind { get; } - public List VecArguments { get; } + public IReadOnlyList VecArguments { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs index 3162b5425b..90da342203 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs @@ -8,12 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleAggregate : ClientQLAggregate { - public ClientQLTupleAggregate(string operatorKind, List vecItems) + public ClientQLTupleAggregate(string operatorKind, IReadOnlyList vecItems) : base(ClientQLAggregateKind.Tuple, operatorKind) { this.VecItems = vecItems; } - public List VecItems { get; } + public IReadOnlyList VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs index 590abf0c29..495c9011a1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs @@ -8,13 +8,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleCreateScalarExpression : ClientQLScalarExpression { - public ClientQLTupleCreateScalarExpression(List vecItems) + public ClientQLTupleCreateScalarExpression(IReadOnlyList vecItems) : base(ClientQLScalarExpressionKind.TupleCreate) { this.VecItems = vecItems; } - public List VecItems { get; } + public IReadOnlyList VecItems { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs index e78c761f24..f563685546 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs @@ -8,13 +8,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleType : ClientQLType { - public ClientQLTupleType(List vecTypes) + public ClientQLTupleType(IReadOnlyList vecTypes) : base(ClientQLTypeKind.Tuple) { this.VecTypes = vecTypes; } - public List VecTypes { get; } + public IReadOnlyList VecTypes { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs index 6100329ea4..9943740967 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs @@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLUserDefinedFunctionCallScalarExpression : ClientQLScalarExpression { - public ClientQLUserDefinedFunctionCallScalarExpression(ClientQLFunctionIdentifier identifier, List vecArguments, bool builtin) + public ClientQLUserDefinedFunctionCallScalarExpression(ClientQLFunctionIdentifier identifier, IReadOnlyList vecArguments, bool builtin) : base(ClientQLScalarExpressionKind.UserDefinedFunctionCall) { this.Identifier = identifier; @@ -18,7 +18,7 @@ public ClientQLUserDefinedFunctionCallScalarExpression(ClientQLFunctionIdentifie public ClientQLFunctionIdentifier Identifier { get; } - public List VecArguments { get; } + public IReadOnlyList VecArguments { get; } public bool Builtin { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 0c6714eb81..c4fc765951 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -68,7 +68,7 @@ public ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpress { ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); - List vecExpressions = this.DeserializeScalarExpressionArray(token["VecExpression"], serializer); + IReadOnlyList vecExpressions = this.DeserializeScalarExpressionArray(token["VecExpression"], serializer); return new ClientQLDistinctEnumerableExpression(sourceExpression, declaredVariable, vecExpressions); } @@ -76,8 +76,8 @@ public ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpress public ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, JsonSerializer serializer) { ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - List vecKeys = this.DeserializeGroupByKeys(token["VecKeys"]); - List vecAggregates = this.DeserializeAggregates(token["VecAggregates"]); + IReadOnlyList vecKeys = this.DeserializeGroupByKeys(token["VecKeys"]); + IReadOnlyList vecAggregates = this.DeserializeAggregates(token["VecAggregates"]); return new ClientQLGroupByEnumerableExpression(sourceExpression, vecKeys, vecAggregates); } @@ -98,7 +98,7 @@ public ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpressio { ClientQLEnumerableExpression source = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); - List orderByItems = this.DeserializeOrderByItems(token["VecItems"], serializer); + IReadOnlyList orderByItems = this.DeserializeOrderByItems(token["VecItems"], serializer); return new ClientQLOrderByEnumerableExpression(source, declaredVariable, orderByItems); } @@ -190,7 +190,7 @@ public ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSe public ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(JToken token, JsonSerializer serializer) { ClientQLArrayKind arrayKind = TryGetValue(token, "ArrayKind"); - List vecItems = this.DeserializeScalarExpressionArray(token["VecItems"], serializer); + IReadOnlyList vecItems = this.DeserializeScalarExpressionArray(token["VecItems"], serializer); return new ClientQLArrayCreateScalarExpression(arrayKind, vecItems); } @@ -255,7 +255,7 @@ public ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpress throw new JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); } - List properties = this.DeserializeObjectProperties(token["Properties"], serializer); + IReadOnlyList properties = this.DeserializeObjectProperties(token["Properties"], serializer); return new ClientQLObjectCreateScalarExpression(properties, objectKind); } @@ -271,14 +271,14 @@ public ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpressio public ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { ClientQLBuiltinScalarFunctionKind functionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), TryGetValue(token, "FunctionKind")); - List vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); + IReadOnlyList vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); return new ClientQLSystemFunctionCallScalarExpression(functionKind, vecArguments); } public ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(JToken token, JsonSerializer serializer) { - List vecItems = this.DeserializeScalarExpressionArray(token["Items"], serializer); + IReadOnlyList vecItems = this.DeserializeScalarExpressionArray(token["Items"], serializer); return new ClientQLTupleCreateScalarExpression(vecItems); } @@ -302,7 +302,7 @@ public ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JToken tok public ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { ClientQLFunctionIdentifier identifier = token["Identifier"].ToObject(serializer); - List vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); + IReadOnlyList vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); bool builtin = TryGetValue(token, "Builtin"); return new ClientQLUserDefinedFunctionCallScalarExpression(identifier, vecArguments, builtin); From 5e5cdc00925e34af911169b53d2965fe76b914b3 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 21 Aug 2023 15:48:42 -0700 Subject: [PATCH 09/36] Made most functions in the Deserializing class private and static --- ...CoordinatorDistributionPlanDeserializer.cs | 226 +++++++++--------- ...oordinatorDistributionPlanBaselineTests.cs | 17 +- 2 files changed, 114 insertions(+), 129 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index c4fc765951..73e6e3f6d5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -11,226 +11,226 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan using Newtonsoft.Json; using Newtonsoft.Json.Linq; - internal class CoordinatorDistributionPlanDeserializer + internal static class CoordinatorDistributionPlanDeserializer { - public CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string jsonString) + public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string jsonString) { JObject token = JObject.Parse(jsonString); JsonSerializer serializer = new JsonSerializer(); - ClientQLExpression clientQL = this.DeserializeClientQLEnumerableExpression(token["coordinatorDistributionPlan"]["clientQL"], serializer); + ClientQLExpression clientQL = DeserializeClientQLEnumerableExpression(token["coordinatorDistributionPlan"]["clientQL"], serializer); return new CoordinatorDistributionPlan(clientQL); } - public ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, JsonSerializer serializer) { string kind = TryGetValue(token, "Kind"); switch (kind) { case "Aggregate": - return this.DeserializeAggregateEnumerableExpression(token, serializer); + return DeserializeAggregateEnumerableExpression(token, serializer); case "Distinct": - return this.DeserializeDistinctEnumerableExpression(token, serializer); + return DeserializeDistinctEnumerableExpression(token, serializer); case "GroupBy": - return this.DeserializeGroupByEnumerableExpression(token, serializer); + return DeserializeGroupByEnumerableExpression(token, serializer); case "Flatten": - return this.DeserializeFlattenEnumerableExpression(token, serializer); + return DeserializeFlattenEnumerableExpression(token, serializer); case "Input": - return this.DeserializeInputEnumerableExpression(token, serializer); + return DeserializeInputEnumerableExpression(token, serializer); case "OrderBy": - return this.DeserializeOrderByEnumerableExpression(token, serializer); + return DeserializeOrderByEnumerableExpression(token, serializer); case "ScalarAsEnumerable": - return this.DeserializeScalarAsEnumerableExpression(token, serializer); + return DeserializeScalarAsEnumerableExpression(token, serializer); case "Select": - return this.DeserializeSelectEnumerableExpression(token, serializer); + return DeserializeSelectEnumerableExpression(token, serializer); case "SelectMany": - return this.DeserializeSelectManyExpression(token, serializer); + return DeserializeSelectManyExpression(token, serializer); case "Take": - return this.DeserializeTakeEnumerableExpression(token, serializer); + return DeserializeTakeEnumerableExpression(token, serializer); case "Where": - return this.DeserializeWhereEnumerableExpression(token, serializer); + return DeserializeWhereEnumerableExpression(token, serializer); default: throw new JsonException($"Invalid ClientQLExpression kind: {kind}"); } } - public ClientQLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLAggregate aggregate = this.DeserializeAggregate(token["Aggregate"]); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLAggregate aggregate = DeserializeAggregate(token["Aggregate"]); return new ClientQLAggregateEnumerableExpression(sourceExpression, aggregate); } - public ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); - IReadOnlyList vecExpressions = this.DeserializeScalarExpressionArray(token["VecExpression"], serializer); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); + IReadOnlyList vecExpressions = DeserializeScalarExpressionArray(token["VecExpression"], serializer); return new ClientQLDistinctEnumerableExpression(sourceExpression, declaredVariable, vecExpressions); } - public ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - IReadOnlyList vecKeys = this.DeserializeGroupByKeys(token["VecKeys"]); - IReadOnlyList vecAggregates = this.DeserializeAggregates(token["VecAggregates"]); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + IReadOnlyList vecKeys = DeserializeGroupByKeys(token["VecKeys"]); + IReadOnlyList vecAggregates = DeserializeAggregates(token["VecAggregates"]); return new ClientQLGroupByEnumerableExpression(sourceExpression, vecKeys, vecAggregates); } - public ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); return new ClientQLFlattenEnumerableExpression(sourceExpression); } - public ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(JToken token, JsonSerializer serializer) { return new ClientQLInputEnumerableExpression(TryGetValue(token, "Name")); } - public ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression source = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); - IReadOnlyList orderByItems = this.DeserializeOrderByItems(token["VecItems"], serializer); + ClientQLEnumerableExpression source = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); + IReadOnlyList orderByItems = DeserializeOrderByItems(token["VecItems"], serializer); return new ClientQLOrderByEnumerableExpression(source, declaredVariable, orderByItems); } - public ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); ClientQLEnumerationKind enumerationKind = (ClientQLEnumerationKind)Enum.Parse(typeof(ClientQLEnumerationKind), TryGetValue(token, "EnumerationKind")); return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); } - public ClientQLSelectEnumerableExpression DeserializeSelectEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLSelectEnumerableExpression DeserializeSelectEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); - ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); + ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); return new ClientQLSelectEnumerableExpression(sourceExpression, declaredVariable, expression); } - public ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpression(JToken token, JsonSerializer serializer) + private static ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); - ClientQLEnumerableExpression selectorExpression = this.DeserializeClientQLEnumerableExpression(token["SelectorExpression"], serializer); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); + ClientQLEnumerableExpression selectorExpression = DeserializeClientQLEnumerableExpression(token["SelectorExpression"], serializer); return new ClientQLSelectManyEnumerableExpression(sourceExpression, declaredVariable, selectorExpression); } - public ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); int skipValue = TryGetValue(token, "SkipValue"); int takeExpression = TryGetValue(token, "TakeValue"); return new ClientQLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); } - public ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = this.DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLDelegate clientDelegate = this.DeserializeDelegateExpression(token["Delegate"]); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLDelegate clientDelegate = DeserializeDelegateExpression(token["Delegate"]); return new ClientQLWhereEnumerableExpression(sourceExpression, clientDelegate); } - public ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSerializer serializer) { object scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), TryGetValue(token, "Kind")); switch (scalarExpressionKind) { case ClientQLScalarExpressionKind.ArrayCreate: - return this.DeserializeArrayCreateScalarExpression(token, serializer); + return DeserializeArrayCreateScalarExpression(token, serializer); case ClientQLScalarExpressionKind.ArrayIndexer: - return this.DeserializeArrayIndexerScalarExpression(token, serializer); + return DeserializeArrayIndexerScalarExpression(token, serializer); case ClientQLScalarExpressionKind.BinaryOperator: - return this.DeserializeBinaryOperatorScalarExpression(token, serializer); + return DeserializeBinaryOperatorScalarExpression(token, serializer); case ClientQLScalarExpressionKind.IsOperator: - return this.DeserializeIsOperatorScalarExpression(token, serializer); + return DeserializeIsOperatorScalarExpression(token, serializer); case ClientQLScalarExpressionKind.Let: - return this.DeserializeLetScalarExpression(token, serializer); + return DeserializeLetScalarExpression(token, serializer); case ClientQLScalarExpressionKind.Literal: - return this.DeserializeLiteralScalarExpression(token, serializer); + return DeserializeLiteralScalarExpression(token, serializer); case ClientQLScalarExpressionKind.Mux: - return this.DeserializeMuxScalarExpression(token, serializer); + return DeserializeMuxScalarExpression(token, serializer); case ClientQLScalarExpressionKind.ObjectCreate: - return this.DeserializeObjectCreateScalarExpression(token, serializer); + return DeserializeObjectCreateScalarExpression(token, serializer); case ClientQLScalarExpressionKind.PropertyRef: - return this.DeserializePropertyRefScalarExpression(token, serializer); + return DeserializePropertyRefScalarExpression(token, serializer); case ClientQLScalarExpressionKind.SystemFunctionCall: - return this.DeserializeSystemFunctionCallScalarExpression(token, serializer); + return DeserializeSystemFunctionCallScalarExpression(token, serializer); case ClientQLScalarExpressionKind.TupleCreate: - return this.DeserializeTupleCreateScalarExpression(token, serializer); + return DeserializeTupleCreateScalarExpression(token, serializer); case ClientQLScalarExpressionKind.TupleItemRef: - return this.DeserializeTupleItemRefScalarExpression(token, serializer); + return DeserializeTupleItemRefScalarExpression(token, serializer); case ClientQLScalarExpressionKind.UnaryOperator: - return this.DeserializeUnaryScalarExpression(token, serializer); + return DeserializeUnaryScalarExpression(token, serializer); case ClientQLScalarExpressionKind.UserDefinedFunctionCall: - return this.DeserializeUserDefinedFunctionCallScalarExpression(token, serializer); + return DeserializeUserDefinedFunctionCallScalarExpression(token, serializer); case ClientQLScalarExpressionKind.VariableRef: - return this.DeserializeVariableRefScalarExpression(token, serializer); + return DeserializeVariableRefScalarExpression(token, serializer); default: throw new JsonException($"Invalid ClientQLScalarExpressionKind: {scalarExpressionKind}"); } } - public ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(JToken token, JsonSerializer serializer) { ClientQLArrayKind arrayKind = TryGetValue(token, "ArrayKind"); - IReadOnlyList vecItems = this.DeserializeScalarExpressionArray(token["VecItems"], serializer); + IReadOnlyList vecItems = DeserializeScalarExpressionArray(token["VecItems"], serializer); return new ClientQLArrayCreateScalarExpression(arrayKind, vecItems); } - public ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); int index = TryGetValue(token, "Index"); return new ClientQLArrayIndexerScalarExpression(expression, index); } - public ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(JToken token, JsonSerializer serializer) { ClientQLBinaryScalarOperatorKind operatorKind = (ClientQLBinaryScalarOperatorKind)Enum.Parse(typeof(ClientQLBinaryScalarOperatorKind), TryGetValue(token, "OperatorKind")); int maxDepth = TryGetValue(token, "MaxDepth"); - ClientQLScalarExpression leftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer); - ClientQLScalarExpression rightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer); + ClientQLScalarExpression leftExpression = DeserializeScalarExpression(token["LeftExpression"], serializer); + ClientQLScalarExpression rightExpression = DeserializeScalarExpression(token["RightExpression"], serializer); return new ClientQLBinaryScalarExpression(operatorKind, maxDepth, leftExpression, rightExpression); } - public ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(JToken token, JsonSerializer serializer) { ClientQLIsOperatorKind operatorKind = (ClientQLIsOperatorKind)Enum.Parse(typeof(ClientQLIsOperatorKind), TryGetValue(token, "OperatorKind")); - ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); return new ClientQLIsOperatorScalarExpression(operatorKind, expression); } - public ClientQLLetScalarExpression DeserializeLetScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLLetScalarExpression DeserializeLetScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLVariable declaredVariable = this.DeserializeClientQLVariable(token["DeclaredVariable"]); - ClientQLScalarExpression declaredVariableExpression = this.DeserializeScalarExpression(token["DeclaredVariableExpression"], serializer); - ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); + ClientQLScalarExpression declaredVariableExpression = DeserializeScalarExpression(token["DeclaredVariableExpression"], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); return new ClientQLLetScalarExpression(declaredVariable, declaredVariableExpression, expression); } - public ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(JToken token, JsonSerializer serializer) { ClientQLLiteral literal = new ClientQLLiteral((ClientQLLiteralKind)ClientQLScalarExpressionKind.Literal); @@ -238,16 +238,16 @@ public ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(JToken } - public ClientQLMuxScalarExpression DeserializeMuxScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLMuxScalarExpression DeserializeMuxScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression conditionExpression = this.DeserializeScalarExpression(token["ConditionExpression"], serializer); - ClientQLScalarExpression leftExpression = this.DeserializeScalarExpression(token["LeftExpression"], serializer); - ClientQLScalarExpression rightExpression = this.DeserializeScalarExpression(token["RightExpression"], serializer); + ClientQLScalarExpression conditionExpression = DeserializeScalarExpression(token["ConditionExpression"], serializer); + ClientQLScalarExpression leftExpression = DeserializeScalarExpression(token["LeftExpression"], serializer); + ClientQLScalarExpression rightExpression = DeserializeScalarExpression(token["RightExpression"], serializer); return new ClientQLMuxScalarExpression(conditionExpression, leftExpression, rightExpression); } - public ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(JToken token, JsonSerializer serializer) { string objectKindString = TryGetValue(token, "ObjectKind"); if (!Enum.TryParse(objectKindString, out ClientQLObjectKind objectKind)) @@ -255,82 +255,82 @@ public ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpress throw new JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); } - IReadOnlyList properties = this.DeserializeObjectProperties(token["Properties"], serializer); + IReadOnlyList properties = DeserializeObjectProperties(token["Properties"], serializer); return new ClientQLObjectCreateScalarExpression(properties, objectKind); } - public ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); string propertyName = TryGetValue(token, "PropertyName"); return new ClientQLPropertyRefScalarExpression(expression, propertyName); } - public ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { ClientQLBuiltinScalarFunctionKind functionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), TryGetValue(token, "FunctionKind")); - IReadOnlyList vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); + IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token["VecArguments"], serializer); return new ClientQLSystemFunctionCallScalarExpression(functionKind, vecArguments); } - public ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(JToken token, JsonSerializer serializer) { - IReadOnlyList vecItems = this.DeserializeScalarExpressionArray(token["Items"], serializer); + IReadOnlyList vecItems = DeserializeScalarExpressionArray(token["Items"], serializer); return new ClientQLTupleCreateScalarExpression(vecItems); } - public ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); int index = TryGetValue(token, "Index"); return new ClientQLTupleItemRefScalarExpression(expression, index); } - public ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JToken token, JsonSerializer serializer) { ClientQLUnaryScalarOperatorKind operatorKind = (ClientQLUnaryScalarOperatorKind)Enum.Parse(typeof(ClientQLUnaryScalarOperatorKind), TryGetValue(token, "OperatorKind")); - ClientQLScalarExpression expression = this.DeserializeScalarExpression(token["Expression"], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); return new ClientQLUnaryScalarExpression(operatorKind, expression); } - public ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { ClientQLFunctionIdentifier identifier = token["Identifier"].ToObject(serializer); - IReadOnlyList vecArguments = this.DeserializeScalarExpressionArray(token["VecArguments"], serializer); + IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token["VecArguments"], serializer); bool builtin = TryGetValue(token, "Builtin"); return new ClientQLUserDefinedFunctionCallScalarExpression(identifier, vecArguments, builtin); } - public ClientQLVariableRefScalarExpression DeserializeVariableRefScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLVariable variable = this.DeserializeClientQLVariable(token["Variable"]); + ClientQLVariable variable = DeserializeClientQLVariable(token["Variable"]); return new ClientQLVariableRefScalarExpression(variable); } - public ClientQLDelegate DeserializeDelegateExpression(JToken token) + private static ClientQLDelegate DeserializeDelegateExpression(JToken token) { ClientQLDelegateKind kind = (ClientQLDelegateKind)Enum.Parse(typeof(ClientQLDelegateKind), TryGetValue(token, "Kind")); - ClientQLType type = this.DeserializeType(token["Type"]); + ClientQLType type = DeserializeType(token["Type"]); return new ClientQLDelegate(kind, type); } - private ClientQLType DeserializeType(JToken token) + private static ClientQLType DeserializeType(JToken token) { ClientQLTypeKind kind = (ClientQLTypeKind)Enum.Parse(typeof(ClientQLTypeKind), TryGetValue(token, "Kind")); return new ClientQLType(kind); } - public ClientQLAggregate DeserializeAggregate(JToken token) + private static ClientQLAggregate DeserializeAggregate(JToken token) { ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), TryGetValue(token, "Kind")); string operatorKind = token["OperatorKind"].ToString(); @@ -338,7 +338,7 @@ public ClientQLAggregate DeserializeAggregate(JToken token) return new ClientQLAggregate(kind, operatorKind); } - public ClientQLVariable DeserializeClientQLVariable(JToken token) + private static ClientQLVariable DeserializeClientQLVariable(JToken token) { string name = TryGetValue(token, "Name"); int uniqueId = TryGetValue(token, "UniqueId"); @@ -346,7 +346,7 @@ public ClientQLVariable DeserializeClientQLVariable(JToken token) return new ClientQLVariable(name, uniqueId); } - public List DeserializeObjectProperties(JToken token, JsonSerializer serializer) + private static List DeserializeObjectProperties(JToken token, JsonSerializer serializer) { List properties = new List(); if (token != null && token.Type == JTokenType.Array) @@ -354,28 +354,28 @@ public List DeserializeObjectProperties(JToken token, Js foreach (JToken propertyToken in token) { string name = TryGetValue(propertyToken, "Name"); - ClientQLScalarExpression expression = this.DeserializeScalarExpression(propertyToken["Expression"], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(propertyToken["Expression"], serializer); properties.Add(new ClientQLObjectProperty(name, expression)); } } return properties; } - private List DeserializeGroupByKeys(JToken token) + private static List DeserializeGroupByKeys(JToken token) { List groupByKeys = new List(); if (token != null && token.Type == JTokenType.Array) { foreach (JToken keyToken in token) { - ClientQLType type = this.DeserializeType(keyToken["Type"]); + ClientQLType type = DeserializeType(keyToken["Type"]); groupByKeys.Add(new ClientQLGroupByKey(type)); } } return groupByKeys; } - private List DeserializeAggregates(JToken token) + private static List DeserializeAggregates(JToken token) { List aggregates = new List(); if (token != null && token.Type == JTokenType.Array) @@ -390,14 +390,14 @@ private List DeserializeAggregates(JToken token) return aggregates; } - private List DeserializeOrderByItems(JToken token, JsonSerializer serializer) + private static List DeserializeOrderByItems(JToken token, JsonSerializer serializer) { List orderByItems = new List(); if (token != null && token.Type == JTokenType.Array) { foreach (JToken itemToken in token) { - ClientQLScalarExpression expression = this.DeserializeScalarExpression(itemToken["Expression"], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(itemToken["Expression"], serializer); ClientQLSortOrder sortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), TryGetValue(itemToken, "SortOrder")); orderByItems.Add(new ClientQLOrderByItem(expression, sortOrder)); } @@ -405,14 +405,14 @@ private List DeserializeOrderByItems(JToken token, JsonSeri return orderByItems; } - private List DeserializeScalarExpressionArray(JToken token, JsonSerializer serializer) + private static List DeserializeScalarExpressionArray(JToken token, JsonSerializer serializer) { List properties = new List(); if (token != null) { foreach (JToken propertyToken in token) { - ClientQLScalarExpression expression = this.DeserializeScalarExpression(propertyToken, serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(propertyToken, serializer); properties.Add(expression); } } @@ -430,7 +430,7 @@ private static T TryGetValue(JToken token, string expression) Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; string clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; throw new ArgumentNullException($"Customer SDK version is {clientSDKVersion}. Please upgrade if need be. " + - $"Error occured during deserialization of distribution plan. Please reach out to the CosmosDB query team to fix this. " + + $"Error occured during deserialization of distribution plan. Please reach out to the CosmosDB query team to fix " + $"Error Message: {ex.InnerException}"); } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs index a550a4e415..c23340ce44 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs @@ -1,23 +1,10 @@ namespace Microsoft.Azure.Cosmos.Tests.Query { - using System; using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Threading; - using System.Threading.Tasks; using System.Xml; - using Microsoft.Azure.Cosmos.Query.Core; using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan; using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL; - using Microsoft.Azure.Cosmos.Query.Core.Monads; - using Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination; - using Microsoft.Azure.Cosmos.Query.Core.QueryClient; - using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; using Microsoft.Azure.Cosmos.Test.BaselineTest; - using Microsoft.Azure.Cosmos.Tracing; - using Microsoft.Azure.Documents; - using Microsoft.Azure.Documents.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -61,14 +48,12 @@ private static CoordinatorDistributionPlanTestInput CreateInput( public override CoordinatorDistributionPlanTestOutput ExecuteTest(CoordinatorDistributionPlanTestInput input) { - - CoordinatorDistributionPlanDeserializer deserializer = new CoordinatorDistributionPlanDeserializer(); JsonSerializerSettings settings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented }; - CoordinatorDistributionPlan distributionPlan = deserializer.DeserializeCoordinatorDistributionPlan(input.CoordinatorPlanJson); + CoordinatorDistributionPlan distributionPlan = CoordinatorDistributionPlanDeserializer.DeserializeCoordinatorDistributionPlan(input.CoordinatorPlanJson); string serializedDistributionPlan = JsonConvert.SerializeObject(distributionPlan, settings); return new CoordinatorDistributionPlanTestOutput(serializedDistributionPlan); From 894f8ea429c282fc595502cb0a344b09e273b622 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 21 Aug 2023 16:06:58 -0700 Subject: [PATCH 10/36] Added static constant class for Enumerable expressions --- ...CoordinatorDistributionPlanDeserializer.cs | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 73e6e3f6d5..2686d2714e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -13,6 +13,21 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan internal static class CoordinatorDistributionPlanDeserializer { + private static class EnumerableConstants + { + public const string Aggregate = "Aggregate"; + public const string Distinct = "Distinct"; + public const string GroupBy = "GroupBy"; + public const string Flatten = "Flatten"; + public const string Input = "Input"; + public const string OrderBy = "OrderBy"; + public const string ScalarAsEnumerable = "ScalarAsEnumerable"; + public const string Select = "Select"; + public const string SelectMany = "SelectMany"; + public const string Take = "Take"; + public const string Where = "Where"; + } + public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string jsonString) { JObject token = JObject.Parse(jsonString); @@ -29,27 +44,27 @@ private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpress switch (kind) { - case "Aggregate": + case EnumerableConstants.Aggregate: return DeserializeAggregateEnumerableExpression(token, serializer); - case "Distinct": + case EnumerableConstants.Distinct: return DeserializeDistinctEnumerableExpression(token, serializer); - case "GroupBy": + case EnumerableConstants.GroupBy: return DeserializeGroupByEnumerableExpression(token, serializer); - case "Flatten": + case EnumerableConstants.Flatten: return DeserializeFlattenEnumerableExpression(token, serializer); - case "Input": + case EnumerableConstants.Input: return DeserializeInputEnumerableExpression(token, serializer); - case "OrderBy": + case EnumerableConstants.OrderBy: return DeserializeOrderByEnumerableExpression(token, serializer); - case "ScalarAsEnumerable": + case EnumerableConstants.ScalarAsEnumerable: return DeserializeScalarAsEnumerableExpression(token, serializer); - case "Select": + case EnumerableConstants.Select: return DeserializeSelectEnumerableExpression(token, serializer); - case "SelectMany": + case EnumerableConstants.SelectMany: return DeserializeSelectManyExpression(token, serializer); - case "Take": + case EnumerableConstants.Take: return DeserializeTakeEnumerableExpression(token, serializer); - case "Where": + case EnumerableConstants.Where: return DeserializeWhereEnumerableExpression(token, serializer); default: throw new JsonException($"Invalid ClientQLExpression kind: {kind}"); From 19661618c09e657088e397023538dfaa8deb6d19 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 22 Aug 2023 13:34:20 -0700 Subject: [PATCH 11/36] Added null checking for arrays --- ...CoordinatorDistributionPlanDeserializer.cs | 51 ++++++++++++++----- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 2686d2714e..2060b62ed6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -270,6 +270,7 @@ private static ClientQLObjectCreateScalarExpression DeserializeObjectCreateScala throw new JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); } + ValidateArrayProperty(token, "Properties"); IReadOnlyList properties = DeserializeObjectProperties(token["Properties"], serializer); return new ClientQLObjectCreateScalarExpression(properties, objectKind); @@ -317,6 +318,8 @@ private static ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JT private static ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { ClientQLFunctionIdentifier identifier = token["Identifier"].ToObject(serializer); + + ValidateArrayProperty(token, "VecArguments"); IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token["VecArguments"], serializer); bool builtin = TryGetValue(token, "Builtin"); @@ -364,15 +367,13 @@ private static ClientQLVariable DeserializeClientQLVariable(JToken token) private static List DeserializeObjectProperties(JToken token, JsonSerializer serializer) { List properties = new List(); - if (token != null && token.Type == JTokenType.Array) + foreach (JToken propertyToken in token) { - foreach (JToken propertyToken in token) - { - string name = TryGetValue(propertyToken, "Name"); - ClientQLScalarExpression expression = DeserializeScalarExpression(propertyToken["Expression"], serializer); - properties.Add(new ClientQLObjectProperty(name, expression)); - } + string name = TryGetValue(propertyToken, "Name"); + ClientQLScalarExpression expression = DeserializeScalarExpression(propertyToken["Expression"], serializer); + properties.Add(new ClientQLObjectProperty(name, expression)); } + return properties; } @@ -442,12 +443,38 @@ private static T TryGetValue(JToken token, string expression) } catch (Exception ex) { - Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; - string clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; - throw new ArgumentNullException($"Customer SDK version is {clientSDKVersion}. Please upgrade if need be. " + - $"Error occured during deserialization of distribution plan. Please reach out to the CosmosDB query team to fix " + - $"Error Message: {ex.InnerException}"); + string errorMessage = DeserializingExceptionMessage(); + errorMessage += ex.InnerException; + + throw new ArgumentNullException(errorMessage); + } + } + + private static void ValidateArrayProperty(JToken token, string property) + { + string errorMessage; + if (token[property] == null) + { + string nullErrorMessage = $"{property} could not be found in the deserialized plan."; + errorMessage = DeserializingExceptionMessage(); + throw new ArgumentException(errorMessage + nullErrorMessage); + } + else if (token[property] is not JArray) + { + string arrayErrorMessage = $"{property} is not of type array when it should be."; + errorMessage = DeserializingExceptionMessage(); + throw new ArgumentException(errorMessage + arrayErrorMessage); } } + + private static string DeserializingExceptionMessage() + { + Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; + string clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; + + return $"Customer SDK version is {clientSDKVersion}. Please upgrade if need be. " + + $"Error occured during deserialization of distribution plan. Please reach out to the CosmosDB query team to fix this. " + + $"Error Message: "; + } } } \ No newline at end of file From 65dd8399a097fd568fc54a5d24bd1a028765de4b Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 22 Aug 2023 14:35:52 -0700 Subject: [PATCH 12/36] Removed null checks from deserializing array functions --- ...CoordinatorDistributionPlanDeserializer.cs | 53 +++++++++++-------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 2060b62ed6..23cc4e9a6c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -90,9 +90,18 @@ private static ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerabl private static ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, JsonSerializer serializer) { + IReadOnlyList vecKeys = new ClientQLGroupByKey[] { }; + IReadOnlyList vecAggregates = new ClientQLAggregate[] { }; ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - IReadOnlyList vecKeys = DeserializeGroupByKeys(token["VecKeys"]); - IReadOnlyList vecAggregates = DeserializeAggregates(token["VecAggregates"]); + if (token["VecKeys"] != null && token["VecKeys"] is JArray) + { + vecKeys = DeserializeGroupByKeys(token["VecKeys"]); + } + + if (token["VecAggregates"] != null && token["VecAggregates"] is JArray) + { + vecAggregates = DeserializeAggregates(token["VecAggregates"]); + } return new ClientQLGroupByEnumerableExpression(sourceExpression, vecKeys, vecAggregates); } @@ -350,8 +359,12 @@ private static ClientQLType DeserializeType(JToken token) private static ClientQLAggregate DeserializeAggregate(JToken token) { + string operatorKind = null; ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), TryGetValue(token, "Kind")); - string operatorKind = token["OperatorKind"].ToString(); + if (token["OperatorKind"] != null) + { + operatorKind = token["OperatorKind"].ToString(); + } return new ClientQLAggregate(kind, operatorKind); } @@ -380,44 +393,38 @@ private static List DeserializeObjectProperties(JToken t private static List DeserializeGroupByKeys(JToken token) { List groupByKeys = new List(); - if (token != null && token.Type == JTokenType.Array) + foreach (JToken keyToken in token) { - foreach (JToken keyToken in token) - { - ClientQLType type = DeserializeType(keyToken["Type"]); - groupByKeys.Add(new ClientQLGroupByKey(type)); - } + ClientQLType type = DeserializeType(keyToken["Type"]); + groupByKeys.Add(new ClientQLGroupByKey(type)); } + return groupByKeys; } private static List DeserializeAggregates(JToken token) { List aggregates = new List(); - if (token != null && token.Type == JTokenType.Array) + foreach (JToken aggregateToken in token) { - foreach (JToken aggregateToken in token) - { - ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), TryGetValue(aggregateToken, "Kind")); - string operatorKind = TryGetValue(aggregateToken, "OperatorKind"); - aggregates.Add(new ClientQLAggregate(kind, operatorKind)); - } + ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), TryGetValue(aggregateToken, "Kind")); + string operatorKind = TryGetValue(aggregateToken, "OperatorKind"); + aggregates.Add(new ClientQLAggregate(kind, operatorKind)); } + return aggregates; } private static List DeserializeOrderByItems(JToken token, JsonSerializer serializer) { List orderByItems = new List(); - if (token != null && token.Type == JTokenType.Array) + foreach (JToken itemToken in token) { - foreach (JToken itemToken in token) - { - ClientQLScalarExpression expression = DeserializeScalarExpression(itemToken["Expression"], serializer); - ClientQLSortOrder sortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), TryGetValue(itemToken, "SortOrder")); - orderByItems.Add(new ClientQLOrderByItem(expression, sortOrder)); - } + ClientQLScalarExpression expression = DeserializeScalarExpression(itemToken["Expression"], serializer); + ClientQLSortOrder sortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), TryGetValue(itemToken, "SortOrder")); + orderByItems.Add(new ClientQLOrderByItem(expression, sortOrder)); } + return orderByItems; } From 545611d7070db46a9dd523e6ad23994d3989bcc1 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Wed, 23 Aug 2023 08:56:35 -0700 Subject: [PATCH 13/36] Removed support for JavaScript --- .../CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs index 6475a9c2a6..58c605788f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs @@ -6,7 +6,6 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal enum ClientQLDelegateKind { - JavaScript, ScalarExpression, } } \ No newline at end of file From 66e5bb3128b71b32b2159903517355723a39c62d Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Wed, 23 Aug 2023 11:09:57 -0700 Subject: [PATCH 14/36] Removed support for Unwind --- .../ClientQL/ClientQLEnumerableExpressionKind.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs index c789774767..6a46b1ed98 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs @@ -16,7 +16,6 @@ internal enum ClientQLEnumerableExpressionKind Select, SelectMany, Take, - Unwind, Where, } } \ No newline at end of file From deee17350b0e4841e0453a1bcdc186568708d31c Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Wed, 23 Aug 2023 15:15:00 -0700 Subject: [PATCH 15/36] Function names changed --- ...CoordinatorDistributionPlanDeserializer.cs | 103 ++++++++---------- ...ordinatorDistributionPlanDeserializing.xml | 4 +- 2 files changed, 50 insertions(+), 57 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 23cc4e9a6c..10faf3c4bc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -7,13 +7,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan using System; using System.Collections.Generic; using System.Reflection; + using System.Runtime.CompilerServices; using ClientQL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; internal static class CoordinatorDistributionPlanDeserializer { - private static class EnumerableConstants + private static class Constants { public const string Aggregate = "Aggregate"; public const string Distinct = "Distinct"; @@ -40,31 +41,31 @@ public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, JsonSerializer serializer) { - string kind = TryGetValue(token, "Kind"); + string kind = GetValue(token, "Kind"); switch (kind) { - case EnumerableConstants.Aggregate: + case Constants.Aggregate: return DeserializeAggregateEnumerableExpression(token, serializer); - case EnumerableConstants.Distinct: + case Constants.Distinct: return DeserializeDistinctEnumerableExpression(token, serializer); - case EnumerableConstants.GroupBy: + case Constants.GroupBy: return DeserializeGroupByEnumerableExpression(token, serializer); - case EnumerableConstants.Flatten: + case Constants.Flatten: return DeserializeFlattenEnumerableExpression(token, serializer); - case EnumerableConstants.Input: + case Constants.Input: return DeserializeInputEnumerableExpression(token, serializer); - case EnumerableConstants.OrderBy: + case Constants.OrderBy: return DeserializeOrderByEnumerableExpression(token, serializer); - case EnumerableConstants.ScalarAsEnumerable: + case Constants.ScalarAsEnumerable: return DeserializeScalarAsEnumerableExpression(token, serializer); - case EnumerableConstants.Select: + case Constants.Select: return DeserializeSelectEnumerableExpression(token, serializer); - case EnumerableConstants.SelectMany: + case Constants.SelectMany: return DeserializeSelectManyExpression(token, serializer); - case EnumerableConstants.Take: + case Constants.Take: return DeserializeTakeEnumerableExpression(token, serializer); - case EnumerableConstants.Where: + case Constants.Where: return DeserializeWhereEnumerableExpression(token, serializer); default: throw new JsonException($"Invalid ClientQLExpression kind: {kind}"); @@ -90,18 +91,9 @@ private static ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerabl private static ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, JsonSerializer serializer) { - IReadOnlyList vecKeys = new ClientQLGroupByKey[] { }; - IReadOnlyList vecAggregates = new ClientQLAggregate[] { }; ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - if (token["VecKeys"] != null && token["VecKeys"] is JArray) - { - vecKeys = DeserializeGroupByKeys(token["VecKeys"]); - } - - if (token["VecAggregates"] != null && token["VecAggregates"] is JArray) - { - vecAggregates = DeserializeAggregates(token["VecAggregates"]); - } + IReadOnlyList vecKeys = GetValue>(token, "VecKeys"); + IReadOnlyList vecAggregates = GetValue>(token, "VecAggregates"); return new ClientQLGroupByEnumerableExpression(sourceExpression, vecKeys, vecAggregates); } @@ -115,7 +107,7 @@ private static ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableE private static ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(JToken token, JsonSerializer serializer) { - return new ClientQLInputEnumerableExpression(TryGetValue(token, "Name")); + return new ClientQLInputEnumerableExpression(GetValue(token, "Name")); } private static ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(JToken token, JsonSerializer serializer) @@ -130,7 +122,7 @@ private static ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableE private static ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(JToken token, JsonSerializer serializer) { ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - ClientQLEnumerationKind enumerationKind = (ClientQLEnumerationKind)Enum.Parse(typeof(ClientQLEnumerationKind), TryGetValue(token, "EnumerationKind")); + ClientQLEnumerationKind enumerationKind = (ClientQLEnumerationKind)Enum.Parse(typeof(ClientQLEnumerationKind), GetValue(token, "EnumerationKind")); return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); } @@ -156,8 +148,8 @@ private static ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpre private static ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(JToken token, JsonSerializer serializer) { ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - int skipValue = TryGetValue(token, "SkipValue"); - int takeExpression = TryGetValue(token, "TakeValue"); + int skipValue = GetValue(token, "SkipValue"); + int takeExpression = GetValue(token, "TakeValue"); return new ClientQLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); } @@ -172,7 +164,7 @@ private static ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpre private static ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSerializer serializer) { - object scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), TryGetValue(token, "Kind")); + object scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), GetValue(token, "Kind")); switch (scalarExpressionKind) { @@ -213,7 +205,7 @@ private static ClientQLScalarExpression DeserializeScalarExpression(JToken token private static ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLArrayKind arrayKind = TryGetValue(token, "ArrayKind"); + ClientQLArrayKind arrayKind = GetValue(token, "ArrayKind"); IReadOnlyList vecItems = DeserializeScalarExpressionArray(token["VecItems"], serializer); return new ClientQLArrayCreateScalarExpression(arrayKind, vecItems); @@ -222,15 +214,15 @@ private static ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarE private static ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(JToken token, JsonSerializer serializer) { ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - int index = TryGetValue(token, "Index"); + int index = GetValue(token, "Index"); return new ClientQLArrayIndexerScalarExpression(expression, index); } private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLBinaryScalarOperatorKind operatorKind = (ClientQLBinaryScalarOperatorKind)Enum.Parse(typeof(ClientQLBinaryScalarOperatorKind), TryGetValue(token, "OperatorKind")); - int maxDepth = TryGetValue(token, "MaxDepth"); + ClientQLBinaryScalarOperatorKind operatorKind = (ClientQLBinaryScalarOperatorKind)Enum.Parse(typeof(ClientQLBinaryScalarOperatorKind), GetValue(token, "OperatorKind")); + int maxDepth = GetValue(token, "MaxDepth"); ClientQLScalarExpression leftExpression = DeserializeScalarExpression(token["LeftExpression"], serializer); ClientQLScalarExpression rightExpression = DeserializeScalarExpression(token["RightExpression"], serializer); @@ -239,7 +231,7 @@ private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExp private static ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLIsOperatorKind operatorKind = (ClientQLIsOperatorKind)Enum.Parse(typeof(ClientQLIsOperatorKind), TryGetValue(token, "OperatorKind")); + ClientQLIsOperatorKind operatorKind = (ClientQLIsOperatorKind)Enum.Parse(typeof(ClientQLIsOperatorKind), GetValue(token, "OperatorKind")); ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); return new ClientQLIsOperatorScalarExpression(operatorKind, expression); @@ -273,7 +265,7 @@ private static ClientQLMuxScalarExpression DeserializeMuxScalarExpression(JToken private static ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(JToken token, JsonSerializer serializer) { - string objectKindString = TryGetValue(token, "ObjectKind"); + string objectKindString = GetValue(token, "ObjectKind"); if (!Enum.TryParse(objectKindString, out ClientQLObjectKind objectKind)) { throw new JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); @@ -288,14 +280,14 @@ private static ClientQLObjectCreateScalarExpression DeserializeObjectCreateScala private static ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(JToken token, JsonSerializer serializer) { ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - string propertyName = TryGetValue(token, "PropertyName"); + string propertyName = GetValue(token, "PropertyName"); return new ClientQLPropertyRefScalarExpression(expression, propertyName); } private static ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLBuiltinScalarFunctionKind functionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), TryGetValue(token, "FunctionKind")); + ClientQLBuiltinScalarFunctionKind functionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), GetValue(token, "FunctionKind")); IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token["VecArguments"], serializer); return new ClientQLSystemFunctionCallScalarExpression(functionKind, vecArguments); @@ -311,14 +303,14 @@ private static ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarE private static ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(JToken token, JsonSerializer serializer) { ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - int index = TryGetValue(token, "Index"); + int index = GetValue(token, "Index"); return new ClientQLTupleItemRefScalarExpression(expression, index); } private static ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLUnaryScalarOperatorKind operatorKind = (ClientQLUnaryScalarOperatorKind)Enum.Parse(typeof(ClientQLUnaryScalarOperatorKind), TryGetValue(token, "OperatorKind")); + ClientQLUnaryScalarOperatorKind operatorKind = (ClientQLUnaryScalarOperatorKind)Enum.Parse(typeof(ClientQLUnaryScalarOperatorKind), GetValue(token, "OperatorKind")); ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); return new ClientQLUnaryScalarExpression(operatorKind, expression); @@ -330,7 +322,7 @@ private static ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDe ValidateArrayProperty(token, "VecArguments"); IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token["VecArguments"], serializer); - bool builtin = TryGetValue(token, "Builtin"); + bool builtin = GetValue(token, "Builtin"); return new ClientQLUserDefinedFunctionCallScalarExpression(identifier, vecArguments, builtin); } @@ -344,7 +336,7 @@ private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarE private static ClientQLDelegate DeserializeDelegateExpression(JToken token) { - ClientQLDelegateKind kind = (ClientQLDelegateKind)Enum.Parse(typeof(ClientQLDelegateKind), TryGetValue(token, "Kind")); + ClientQLDelegateKind kind = (ClientQLDelegateKind)Enum.Parse(typeof(ClientQLDelegateKind), GetValue(token, "Kind")); ClientQLType type = DeserializeType(token["Type"]); return new ClientQLDelegate(kind, type); @@ -352,7 +344,7 @@ private static ClientQLDelegate DeserializeDelegateExpression(JToken token) private static ClientQLType DeserializeType(JToken token) { - ClientQLTypeKind kind = (ClientQLTypeKind)Enum.Parse(typeof(ClientQLTypeKind), TryGetValue(token, "Kind")); + ClientQLTypeKind kind = (ClientQLTypeKind)Enum.Parse(typeof(ClientQLTypeKind), GetValue(token, "Kind")); return new ClientQLType(kind); } @@ -360,7 +352,7 @@ private static ClientQLType DeserializeType(JToken token) private static ClientQLAggregate DeserializeAggregate(JToken token) { string operatorKind = null; - ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), TryGetValue(token, "Kind")); + ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), GetValue(token, "Kind")); if (token["OperatorKind"] != null) { operatorKind = token["OperatorKind"].ToString(); @@ -371,8 +363,8 @@ private static ClientQLAggregate DeserializeAggregate(JToken token) private static ClientQLVariable DeserializeClientQLVariable(JToken token) { - string name = TryGetValue(token, "Name"); - int uniqueId = TryGetValue(token, "UniqueId"); + string name = GetValue(token, "Name"); + int uniqueId = GetValue(token, "UniqueId"); return new ClientQLVariable(name, uniqueId); } @@ -382,7 +374,7 @@ private static List DeserializeObjectProperties(JToken t List properties = new List(); foreach (JToken propertyToken in token) { - string name = TryGetValue(propertyToken, "Name"); + string name = GetValue(propertyToken, "Name"); ClientQLScalarExpression expression = DeserializeScalarExpression(propertyToken["Expression"], serializer); properties.Add(new ClientQLObjectProperty(name, expression)); } @@ -407,8 +399,8 @@ private static List DeserializeAggregates(JToken token) List aggregates = new List(); foreach (JToken aggregateToken in token) { - ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), TryGetValue(aggregateToken, "Kind")); - string operatorKind = TryGetValue(aggregateToken, "OperatorKind"); + ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), GetValue(aggregateToken, "Kind")); + string operatorKind = GetValue(aggregateToken, "OperatorKind"); aggregates.Add(new ClientQLAggregate(kind, operatorKind)); } @@ -421,7 +413,7 @@ private static List DeserializeOrderByItems(JToken token, J foreach (JToken itemToken in token) { ClientQLScalarExpression expression = DeserializeScalarExpression(itemToken["Expression"], serializer); - ClientQLSortOrder sortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), TryGetValue(itemToken, "SortOrder")); + ClientQLSortOrder sortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), GetValue(itemToken, "SortOrder")); orderByItems.Add(new ClientQLOrderByItem(expression, sortOrder)); } @@ -442,7 +434,7 @@ private static List DeserializeScalarExpressionArray(J return properties; } - private static T TryGetValue(JToken token, string expression) + private static T GetValue(JToken token, string expression) { try { @@ -450,7 +442,7 @@ private static T TryGetValue(JToken token, string expression) } catch (Exception ex) { - string errorMessage = DeserializingExceptionMessage(); + string errorMessage = GetExceptionMessageFormat(); errorMessage += ex.InnerException; throw new ArgumentNullException(errorMessage); @@ -463,18 +455,19 @@ private static void ValidateArrayProperty(JToken token, string property) if (token[property] == null) { string nullErrorMessage = $"{property} could not be found in the deserialized plan."; - errorMessage = DeserializingExceptionMessage(); + errorMessage = GetExceptionMessageFormat(); throw new ArgumentException(errorMessage + nullErrorMessage); } - else if (token[property] is not JArray) + + if (token[property] is not JArray) { string arrayErrorMessage = $"{property} is not of type array when it should be."; - errorMessage = DeserializingExceptionMessage(); + errorMessage = GetExceptionMessageFormat(); throw new ArgumentException(errorMessage + arrayErrorMessage); } } - private static string DeserializingExceptionMessage() + private static string GetExceptionMessageFormat() { Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; string clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml index b141c28ba6..2eebe9d6d7 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml @@ -309,8 +309,8 @@ }, "Kind": 7 }, - "VecKeys": [], - "VecAggregates": [], + "VecKeys": null, + "VecAggregates": null, "Kind": 2 }, "DeclaredVariable": { From a19ba5b208569e1b7ea2407f5cb624faf69253f1 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Wed, 23 Aug 2023 15:30:18 -0700 Subject: [PATCH 16/36] Removed few functions. --- ...CoordinatorDistributionPlanDeserializer.cs | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 10faf3c4bc..3d67f90ed2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -7,7 +7,6 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan using System; using System.Collections.Generic; using System.Reflection; - using System.Runtime.CompilerServices; using ClientQL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -114,7 +113,7 @@ private static ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableE { ClientQLEnumerableExpression source = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); - IReadOnlyList orderByItems = DeserializeOrderByItems(token["VecItems"], serializer); + IReadOnlyList orderByItems = GetValue>(token, "VecItems"); return new ClientQLOrderByEnumerableExpression(source, declaredVariable, orderByItems); } @@ -382,31 +381,6 @@ private static List DeserializeObjectProperties(JToken t return properties; } - private static List DeserializeGroupByKeys(JToken token) - { - List groupByKeys = new List(); - foreach (JToken keyToken in token) - { - ClientQLType type = DeserializeType(keyToken["Type"]); - groupByKeys.Add(new ClientQLGroupByKey(type)); - } - - return groupByKeys; - } - - private static List DeserializeAggregates(JToken token) - { - List aggregates = new List(); - foreach (JToken aggregateToken in token) - { - ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), GetValue(aggregateToken, "Kind")); - string operatorKind = GetValue(aggregateToken, "OperatorKind"); - aggregates.Add(new ClientQLAggregate(kind, operatorKind)); - } - - return aggregates; - } - private static List DeserializeOrderByItems(JToken token, JsonSerializer serializer) { List orderByItems = new List(); From 91de1dc6b899ddf1c407f9d9dcb772281fef4a05 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Fri, 25 Aug 2023 19:06:14 -0700 Subject: [PATCH 17/36] Updated constants class --- ...CoordinatorDistributionPlanDeserializer.cs | 275 +++++++++++------- ...inatorDistributionPlanDeserialization.xml} | 0 ...oordinatorDistributionPlanBaselineTests.cs | 4 +- 3 files changed, 171 insertions(+), 108 deletions(-) rename Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/{CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml => CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml} (100%) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 3d67f90ed2..57f887b90f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -26,6 +26,42 @@ private static class Constants public const string SelectMany = "SelectMany"; public const string Take = "Take"; public const string Where = "Where"; + public const string CoordinatorDistributionPlan = "coordinatorDistributionPlan"; + public const string ClientQL = "clientQL"; + public const string SourceExpression = "SourceExpression"; + public const string VecExpression = "VecExpression"; + public const string VecKeys = "VecKeys"; + public const string VecAggregates = "VecAggregates"; + public const string VecItems = "VecItems"; + public const string DeclaredVariable = "DeclaredVariable"; + public const string EnumerationKind = "EnumerationKind"; + public const string SelectorExpression = "SelectorExpression"; + public const string SkipValue = "SkipValue"; + public const string TakeValue = "TakeValue"; + public const string Delegate = "Delegate"; + public const string Kind = "Kind"; + public const string Index = "Index"; + public const string ArrayKind = "ArrayKind"; + public const string Expression = "Expression"; + public const string OperatorKind = "OperatorKind"; + public const string LeftExpression = "LeftExpression"; + public const string RightExpression = "RightExpression"; + public const string MaxDepth = "MaxDepth"; + public const string DeclaredVariableExpression = "DeclaredVariableExpression"; + public const string ConditionExpression = "ConditionExpression"; + public const string Properties = "Properties"; + public const string PropertyName = "PropertyName"; + public const string FunctionKind = "FunctionKind"; + public const string VecArguments = "VecArguments"; + public const string Identifier = "Identifier"; + public const string Builtin = "Builtin"; + public const string Type = "Type"; + public const string Name = "Name"; + public const string UniqueId = "UniqueId"; + public const string SortOrder = "SortOrder"; + public const string Variable = "Variable"; + public const string ObjectKind = "ObjectKind"; + public const string Items = "Items"; } public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string jsonString) @@ -33,14 +69,14 @@ public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan JObject token = JObject.Parse(jsonString); JsonSerializer serializer = new JsonSerializer(); - ClientQLExpression clientQL = DeserializeClientQLEnumerableExpression(token["coordinatorDistributionPlan"]["clientQL"], serializer); + ClientQLExpression clientQL = DeserializeClientQLEnumerableExpression(token[Constants.CoordinatorDistributionPlan][Constants.ClientQL], serializer); return new CoordinatorDistributionPlan(clientQL); } private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, JsonSerializer serializer) { - string kind = GetValue(token, "Kind"); + string kind = GetValue(token, Constants.Kind); switch (kind) { @@ -67,23 +103,23 @@ private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpress case Constants.Where: return DeserializeWhereEnumerableExpression(token, serializer); default: - throw new JsonException($"Invalid ClientQLExpression kind: {kind}"); + throw new NotSupportedException($"Unsupported ClientQLExpression kind: {kind}"); } } private static ClientQLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLAggregate aggregate = DeserializeAggregate(token["Aggregate"]); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); + ClientQLAggregate aggregate = DeserializeAggregate(token[Constants.Aggregate]); return new ClientQLAggregateEnumerableExpression(sourceExpression, aggregate); } private static ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); - IReadOnlyList vecExpressions = DeserializeScalarExpressionArray(token["VecExpression"], serializer); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); + IReadOnlyList vecExpressions = DeserializeScalarExpressionArray(token[Constants.VecExpression], serializer); return new ClientQLDistinctEnumerableExpression(sourceExpression, declaredVariable, vecExpressions); } @@ -91,79 +127,84 @@ private static ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerabl private static ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, JsonSerializer serializer) { ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - IReadOnlyList vecKeys = GetValue>(token, "VecKeys"); - IReadOnlyList vecAggregates = GetValue>(token, "VecAggregates"); + IReadOnlyList vecKeys = GetValue>(token, Constants.VecKeys); + IReadOnlyList vecAggregates = GetValue>(token, Constants.VecAggregates); return new ClientQLGroupByEnumerableExpression(sourceExpression, vecKeys, vecAggregates); } private static ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); return new ClientQLFlattenEnumerableExpression(sourceExpression); } private static ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(JToken token, JsonSerializer serializer) { - return new ClientQLInputEnumerableExpression(GetValue(token, "Name")); + return new ClientQLInputEnumerableExpression(GetValue(token, Constants.Name)); } private static ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression source = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); - IReadOnlyList orderByItems = GetValue>(token, "VecItems"); + ClientQLEnumerableExpression source = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); + IReadOnlyList orderByItems = GetValue>(token, Constants.VecItems); return new ClientQLOrderByEnumerableExpression(source, declaredVariable, orderByItems); } private static ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - ClientQLEnumerationKind enumerationKind = (ClientQLEnumerationKind)Enum.Parse(typeof(ClientQLEnumerationKind), GetValue(token, "EnumerationKind")); - - return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); + ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); + if (Enum.TryParse(GetValue(token, Constants.EnumerationKind), out ClientQLEnumerationKind enumerationKind)) + { + return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); + } + else + { + throw new NotSupportedException($"Invalid ScalarAsEnumerable Expression: {enumerationKind}"); + } } private static ClientQLSelectEnumerableExpression DeserializeSelectEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); - ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); + ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); return new ClientQLSelectEnumerableExpression(sourceExpression, declaredVariable, expression); } private static ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); - ClientQLEnumerableExpression selectorExpression = DeserializeClientQLEnumerableExpression(token["SelectorExpression"], serializer); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); + ClientQLEnumerableExpression selectorExpression = DeserializeClientQLEnumerableExpression(token[Constants.SelectorExpression], serializer); return new ClientQLSelectManyEnumerableExpression(sourceExpression, declaredVariable, selectorExpression); } private static ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - int skipValue = GetValue(token, "SkipValue"); - int takeExpression = GetValue(token, "TakeValue"); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); + int skipValue = GetValue(token, Constants.SkipValue); + int takeExpression = GetValue(token, Constants.TakeValue); return new ClientQLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); } private static ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(JToken token, JsonSerializer serializer) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - ClientQLDelegate clientDelegate = DeserializeDelegateExpression(token["Delegate"]); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); + ClientQLDelegate clientDelegate = DeserializeDelegateExpression(token[Constants.Delegate]); return new ClientQLWhereEnumerableExpression(sourceExpression, clientDelegate); } private static ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSerializer serializer) { - object scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), GetValue(token, "Kind")); + object scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), GetValue(token, Constants.Kind)); switch (scalarExpressionKind) { @@ -198,49 +239,60 @@ private static ClientQLScalarExpression DeserializeScalarExpression(JToken token case ClientQLScalarExpressionKind.VariableRef: return DeserializeVariableRefScalarExpression(token, serializer); default: - throw new JsonException($"Invalid ClientQLScalarExpressionKind: {scalarExpressionKind}"); + throw new NotSupportedException($"Invalid ClientQLScalarExpressionKind: {scalarExpressionKind}"); } } private static ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLArrayKind arrayKind = GetValue(token, "ArrayKind"); - IReadOnlyList vecItems = DeserializeScalarExpressionArray(token["VecItems"], serializer); + ClientQLArrayKind arrayKind = GetValue(token, Constants.ArrayKind); + IReadOnlyList vecItems = DeserializeScalarExpressionArray(token[Constants.VecItems], serializer); return new ClientQLArrayCreateScalarExpression(arrayKind, vecItems); } private static ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - int index = GetValue(token, "Index"); + ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); + int index = GetValue(token, Constants.Index); return new ClientQLArrayIndexerScalarExpression(expression, index); } private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLBinaryScalarOperatorKind operatorKind = (ClientQLBinaryScalarOperatorKind)Enum.Parse(typeof(ClientQLBinaryScalarOperatorKind), GetValue(token, "OperatorKind")); - int maxDepth = GetValue(token, "MaxDepth"); - ClientQLScalarExpression leftExpression = DeserializeScalarExpression(token["LeftExpression"], serializer); - ClientQLScalarExpression rightExpression = DeserializeScalarExpression(token["RightExpression"], serializer); + if (Enum.TryParse(GetValue(token, Constants.OperatorKind), out ClientQLBinaryScalarOperatorKind operatorKind)) + { + int maxDepth = GetValue(token, Constants.MaxDepth); + ClientQLScalarExpression leftExpression = DeserializeScalarExpression(token[Constants.LeftExpression], serializer); + ClientQLScalarExpression rightExpression = DeserializeScalarExpression(token[Constants.RightExpression], serializer); - return new ClientQLBinaryScalarExpression(operatorKind, maxDepth, leftExpression, rightExpression); + return new ClientQLBinaryScalarExpression(operatorKind, maxDepth, leftExpression, rightExpression); + } + else + { + throw new NotSupportedException($"Invalid Binary Operator Expression: {operatorKind}"); + } } private static ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLIsOperatorKind operatorKind = (ClientQLIsOperatorKind)Enum.Parse(typeof(ClientQLIsOperatorKind), GetValue(token, "OperatorKind")); - ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - - return new ClientQLIsOperatorScalarExpression(operatorKind, expression); + if (Enum.TryParse(GetValue(token, Constants.OperatorKind), out ClientQLIsOperatorKind operatorKind)) + { + ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); + return new ClientQLIsOperatorScalarExpression(operatorKind, expression); + } + else + { + throw new NotSupportedException($"Invalid Operator Scalar Expression: {operatorKind}"); + } } private static ClientQLLetScalarExpression DeserializeLetScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token["DeclaredVariable"]); - ClientQLScalarExpression declaredVariableExpression = DeserializeScalarExpression(token["DeclaredVariableExpression"], serializer); - ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); + ClientQLScalarExpression declaredVariableExpression = DeserializeScalarExpression(token[Constants.DeclaredVariableExpression], serializer); + ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); return new ClientQLLetScalarExpression(declaredVariable, declaredVariableExpression, expression); } @@ -255,115 +307,141 @@ private static ClientQLLiteralScalarExpression DeserializeLiteralScalarExpressio private static ClientQLMuxScalarExpression DeserializeMuxScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression conditionExpression = DeserializeScalarExpression(token["ConditionExpression"], serializer); - ClientQLScalarExpression leftExpression = DeserializeScalarExpression(token["LeftExpression"], serializer); - ClientQLScalarExpression rightExpression = DeserializeScalarExpression(token["RightExpression"], serializer); + ClientQLScalarExpression conditionExpression = DeserializeScalarExpression(token[Constants.ConditionExpression], serializer); + ClientQLScalarExpression leftExpression = DeserializeScalarExpression(token[Constants.LeftExpression], serializer); + ClientQLScalarExpression rightExpression = DeserializeScalarExpression(token[Constants.RightExpression], serializer); return new ClientQLMuxScalarExpression(conditionExpression, leftExpression, rightExpression); } private static ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(JToken token, JsonSerializer serializer) { - string objectKindString = GetValue(token, "ObjectKind"); + string objectKindString = GetValue(token, Constants.ObjectKind); if (!Enum.TryParse(objectKindString, out ClientQLObjectKind objectKind)) { - throw new JsonException($"Invalid ClientQLObjectKind: {objectKindString}"); + throw new NotSupportedException($"Invalid ClientQLObjectKind: {objectKindString}"); } ValidateArrayProperty(token, "Properties"); - IReadOnlyList properties = DeserializeObjectProperties(token["Properties"], serializer); + IReadOnlyList properties = DeserializeObjectProperties(token[Constants.Properties], serializer); return new ClientQLObjectCreateScalarExpression(properties, objectKind); } private static ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - string propertyName = GetValue(token, "PropertyName"); + ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); + string propertyName = GetValue(token, Constants.PropertyName); return new ClientQLPropertyRefScalarExpression(expression, propertyName); } private static ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLBuiltinScalarFunctionKind functionKind = (ClientQLBuiltinScalarFunctionKind)Enum.Parse(typeof(ClientQLBuiltinScalarFunctionKind), GetValue(token, "FunctionKind")); - IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token["VecArguments"], serializer); - - return new ClientQLSystemFunctionCallScalarExpression(functionKind, vecArguments); + if (Enum.TryParse(GetValue(token, Constants.FunctionKind), out ClientQLBuiltinScalarFunctionKind functionKind)) + { + IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token[Constants.VecArguments], serializer); + return new ClientQLSystemFunctionCallScalarExpression(functionKind, vecArguments); + } + else + { + throw new NotSupportedException($"Invalid System Function Call Expression: {functionKind}"); + } } private static ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(JToken token, JsonSerializer serializer) { - IReadOnlyList vecItems = DeserializeScalarExpressionArray(token["Items"], serializer); + IReadOnlyList vecItems = DeserializeScalarExpressionArray(token[Constants.Items], serializer); return new ClientQLTupleCreateScalarExpression(vecItems); } private static ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - int index = GetValue(token, "Index"); + ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); + int index = GetValue(token, Constants.Index); return new ClientQLTupleItemRefScalarExpression(expression, index); } private static ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLUnaryScalarOperatorKind operatorKind = (ClientQLUnaryScalarOperatorKind)Enum.Parse(typeof(ClientQLUnaryScalarOperatorKind), GetValue(token, "OperatorKind")); - ClientQLScalarExpression expression = DeserializeScalarExpression(token["Expression"], serializer); - - return new ClientQLUnaryScalarExpression(operatorKind, expression); + if (Enum.TryParse(GetValue(token, Constants.OperatorKind), out ClientQLUnaryScalarOperatorKind operatorKind)) + { + ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); + return new ClientQLUnaryScalarExpression(operatorKind, expression); + } + else + { + throw new NotSupportedException($"Invalid Unary Scalar Expression: {operatorKind}"); + } } private static ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLFunctionIdentifier identifier = token["Identifier"].ToObject(serializer); + ClientQLFunctionIdentifier identifier = token[Constants.Identifier].ToObject(serializer); - ValidateArrayProperty(token, "VecArguments"); - IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token["VecArguments"], serializer); - bool builtin = GetValue(token, "Builtin"); + ValidateArrayProperty(token, Constants.VecArguments); + IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token[Constants.VecArguments], serializer); + bool builtin = GetValue(token, Constants.Builtin); return new ClientQLUserDefinedFunctionCallScalarExpression(identifier, vecArguments, builtin); } private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarExpression(JToken token, JsonSerializer serializer) { - ClientQLVariable variable = DeserializeClientQLVariable(token["Variable"]); + ClientQLVariable variable = DeserializeClientQLVariable(token[Constants.Variable]); return new ClientQLVariableRefScalarExpression(variable); } private static ClientQLDelegate DeserializeDelegateExpression(JToken token) { - ClientQLDelegateKind kind = (ClientQLDelegateKind)Enum.Parse(typeof(ClientQLDelegateKind), GetValue(token, "Kind")); - ClientQLType type = DeserializeType(token["Type"]); - - return new ClientQLDelegate(kind, type); + if (Enum.TryParse(GetValue(token, Constants.Kind), out ClientQLDelegateKind kind)) + { + ClientQLType type = DeserializeType(token[Constants.Type]); + return new ClientQLDelegate(kind, type); + } + else + { + throw new NotSupportedException($"Invalid Delegate Expression: {kind}"); + } } private static ClientQLType DeserializeType(JToken token) { - ClientQLTypeKind kind = (ClientQLTypeKind)Enum.Parse(typeof(ClientQLTypeKind), GetValue(token, "Kind")); - - return new ClientQLType(kind); + if (Enum.TryParse(GetValue(token, Constants.Kind), out ClientQLTypeKind kind)) + { + return new ClientQLType(kind); + } + else + { + throw new NotSupportedException($"Invalid Type Expression: {kind}"); + } } private static ClientQLAggregate DeserializeAggregate(JToken token) { - string operatorKind = null; - ClientQLAggregateKind kind = (ClientQLAggregateKind)Enum.Parse(typeof(ClientQLAggregateKind), GetValue(token, "Kind")); - if (token["OperatorKind"] != null) + if (Enum.TryParse(GetValue(token, Constants.Kind), out ClientQLAggregateKind kind)) { - operatorKind = token["OperatorKind"].ToString(); - } + string operatorKind = null; + if (token[Constants.OperatorKind] != null) + { + operatorKind = token[Constants.OperatorKind].ToString(); + } - return new ClientQLAggregate(kind, operatorKind); + return new ClientQLAggregate(kind, operatorKind); + } + else + { + throw new NotSupportedException($"Invalid Aggregate Expression: {kind}"); + } } private static ClientQLVariable DeserializeClientQLVariable(JToken token) { - string name = GetValue(token, "Name"); - int uniqueId = GetValue(token, "UniqueId"); + string name = GetValue(token, Constants.Name); + int uniqueId = GetValue(token, Constants.UniqueId); return new ClientQLVariable(name, uniqueId); } @@ -373,27 +451,14 @@ private static List DeserializeObjectProperties(JToken t List properties = new List(); foreach (JToken propertyToken in token) { - string name = GetValue(propertyToken, "Name"); - ClientQLScalarExpression expression = DeserializeScalarExpression(propertyToken["Expression"], serializer); + string name = GetValue(propertyToken, Constants.Name); + ClientQLScalarExpression expression = DeserializeScalarExpression(propertyToken[Constants.Expression], serializer); properties.Add(new ClientQLObjectProperty(name, expression)); } return properties; } - private static List DeserializeOrderByItems(JToken token, JsonSerializer serializer) - { - List orderByItems = new List(); - foreach (JToken itemToken in token) - { - ClientQLScalarExpression expression = DeserializeScalarExpression(itemToken["Expression"], serializer); - ClientQLSortOrder sortOrder = (ClientQLSortOrder)Enum.Parse(typeof(ClientQLSortOrder), GetValue(itemToken, "SortOrder")); - orderByItems.Add(new ClientQLOrderByItem(expression, sortOrder)); - } - - return orderByItems; - } - private static List DeserializeScalarExpressionArray(JToken token, JsonSerializer serializer) { List properties = new List(); @@ -430,7 +495,7 @@ private static void ValidateArrayProperty(JToken token, string property) { string nullErrorMessage = $"{property} could not be found in the deserialized plan."; errorMessage = GetExceptionMessageFormat(); - throw new ArgumentException(errorMessage + nullErrorMessage); + throw new ArgumentNullException(errorMessage + nullErrorMessage); } if (token[property] is not JArray) @@ -446,9 +511,7 @@ private static string GetExceptionMessageFormat() Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; string clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; - return $"Customer SDK version is {clientSDKVersion}. Please upgrade if need be. " + - $"Error occured during deserialization of distribution plan. Please reach out to the CosmosDB query team to fix this. " + - $"Error Message: "; + return $"Exception occurred while deserializing query plan. Version : '{clientSDKVersion}', Exception/Reason : '{1}'."; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml similarity index 100% rename from Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserializing.xml rename to Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs index c23340ce44..1a6e187877 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs @@ -14,7 +14,7 @@ public class CoordinatorDistributionPlanBaselineTests : BaselineTests testVariations = new List { @@ -33,7 +33,7 @@ public void TestCoordinatorDistributionPlanDeserializing() CreateInput( description: @"Select, Sum and VariableRef Expressions", coordinatorPlanJson: "{\"coordinatorDistributionPlan\": {\"clientQL\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a_plus_five\",\"Expression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"Add\",\"LeftExpression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6 }}, \"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": { \"Kind\": \"Number\", \"Value\": 5 }}}}]}, \"SourceExpression\": { \"Kind\": \"Aggregate\", \"Aggregate\": { \"Kind\": \"Builtin\", \"OperatorKind\": \"Sum\" }, \"SourceExpression\": { \"Kind\": \"Input\", \"Name\": \"root\" }}}}}"), - }; + }; this.ExecuteTestSuite(testVariations); } From 3799da8a81db248c61fb50f38514409b5482dad9 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar <94020786+akotalwar@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:04:09 -0700 Subject: [PATCH 18/36] Function Formatting for ClientQL Deserializing (#4062) * Adding error handling for Deserializing functions * Finished updating code to remove all dependency on Newtonsoft.Json * Removed try catch for all upper level functions * Resolved comments * Resolved comments pt2 * Updated error message --- .../ClientQLArrayCreateScalarExpression.cs | 6 +- .../ClientQL/ClientQLArrayLiteral.cs | 6 +- .../ClientQLDistinctEnumerableExpression.cs | 6 +- .../ClientQL/ClientQLFunctionIdentifier.cs | 5 + .../ClientQLGroupByEnumerableExpression.cs | 10 +- .../ClientQL/ClientQLObjectLiteral.cs | 6 +- .../ClientQLOrderByEnumerableExpression.cs | 6 +- ...entQLSystemFunctionCallScalarExpression.cs | 6 +- .../ClientQL/ClientQLTupleAggregate.cs | 6 +- .../ClientQLTupleCreateScalarExpression.cs | 6 +- .../ClientQL/ClientQLTupleType.cs | 6 +- ...UserDefinedFunctionCallScalarExpression.cs | 6 +- ...CoordinatorDistributionPlanDeserializer.cs | 526 +++++++++--------- ...dinatorDistributionPlanDeserialization.xml | 89 ++- ...oordinatorDistributionPlanBaselineTests.cs | 1 + 15 files changed, 381 insertions(+), 310 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs index 9c4f630a3f..35c9209801 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs @@ -8,16 +8,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLArrayCreateScalarExpression : ClientQLScalarExpression { - public ClientQLArrayCreateScalarExpression(ClientQLArrayKind arrayKind, IReadOnlyList vecItems) + public ClientQLArrayCreateScalarExpression(ClientQLArrayKind arrayKind, IReadOnlyList items) : base(ClientQLScalarExpressionKind.ArrayCreate) { this.ArrayKind = arrayKind; - this.VecItems = vecItems; + this.Items = items; } public ClientQLArrayKind ArrayKind { get; } - public IReadOnlyList VecItems { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs index 912e9e8bdc..5be8d17dd2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs @@ -8,12 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLArrayLiteral : ClientQLLiteral { - public ClientQLArrayLiteral(IReadOnlyList vecItems) + public ClientQLArrayLiteral(IReadOnlyList items) : base(ClientQLLiteralKind.Array) { - this.VecItems = vecItems; + this.Items = items; } - public IReadOnlyList VecItems { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs index fc99a96b0c..25c9527dd7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs @@ -8,19 +8,19 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLDistinctEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLDistinctEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, IReadOnlyList vecExpression) + public ClientQLDistinctEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, IReadOnlyList expression) : base(ClientQLEnumerableExpressionKind.Distinct) { this.SourceExpression = sourceExpression; this.DeclaredVariable = declaredVariable; - this.VecExpression = vecExpression; + this.Expression = expression; } public ClientQLEnumerableExpression SourceExpression { get; } public ClientQLVariable DeclaredVariable { get; } - public IReadOnlyList VecExpression { get; } + public IReadOnlyList Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs index 10e0ea1232..c0ac9c772c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs @@ -6,6 +6,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLFunctionIdentifier { + public ClientQLFunctionIdentifier(string strName) + { + this.StrName = strName; + } + public string StrName { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs index 4c411d18ea..6382d42e23 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs @@ -8,19 +8,19 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLGroupByEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, IReadOnlyList vecKeys, IReadOnlyList vecAggregates) + public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, int keyCount, IReadOnlyList aggregates) : base(ClientQLEnumerableExpressionKind.GroupBy) { this.SourceExpression = sourceExpression; - this.VecKeys = vecKeys; - this.VecAggregates = vecAggregates; + this.KeyCount = keyCount; + this.Aggregates = aggregates; } public ClientQLEnumerableExpression SourceExpression { get; } - public IReadOnlyList VecKeys { get; } + public int KeyCount { get; } - public IReadOnlyList VecAggregates { get; } + public IReadOnlyList Aggregates { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs index 2f08630b2e..b6ad214cc2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs @@ -8,12 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLObjectLiteral : ClientQLLiteral { - public ClientQLObjectLiteral(IReadOnlyList vecProperties) + public ClientQLObjectLiteral(IReadOnlyList properties) : base(ClientQLLiteralKind.Object) { - this.VecProperties = vecProperties; + this.Properties = properties; } - public IReadOnlyList VecProperties { get; } + public IReadOnlyList Properties { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs index 9f980b4b62..88e4bd1bf2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs @@ -8,19 +8,19 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLOrderByEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLOrderByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, IReadOnlyList vecItems) + public ClientQLOrderByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, IReadOnlyList items) : base(ClientQLEnumerableExpressionKind.OrderBy) { this.SourceExpression = sourceExpression; this.DeclaredVariable = declaredVariable; - this.VecItems = vecItems; + this.Items = items; } public ClientQLEnumerableExpression SourceExpression { get; } public ClientQLVariable DeclaredVariable { get; } - public IReadOnlyList VecItems { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs index 9bb4d493f8..76a7675168 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs @@ -8,16 +8,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLSystemFunctionCallScalarExpression : ClientQLScalarExpression { - public ClientQLSystemFunctionCallScalarExpression(ClientQLBuiltinScalarFunctionKind functionKind, IReadOnlyList vecArguments) + public ClientQLSystemFunctionCallScalarExpression(ClientQLBuiltinScalarFunctionKind functionKind, IReadOnlyList arguments) : base(ClientQLScalarExpressionKind.SystemFunctionCall) { this.FunctionKind = functionKind; - this.VecArguments = vecArguments; + this.Arguments = arguments; } public ClientQLBuiltinScalarFunctionKind FunctionKind { get; } - public IReadOnlyList VecArguments { get; } + public IReadOnlyList Arguments { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs index 90da342203..821ba52e36 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs @@ -8,12 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleAggregate : ClientQLAggregate { - public ClientQLTupleAggregate(string operatorKind, IReadOnlyList vecItems) + public ClientQLTupleAggregate(string operatorKind, IReadOnlyList items) : base(ClientQLAggregateKind.Tuple, operatorKind) { - this.VecItems = vecItems; + this.Items = items; } - public IReadOnlyList VecItems { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs index 495c9011a1..3bbc1e4366 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs @@ -8,13 +8,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleCreateScalarExpression : ClientQLScalarExpression { - public ClientQLTupleCreateScalarExpression(IReadOnlyList vecItems) + public ClientQLTupleCreateScalarExpression(IReadOnlyList items) : base(ClientQLScalarExpressionKind.TupleCreate) { - this.VecItems = vecItems; + this.Items = items; } - public IReadOnlyList VecItems { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs index f563685546..02f6548a94 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs @@ -8,13 +8,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleType : ClientQLType { - public ClientQLTupleType(IReadOnlyList vecTypes) + public ClientQLTupleType(IReadOnlyList types) : base(ClientQLTypeKind.Tuple) { - this.VecTypes = vecTypes; + this.Types = types; } - public IReadOnlyList VecTypes { get; } + public IReadOnlyList Types { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs index 9943740967..a0673d3721 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs @@ -8,17 +8,17 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLUserDefinedFunctionCallScalarExpression : ClientQLScalarExpression { - public ClientQLUserDefinedFunctionCallScalarExpression(ClientQLFunctionIdentifier identifier, IReadOnlyList vecArguments, bool builtin) + public ClientQLUserDefinedFunctionCallScalarExpression(ClientQLFunctionIdentifier identifier, IReadOnlyList arguments, bool builtin) : base(ClientQLScalarExpressionKind.UserDefinedFunctionCall) { this.Identifier = identifier; - this.VecArguments = vecArguments; + this.Arguments = arguments; this.Builtin = builtin; } public ClientQLFunctionIdentifier Identifier { get; } - public IReadOnlyList VecArguments { get; } + public IReadOnlyList Arguments { get; } public bool Builtin { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 57f887b90f..ff8952a7a0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -8,14 +8,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan using System.Collections.Generic; using System.Reflection; using ClientQL; - using Newtonsoft.Json; - using Newtonsoft.Json.Linq; + using Microsoft.Azure.Cosmos.CosmosElements; internal static class CoordinatorDistributionPlanDeserializer { private static class Constants { public const string Aggregate = "Aggregate"; + public const string Aggregates = "Aggregates"; public const string Distinct = "Distinct"; public const string GroupBy = "GroupBy"; public const string Flatten = "Flatten"; @@ -24,15 +24,13 @@ private static class Constants public const string ScalarAsEnumerable = "ScalarAsEnumerable"; public const string Select = "Select"; public const string SelectMany = "SelectMany"; + public const string Arguments = "Arguments"; public const string Take = "Take"; public const string Where = "Where"; + public const string Tuple = "Tuple"; public const string CoordinatorDistributionPlan = "coordinatorDistributionPlan"; public const string ClientQL = "clientQL"; public const string SourceExpression = "SourceExpression"; - public const string VecExpression = "VecExpression"; - public const string VecKeys = "VecKeys"; - public const string VecAggregates = "VecAggregates"; - public const string VecItems = "VecItems"; public const string DeclaredVariable = "DeclaredVariable"; public const string EnumerationKind = "EnumerationKind"; public const string SelectorExpression = "SelectorExpression"; @@ -52,10 +50,10 @@ private static class Constants public const string Properties = "Properties"; public const string PropertyName = "PropertyName"; public const string FunctionKind = "FunctionKind"; - public const string VecArguments = "VecArguments"; public const string Identifier = "Identifier"; public const string Builtin = "Builtin"; public const string Type = "Type"; + public const string KeyCount = "KeyCount"; public const string Name = "Name"; public const string UniqueId = "UniqueId"; public const string SortOrder = "SortOrder"; @@ -66,447 +64,439 @@ private static class Constants public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string jsonString) { - JObject token = JObject.Parse(jsonString); - JsonSerializer serializer = new JsonSerializer(); + CosmosObject cosmosObject = CosmosObject.Parse(jsonString); + CosmosElement coordinatorDistributionPlanElement = GetValue(cosmosObject, Constants.CoordinatorDistributionPlan); + CosmosElement clientQLElement = GetValue((CosmosObject)coordinatorDistributionPlanElement, Constants.ClientQL); + ClientQLEnumerableExpression expression = DeserializeClientQLEnumerableExpression((CosmosObject)clientQLElement); - ClientQLExpression clientQL = DeserializeClientQLEnumerableExpression(token[Constants.CoordinatorDistributionPlan][Constants.ClientQL], serializer); - - return new CoordinatorDistributionPlan(clientQL); + return new CoordinatorDistributionPlan(expression); } - private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(CosmosObject cosmosObject) { - string kind = GetValue(token, Constants.Kind); - - switch (kind) + string kindProperty = GetValue(cosmosObject, Constants.Kind).Value; + switch (kindProperty) { case Constants.Aggregate: - return DeserializeAggregateEnumerableExpression(token, serializer); + return DeserializeAggregateEnumerableExpression(cosmosObject); case Constants.Distinct: - return DeserializeDistinctEnumerableExpression(token, serializer); + return DeserializeDistinctEnumerableExpression(cosmosObject); case Constants.GroupBy: - return DeserializeGroupByEnumerableExpression(token, serializer); + return DeserializeGroupByEnumerableExpression(cosmosObject); case Constants.Flatten: - return DeserializeFlattenEnumerableExpression(token, serializer); + return DeserializeFlattenEnumerableExpression(cosmosObject); case Constants.Input: - return DeserializeInputEnumerableExpression(token, serializer); + return DeserializeInputEnumerableExpression(cosmosObject); case Constants.OrderBy: - return DeserializeOrderByEnumerableExpression(token, serializer); + return DeserializeOrderByEnumerableExpression(cosmosObject); case Constants.ScalarAsEnumerable: - return DeserializeScalarAsEnumerableExpression(token, serializer); + return DeserializeScalarAsEnumerableExpression(cosmosObject); case Constants.Select: - return DeserializeSelectEnumerableExpression(token, serializer); + return DeserializeSelectEnumerableExpression(cosmosObject); case Constants.SelectMany: - return DeserializeSelectManyExpression(token, serializer); + return DeserializeSelectManyExpression(cosmosObject); case Constants.Take: - return DeserializeTakeEnumerableExpression(token, serializer); + return DeserializeTakeEnumerableExpression(cosmosObject); case Constants.Where: - return DeserializeWhereEnumerableExpression(token, serializer); + return DeserializeWhereEnumerableExpression(cosmosObject); default: - throw new NotSupportedException($"Unsupported ClientQLExpression kind: {kind}"); + throw new NotSupportedException($"Invalid ClientQLExpression kind: {kindProperty}"); } } - - private static ClientQLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(JToken token, JsonSerializer serializer) + + private static ClientQLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); - ClientQLAggregate aggregate = DeserializeAggregate(token[Constants.Aggregate]); - + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + ClientQLAggregate aggregate = DeserializeAggregate(GetValue(cosmosObject, Constants.Aggregate)); return new ClientQLAggregateEnumerableExpression(sourceExpression, aggregate); } - private static ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); - IReadOnlyList vecExpressions = DeserializeScalarExpressionArray(token[Constants.VecExpression], serializer); - - return new ClientQLDistinctEnumerableExpression(sourceExpression, declaredVariable, vecExpressions); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + IReadOnlyList expressions = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Expression)); + return new ClientQLDistinctEnumerableExpression(sourceExpression, declaredVariable, expressions); } - private static ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token["SourceExpression"], serializer); - IReadOnlyList vecKeys = GetValue>(token, Constants.VecKeys); - IReadOnlyList vecAggregates = GetValue>(token, Constants.VecAggregates); - - return new ClientQLGroupByEnumerableExpression(sourceExpression, vecKeys, vecAggregates); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + int keyCount = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.KeyCount).Value); + IReadOnlyList aggregates = DeserializeAggregateArray(GetValue(cosmosObject, Constants.Aggregates)); + return new ClientQLGroupByEnumerableExpression(sourceExpression, keyCount, aggregates); } - private static ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); - + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); return new ClientQLFlattenEnumerableExpression(sourceExpression); } - private static ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(CosmosObject cosmosObject) { - return new ClientQLInputEnumerableExpression(GetValue(token, Constants.Name)); + return new ClientQLInputEnumerableExpression(GetValue(cosmosObject, Constants.Name).Value); } - private static ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression source = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); - IReadOnlyList orderByItems = GetValue>(token, Constants.VecItems); - - return new ClientQLOrderByEnumerableExpression(source, declaredVariable, orderByItems); + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + IReadOnlyList orderByItems = DeserializeOrderByItemArray(GetValue(cosmosObject, Constants.Items)); + return new ClientQLOrderByEnumerableExpression(sourceExpression, declaredVariable, orderByItems); } - private static ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); - if (Enum.TryParse(GetValue(token, Constants.EnumerationKind), out ClientQLEnumerationKind enumerationKind)) - { - return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); - } - else - { - throw new NotSupportedException($"Invalid ScalarAsEnumerable Expression: {enumerationKind}"); - } + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + GetEnumValue(GetValue(cosmosObject, Constants.EnumerationKind).Value, out ClientQLEnumerationKind enumerationKind); + return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); } - private static ClientQLSelectEnumerableExpression DeserializeSelectEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLSelectEnumerableExpression DeserializeSelectEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); - ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); - + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); return new ClientQLSelectEnumerableExpression(sourceExpression, declaredVariable, expression); } - private static ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpression(JToken token, JsonSerializer serializer) + private static ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); - ClientQLEnumerableExpression selectorExpression = DeserializeClientQLEnumerableExpression(token[Constants.SelectorExpression], serializer); - + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + ClientQLEnumerableExpression selectorExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SelectorExpression)); return new ClientQLSelectManyEnumerableExpression(sourceExpression, declaredVariable, selectorExpression); } - private static ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); - int skipValue = GetValue(token, Constants.SkipValue); - int takeExpression = GetValue(token, Constants.TakeValue); - + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + int skipValue = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.SkipValue).Value); + int takeExpression = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.TakeValue).Value); return new ClientQLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); } - private static ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(JToken token, JsonSerializer serializer) + private static ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(token[Constants.SourceExpression], serializer); - ClientQLDelegate clientDelegate = DeserializeDelegateExpression(token[Constants.Delegate]); - + ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + ClientQLDelegate clientDelegate = DeserializeDelegateExpression(GetValue(cosmosObject, Constants.Delegate)); return new ClientQLWhereEnumerableExpression(sourceExpression, clientDelegate); } - private static ClientQLScalarExpression DeserializeScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLScalarExpression DeserializeScalarExpression(CosmosObject cosmosObject) { - object scalarExpressionKind = (ClientQLScalarExpressionKind)Enum.Parse(typeof(ClientQLScalarExpressionKind), GetValue(token, Constants.Kind)); - + GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value, out ClientQLScalarExpressionKind scalarExpressionKind); switch (scalarExpressionKind) { case ClientQLScalarExpressionKind.ArrayCreate: - return DeserializeArrayCreateScalarExpression(token, serializer); + return DeserializeArrayCreateScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.ArrayIndexer: - return DeserializeArrayIndexerScalarExpression(token, serializer); + return DeserializeArrayIndexerScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.BinaryOperator: - return DeserializeBinaryOperatorScalarExpression(token, serializer); + return DeserializeBinaryOperatorScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.IsOperator: - return DeserializeIsOperatorScalarExpression(token, serializer); + return DeserializeIsOperatorScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.Let: - return DeserializeLetScalarExpression(token, serializer); + return DeserializeLetScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.Literal: - return DeserializeLiteralScalarExpression(token, serializer); + return DeserializeLiteralScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.Mux: - return DeserializeMuxScalarExpression(token, serializer); + return DeserializeMuxScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.ObjectCreate: - return DeserializeObjectCreateScalarExpression(token, serializer); + return DeserializeObjectCreateScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.PropertyRef: - return DeserializePropertyRefScalarExpression(token, serializer); + return DeserializePropertyRefScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.SystemFunctionCall: - return DeserializeSystemFunctionCallScalarExpression(token, serializer); + return DeserializeSystemFunctionCallScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.TupleCreate: - return DeserializeTupleCreateScalarExpression(token, serializer); + return DeserializeTupleCreateScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.TupleItemRef: - return DeserializeTupleItemRefScalarExpression(token, serializer); + return DeserializeTupleItemRefScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.UnaryOperator: - return DeserializeUnaryScalarExpression(token, serializer); + return DeserializeUnaryScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.UserDefinedFunctionCall: - return DeserializeUserDefinedFunctionCallScalarExpression(token, serializer); + return DeserializeUserDefinedFunctionCallScalarExpression(cosmosObject); case ClientQLScalarExpressionKind.VariableRef: - return DeserializeVariableRefScalarExpression(token, serializer); + return DeserializeVariableRefScalarExpression(cosmosObject); default: - throw new NotSupportedException($"Invalid ClientQLScalarExpressionKind: {scalarExpressionKind}"); + throw new NotSupportedException($"Invalid ClientQLExpression kind: {scalarExpressionKind}"); } } - private static ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(CosmosObject cosmosObject) { - ClientQLArrayKind arrayKind = GetValue(token, Constants.ArrayKind); - IReadOnlyList vecItems = DeserializeScalarExpressionArray(token[Constants.VecItems], serializer); - - return new ClientQLArrayCreateScalarExpression(arrayKind, vecItems); + GetEnumValue(GetValue(cosmosObject, Constants.ArrayKind).Value, out ClientQLArrayKind arrayKind); + IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); + return new ClientQLArrayCreateScalarExpression(arrayKind, items); } - private static ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); - int index = GetValue(token, Constants.Index); - + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + int index = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.Index).Value); return new ClientQLArrayIndexerScalarExpression(expression, index); } - private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(CosmosObject cosmosObject) { - if (Enum.TryParse(GetValue(token, Constants.OperatorKind), out ClientQLBinaryScalarOperatorKind operatorKind)) - { - int maxDepth = GetValue(token, Constants.MaxDepth); - ClientQLScalarExpression leftExpression = DeserializeScalarExpression(token[Constants.LeftExpression], serializer); - ClientQLScalarExpression rightExpression = DeserializeScalarExpression(token[Constants.RightExpression], serializer); - - return new ClientQLBinaryScalarExpression(operatorKind, maxDepth, leftExpression, rightExpression); - } - else - { - throw new NotSupportedException($"Invalid Binary Operator Expression: {operatorKind}"); - } + GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value, out ClientQLBinaryScalarOperatorKind operatorKind); + bool success = TryGetValue(cosmosObject, Constants.MaxDepth, out CosmosNumber cosmosNumber); + int maxDepth = success ? (int)Number64.ToDouble(cosmosNumber.Value) : default; + ClientQLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); + ClientQLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); + return new ClientQLBinaryScalarExpression(operatorKind, maxDepth, leftExpression, rightExpression); } - private static ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(CosmosObject cosmosObject) { - if (Enum.TryParse(GetValue(token, Constants.OperatorKind), out ClientQLIsOperatorKind operatorKind)) - { - ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); - return new ClientQLIsOperatorScalarExpression(operatorKind, expression); - } - else - { - throw new NotSupportedException($"Invalid Operator Scalar Expression: {operatorKind}"); - } + GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value, out ClientQLIsOperatorKind operatorKind); + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new ClientQLIsOperatorScalarExpression(operatorKind, expression); } - private static ClientQLLetScalarExpression DeserializeLetScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLLetScalarExpression DeserializeLetScalarExpression(CosmosObject cosmosObject) { - ClientQLVariable declaredVariable = DeserializeClientQLVariable(token[Constants.DeclaredVariable]); - ClientQLScalarExpression declaredVariableExpression = DeserializeScalarExpression(token[Constants.DeclaredVariableExpression], serializer); - ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); - + ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + ClientQLScalarExpression declaredVariableExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.DeclaredVariableExpression)); + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); return new ClientQLLetScalarExpression(declaredVariable, declaredVariableExpression, expression); } - private static ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(CosmosObject cosmosObject) { ClientQLLiteral literal = new ClientQLLiteral((ClientQLLiteralKind)ClientQLScalarExpressionKind.Literal); - return new ClientQLLiteralScalarExpression(literal); - } - private static ClientQLMuxScalarExpression DeserializeMuxScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLMuxScalarExpression DeserializeMuxScalarExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression conditionExpression = DeserializeScalarExpression(token[Constants.ConditionExpression], serializer); - ClientQLScalarExpression leftExpression = DeserializeScalarExpression(token[Constants.LeftExpression], serializer); - ClientQLScalarExpression rightExpression = DeserializeScalarExpression(token[Constants.RightExpression], serializer); - + ClientQLScalarExpression conditionExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.ConditionExpression)); + ClientQLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); + ClientQLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); return new ClientQLMuxScalarExpression(conditionExpression, leftExpression, rightExpression); } - private static ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(CosmosObject cosmosObject) { - string objectKindString = GetValue(token, Constants.ObjectKind); - if (!Enum.TryParse(objectKindString, out ClientQLObjectKind objectKind)) - { - throw new NotSupportedException($"Invalid ClientQLObjectKind: {objectKindString}"); - } - - ValidateArrayProperty(token, "Properties"); - IReadOnlyList properties = DeserializeObjectProperties(token[Constants.Properties], serializer); - + GetEnumValue(GetValue(cosmosObject, Constants.ObjectKind).Value, out ClientQLObjectKind objectKind); + IReadOnlyList properties = DeserializeObjectProperties(GetValue(cosmosObject, Constants.Properties)); return new ClientQLObjectCreateScalarExpression(properties, objectKind); } - private static ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); - string propertyName = GetValue(token, Constants.PropertyName); - + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + string propertyName = GetValue(cosmosObject, Constants.PropertyName).Value; return new ClientQLPropertyRefScalarExpression(expression, propertyName); } - private static ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(CosmosObject cosmosObject) { - if (Enum.TryParse(GetValue(token, Constants.FunctionKind), out ClientQLBuiltinScalarFunctionKind functionKind)) - { - IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token[Constants.VecArguments], serializer); - return new ClientQLSystemFunctionCallScalarExpression(functionKind, vecArguments); - } - else - { - throw new NotSupportedException($"Invalid System Function Call Expression: {functionKind}"); - } + GetEnumValue(GetValue(cosmosObject, Constants.FunctionKind).Value, out ClientQLBuiltinScalarFunctionKind functionKind); + IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); + return new ClientQLSystemFunctionCallScalarExpression(functionKind, arguments); } - private static ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(CosmosObject cosmosObject) { - IReadOnlyList vecItems = DeserializeScalarExpressionArray(token[Constants.Items], serializer); + IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); + return new ClientQLTupleCreateScalarExpression(items); + } - return new ClientQLTupleCreateScalarExpression(vecItems); + private static ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(CosmosObject cosmosObject) + { + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + int index = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.Index).Value); + return new ClientQLTupleItemRefScalarExpression(expression, index); } - private static ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); - int index = GetValue(token, Constants.Index); + GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value, out ClientQLUnaryScalarOperatorKind operatorKind); + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new ClientQLUnaryScalarExpression(operatorKind, expression); + } - return new ClientQLTupleItemRefScalarExpression(expression, index); + private static ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(CosmosObject cosmosObject) + { + string identifierString = GetValue(cosmosObject, Constants.Identifier).Value; + ClientQLFunctionIdentifier functionIdentifier = new ClientQLFunctionIdentifier(identifierString); + IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); + bool builtin = GetValue(cosmosObject, Constants.Builtin).Value; + return new ClientQLUserDefinedFunctionCallScalarExpression(functionIdentifier, arguments, builtin); } - private static ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarExpression(CosmosObject cosmosObject) { - if (Enum.TryParse(GetValue(token, Constants.OperatorKind), out ClientQLUnaryScalarOperatorKind operatorKind)) - { - ClientQLScalarExpression expression = DeserializeScalarExpression(token[Constants.Expression], serializer); - return new ClientQLUnaryScalarExpression(operatorKind, expression); - } - else - { - throw new NotSupportedException($"Invalid Unary Scalar Expression: {operatorKind}"); - } + ClientQLVariable variable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.Variable)); + return new ClientQLVariableRefScalarExpression(variable); + } + + private static ClientQLDelegate DeserializeDelegateExpression(CosmosObject cosmosObject) + { + GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value, out ClientQLDelegateKind kind); + ClientQLType type = DeserializeType(GetValue(cosmosObject, Constants.Type)); + return new ClientQLDelegate(kind, type); } - private static ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLType DeserializeType(CosmosObject cosmosObject) { - ClientQLFunctionIdentifier identifier = token[Constants.Identifier].ToObject(serializer); + GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value, out ClientQLTypeKind kind); + return new ClientQLType(kind); + } - ValidateArrayProperty(token, Constants.VecArguments); - IReadOnlyList vecArguments = DeserializeScalarExpressionArray(token[Constants.VecArguments], serializer); - bool builtin = GetValue(token, Constants.Builtin); + private static ClientQLAggregate DeserializeAggregate(CosmosObject cosmosObject) + { + GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value, out ClientQLAggregateKind kind); + string operatorKind = GetValue(cosmosObject, Constants.OperatorKind).Value; - return new ClientQLUserDefinedFunctionCallScalarExpression(identifier, vecArguments, builtin); + return new ClientQLAggregate(kind, operatorKind); } - private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarExpression(JToken token, JsonSerializer serializer) + private static ClientQLVariable DeserializeClientQLVariable(CosmosObject cosmosObject) { - ClientQLVariable variable = DeserializeClientQLVariable(token[Constants.Variable]); + bool success = TryGetValue(cosmosObject, Constants.Name, out CosmosString cosmosString); + string name = success ? cosmosString.Value : default; - return new ClientQLVariableRefScalarExpression(variable); + success = TryGetValue(cosmosObject, Constants.UniqueId, out CosmosNumber cosmosNumber); + int uniqueId = success ? (int)Number64.ToDouble(cosmosNumber.Value) : default; + + return new ClientQLVariable(name, uniqueId); } - private static ClientQLDelegate DeserializeDelegateExpression(JToken token) + private static List DeserializeObjectProperties(CosmosArray cosmosArray) { - if (Enum.TryParse(GetValue(token, Constants.Kind), out ClientQLDelegateKind kind)) - { - ClientQLType type = DeserializeType(token[Constants.Type]); - return new ClientQLDelegate(kind, type); - } - else + List properties = new List(); + foreach (CosmosElement propertyElement in cosmosArray) { - throw new NotSupportedException($"Invalid Delegate Expression: {kind}"); + CosmosObject propertyObject = propertyElement as CosmosObject; + string objectPropertyName = GetValue(propertyObject, Constants.Name).Value; + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); + properties.Add(new ClientQLObjectProperty(objectPropertyName, expression)); } + + return properties; } - private static ClientQLType DeserializeType(JToken token) + private static ClientQLTupleAggregate DeserializeTupleAggregateExpression(CosmosObject cosmosObject) { - if (Enum.TryParse(GetValue(token, Constants.Kind), out ClientQLTypeKind kind)) - { - return new ClientQLType(kind); - } - else + string tupleAggregateKind = GetValue(cosmosObject, Constants.Kind).Value; + List expression = new List(); + foreach (CosmosElement propertyElement in GetValue(cosmosObject, Constants.Items)) { - throw new NotSupportedException($"Invalid Type Expression: {kind}"); + ClientQLAggregate aggregateExpression = DeserializeAggregate((CosmosObject)propertyElement); + expression.Add(aggregateExpression); } + + return new ClientQLTupleAggregate(tupleAggregateKind, expression); } - private static ClientQLAggregate DeserializeAggregate(JToken token) + private static List DeserializeScalarExpressionArray(CosmosArray cosmosArray) { - if (Enum.TryParse(GetValue(token, Constants.Kind), out ClientQLAggregateKind kind)) + List expressions = new List(); + if (cosmosArray != null) { - string operatorKind = null; - if (token[Constants.OperatorKind] != null) + foreach (CosmosElement propertyElement in cosmosArray) { - operatorKind = token[Constants.OperatorKind].ToString(); + ClientQLScalarExpression expression = DeserializeScalarExpression((CosmosObject)propertyElement); + expressions.Add(expression); } - - return new ClientQLAggregate(kind, operatorKind); - } - else - { - throw new NotSupportedException($"Invalid Aggregate Expression: {kind}"); } + return expressions; } - private static ClientQLVariable DeserializeClientQLVariable(JToken token) + private static List DeserializeOrderByItemArray(CosmosArray cosmosArray) { - string name = GetValue(token, Constants.Name); - int uniqueId = GetValue(token, Constants.UniqueId); - - return new ClientQLVariable(name, uniqueId); - } - - private static List DeserializeObjectProperties(JToken token, JsonSerializer serializer) - { - List properties = new List(); - foreach (JToken propertyToken in token) + List expressions = new List(); + if (cosmosArray != null) { - string name = GetValue(propertyToken, Constants.Name); - ClientQLScalarExpression expression = DeserializeScalarExpression(propertyToken[Constants.Expression], serializer); - properties.Add(new ClientQLObjectProperty(name, expression)); + foreach (CosmosElement propertyElement in cosmosArray) + { + CosmosObject propertyObject = (CosmosObject)propertyElement; + GetEnumValue(GetValue(propertyObject, Constants.Kind).Value, out ClientQLScalarExpressionKind kind); + ClientQLScalarExpression scalarExpression = new ClientQLScalarExpression(kind); + expressions.Add(new ClientQLOrderByItem(scalarExpression, ClientQLSortOrder.Ascending)); + } } - return properties; + return expressions; } - private static List DeserializeScalarExpressionArray(JToken token, JsonSerializer serializer) + private static List DeserializeAggregateArray(CosmosArray cosmosArray) { - List properties = new List(); - if (token != null) + List expressions = new List(); + if (cosmosArray != null) { - foreach (JToken propertyToken in token) + foreach (CosmosElement propertyElement in cosmosArray) { - ClientQLScalarExpression expression = DeserializeScalarExpression(propertyToken, serializer); - properties.Add(expression); + ClientQLAggregate aggregateExpression = null; + CosmosObject propertyObject = (CosmosObject)propertyElement; + string kindProperty = GetValue(propertyObject, Constants.Kind).Value; + + if (kindProperty.Equals(Constants.Builtin)) + { + aggregateExpression = DeserializeAggregate((CosmosObject)propertyElement); + } + else if (kindProperty.Equals(Constants.Tuple)) + { + aggregateExpression = DeserializeTupleAggregateExpression((CosmosObject)propertyElement); + } + + expressions.Add(aggregateExpression); } } - return properties; + + return expressions; } - private static T GetValue(JToken token, string expression) + private static T GetValue(CosmosObject cosmosObject, string propertyName) + where T : CosmosElement { - try + bool found = TryGetValue(cosmosObject, propertyName, out T value); + + if (!found) { - return token.Value(expression); + throw new InvalidOperationException($"{GetExceptionMessage()}. The required property {propertyName} was not found in {cosmosObject}"); } - catch (Exception ex) - { - string errorMessage = GetExceptionMessageFormat(); - errorMessage += ex.InnerException; - throw new ArgumentNullException(errorMessage); - } + return value; } - private static void ValidateArrayProperty(JToken token, string property) + private static bool TryGetValue(CosmosObject cosmosObject, string propertyName, out T result) + where T : CosmosElement { - string errorMessage; - if (token[property] == null) + bool found = cosmosObject.TryGetValue(propertyName, out CosmosElement value); + + if (found) { - string nullErrorMessage = $"{property} could not be found in the deserialized plan."; - errorMessage = GetExceptionMessageFormat(); - throw new ArgumentNullException(errorMessage + nullErrorMessage); + result = value as T; + if (result == null) + { + throw new InvalidOperationException($"{GetExceptionMessage()}. The required property {propertyName} was not found in {cosmosObject}"); + } + + return found; } - - if (token[property] is not JArray) + + result = null; + return found; + } + + private static TEnum GetEnumValue(string propertyName, out TEnum result) + where TEnum : struct + { + bool success = Enum.TryParse(propertyName, out TEnum enumValue); + if (!success) { - string arrayErrorMessage = $"{property} is not of type array when it should be."; - errorMessage = GetExceptionMessageFormat(); - throw new ArgumentException(errorMessage + arrayErrorMessage); + throw new InvalidOperationException($"{GetExceptionMessage()}. The string representation of {propertyName} enumerated constant was not able to be converted to an equivalent enumerated object"); } + + result = enumValue; + return result; } - private static string GetExceptionMessageFormat() + private static string GetExceptionMessage() { Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; string clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml index 2eebe9d6d7..454377a812 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml @@ -76,7 +76,7 @@ "UniqueId": 16 }, "Expression": { - "VecItems": [ + "Items": [ { "Expression": { "Variable": { @@ -122,7 +122,23 @@ "OperatorKind": 2, "Expression": { "FunctionKind": 154, - "VecArguments": [], + "Arguments": [ + { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 1, + "Kind": 11 + }, + "Index": 0, + "Kind": 11 + } + ], "Kind": 9 }, "Kind": 12 @@ -153,7 +169,7 @@ "Kind": 6 }, { - "VecItems": [ + "Items": [ { "ConditionExpression": { "OperatorKind": 1, @@ -192,7 +208,27 @@ "OperatorKind": 2, "Expression": { "FunctionKind": 154, - "VecArguments": [], + "Arguments": [ + { + "Expression": { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 2, + "Kind": 11 + }, + "Index": 0, + "Kind": 11 + }, + "Index": 0, + "Kind": 11 + } + ], "Kind": 9 }, "Kind": 12 @@ -274,7 +310,23 @@ "OperatorKind": 2, "Expression": { "FunctionKind": 154, - "VecArguments": [], + "Arguments": [ + { + "Expression": { + "Expression": { + "Variable": { + "Name": "v0", + "UniqueId": 16 + }, + "Kind": 14 + }, + "Index": 3, + "Kind": 11 + }, + "Index": 0, + "Kind": 11 + } + ], "Kind": 9 }, "Kind": 12 @@ -309,8 +361,31 @@ }, "Kind": 7 }, - "VecKeys": null, - "VecAggregates": null, + "KeyCount": 1, + "Aggregates": [ + { + "Kind": 0, + "OperatorKind": "Sum" + }, + { + "Items": [ + { + "Kind": 0, + "OperatorKind": "Sum" + }, + { + "Kind": 0, + "OperatorKind": "Sum" + } + ], + "Kind": 1, + "OperatorKind": "Tuple" + }, + { + "Kind": 0, + "OperatorKind": "Max" + } + ], "Kind": 2 }, "DeclaredVariable": { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs index 1a6e187877..f0f32f4e01 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs @@ -5,6 +5,7 @@ using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan; using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL; using Microsoft.Azure.Cosmos.Test.BaselineTest; + using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; From 98b5c67ac10abccc0ac423c5965d0f0881234f0e Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Fri, 8 Sep 2023 12:54:22 -0700 Subject: [PATCH 19/36] Resolved comments pt3 --- .../ClientQLArrayIndexerScalarExpression.cs | 4 +- .../ClientQLBinaryScalarExpression.cs | 4 +- .../ClientQL/ClientQLCNumberLiteral.cs | 17 + .../ClientQL/ClientQLExpression.cs | 2 +- .../ClientQLGroupByEnumerableExpression.cs | 4 +- .../ClientQLLiteralScalarExpression.cs | 2 +- .../ClientQL/ClientQLMDateTimeLiteral.cs | 4 +- .../ClientQL/ClientQLMJavaScriptLiteral.cs | 6 +- .../ClientQL/ClientQLMNumberLiteral.cs | 4 +- .../ClientQL/ClientQLMRegexLiteral.cs | 20 ++ .../ClientQL/ClientQLMSymbolLiteral.cs | 6 +- .../ClientQL/ClientQLNullLiteral.cs | 14 + .../ClientQL/ClientQLObjectLiteral.cs | 4 +- .../ClientQL/ClientQLObjectLiteralProperty.cs | 6 +- .../ClientQL/ClientQLStringLiteral.cs | 6 +- .../ClientQLTupleItemRefScalarExpression.cs | 4 +- .../ClientQL/ClientQLUndefinedLiteral.cs | 14 + .../ClientQL/ClientQLVariable.cs | 4 +- ...CoordinatorDistributionPlanDeserializer.cs | 291 +++++++++++------- ...dinatorDistributionPlanDeserialization.xml | 62 ++-- 20 files changed, 318 insertions(+), 160 deletions(-) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCNumberLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMRegexLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs index 045a5c3bb8..8c928132d1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLArrayIndexerScalarExpression : ClientQLScalarExpression { - public ClientQLArrayIndexerScalarExpression(ClientQLScalarExpression expression, int index) + public ClientQLArrayIndexerScalarExpression(ClientQLScalarExpression expression, long index) : base(ClientQLScalarExpressionKind.ArrayIndexer) { this.Expression = expression; @@ -15,7 +15,7 @@ public ClientQLArrayIndexerScalarExpression(ClientQLScalarExpression expression, public ClientQLScalarExpression Expression { get; } - public int Index { get; } + public long Index { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs index e0860af181..9e04d0fe3f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBinaryScalarExpression : ClientQLScalarExpression { - public ClientQLBinaryScalarExpression(ClientQLBinaryScalarOperatorKind operatorKind, int maxDepth, ClientQLScalarExpression leftExpression, ClientQLScalarExpression rightExpression) + public ClientQLBinaryScalarExpression(ClientQLBinaryScalarOperatorKind operatorKind, long? maxDepth, ClientQLScalarExpression leftExpression, ClientQLScalarExpression rightExpression) : base(ClientQLScalarExpressionKind.BinaryOperator) { this.OperatorKind = operatorKind; @@ -17,7 +17,7 @@ public ClientQLBinaryScalarExpression(ClientQLBinaryScalarOperatorKind operatorK public ClientQLBinaryScalarOperatorKind OperatorKind { get; } - public int MaxDepth { get; } + public long? MaxDepth { get; } public ClientQLScalarExpression LeftExpression { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCNumberLiteral.cs new file mode 100644 index 0000000000..4ac3f6093d --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCNumberLiteral.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +{ + internal class ClientQLCNumberLiteral : ClientQLLiteral + { + public ClientQLCNumberLiteral(long value) + : base(ClientQLLiteralKind.CNumber) + { + this.Value = value; + } + + public long Value { get; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs index 478d7f4975..c33801d1e2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs @@ -4,7 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - internal class ClientQLExpression + internal abstract class ClientQLExpression { // Decided to keep this empty as it does not provide new information } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs index 6382d42e23..0871c7e176 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs @@ -8,7 +8,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLGroupByEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, int keyCount, IReadOnlyList aggregates) + public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ulong keyCount, IReadOnlyList aggregates) : base(ClientQLEnumerableExpressionKind.GroupBy) { this.SourceExpression = sourceExpression; @@ -18,7 +18,7 @@ public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceEx public ClientQLEnumerableExpression SourceExpression { get; } - public int KeyCount { get; } + public ulong KeyCount { get; } public IReadOnlyList Aggregates { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs index 838baeb436..3148df56c6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLLiteralScalarExpression : ClientQLScalarExpression { public ClientQLLiteralScalarExpression(ClientQLLiteral literal) - : base(ClientQLScalarExpressionKind.Let) + : base(ClientQLScalarExpressionKind.Literal) { this.Literal = literal; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs index 08c906b53a..466db7854a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs @@ -6,12 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMDateTimeLiteral : ClientQLLiteral { - public ClientQLMDateTimeLiteral(int value) + public ClientQLMDateTimeLiteral(long value) : base(ClientQLLiteralKind.MDateTime) { this.Value = value; } - public int Value { get; } + public long Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs index de355477ac..bc65e4a9d1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs @@ -6,12 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMJavaScriptLiteral : ClientQLLiteral { - public ClientQLMJavaScriptLiteral(string strName) + public ClientQLMJavaScriptLiteral(string name) : base(ClientQLLiteralKind.MJavaScript) { - this.StrName = strName; + this.Name = name; } - public string StrName { get; } + public string Name { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs index a5b1bd5d6a..5361731825 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs @@ -6,12 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMNumberLiteral : ClientQLLiteral { - public ClientQLMNumberLiteral(int value) + public ClientQLMNumberLiteral(long value) : base(ClientQLLiteralKind.MNumber) { this.Value = value; } - public int Value { get; } + public long Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMRegexLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMRegexLiteral.cs new file mode 100644 index 0000000000..6b237db511 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMRegexLiteral.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +{ + internal class ClientQLMRegexLiteral : ClientQLLiteral + { + public ClientQLMRegexLiteral(string pattern, string options) + : base(ClientQLLiteralKind.MRegex) + { + this.Pattern = pattern; + this.Options = options; + } + + public string Pattern { get; } + + public string Options { get; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs index 7f730a11e6..27c9da8ddd 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs @@ -6,12 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLMSymbolLiteral : ClientQLLiteral { - public ClientQLMSymbolLiteral(string strValue) + public ClientQLMSymbolLiteral(string value) : base(ClientQLLiteralKind.MSymbol) { - this.StrValue = strValue; + this.Value = value; } - public string StrValue { get; } + public string Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs new file mode 100644 index 0000000000..37836951f8 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +{ + internal class ClientQLNullLiteral : ClientQLLiteral + { + public ClientQLNullLiteral() + : base(ClientQLLiteralKind.Null) + { + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs index b6ad214cc2..f9b89bc861 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs @@ -8,12 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLObjectLiteral : ClientQLLiteral { - public ClientQLObjectLiteral(IReadOnlyList properties) + public ClientQLObjectLiteral(IReadOnlyList properties) : base(ClientQLLiteralKind.Object) { this.Properties = properties; } - public IReadOnlyList Properties { get; } + public IReadOnlyList Properties { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs index 3b569a85cd..44a3240dc0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs @@ -6,13 +6,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLObjectLiteralProperty { - public ClientQLObjectLiteralProperty(string strName, ClientQLLiteral literal) + public ClientQLObjectLiteralProperty(string name, ClientQLLiteral literal) { - this.StrName = strName; + this.Name = name; this.Literal = literal; } - public string StrName { get; } + public string Name { get; } public ClientQLLiteral Literal { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs index 66bedbf81e..54574016a3 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs @@ -6,12 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLStringLiteral : ClientQLLiteral { - public ClientQLStringLiteral(string strValue) + public ClientQLStringLiteral(string value) : base(ClientQLLiteralKind.String) { - this.StrValue = strValue; + this.Value = value; } - public string StrValue { get; } + public string Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs index 65fb2ca3f2..2d2415de95 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLTupleItemRefScalarExpression : ClientQLScalarExpression { - public ClientQLTupleItemRefScalarExpression(ClientQLScalarExpression expression, int index) + public ClientQLTupleItemRefScalarExpression(ClientQLScalarExpression expression, long index) : base(ClientQLScalarExpressionKind.TupleItemRef) { this.Expression = expression; @@ -15,7 +15,7 @@ public ClientQLTupleItemRefScalarExpression(ClientQLScalarExpression expression, public ClientQLScalarExpression Expression { get; } - public int Index { get; } + public long Index { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs new file mode 100644 index 0000000000..b615586203 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs @@ -0,0 +1,14 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +{ + internal class ClientQLUndefinedLiteral : ClientQLLiteral + { + public ClientQLUndefinedLiteral() + : base(ClientQLLiteralKind.Undefined) + { + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs index 4d81df0526..081dd8fda7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLVariable { - public ClientQLVariable(string name, int uniqueId) + public ClientQLVariable(string name, long uniqueId) { this.Name = name; this.UniqueId = uniqueId; @@ -14,6 +14,6 @@ public ClientQLVariable(string name, int uniqueId) public string Name { get; } - public int UniqueId { get; } + public long UniqueId { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index ff8952a7a0..15796ce915 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -14,68 +14,69 @@ internal static class CoordinatorDistributionPlanDeserializer { private static class Constants { + public const string Arguments = "Arguments"; + public const string ArrayKind = "ArrayKind"; public const string Aggregate = "Aggregate"; public const string Aggregates = "Aggregates"; + public const string Builtin = "Builtin"; + public const string ClientQL = "clientQL"; + public const string ConditionExpression = "ConditionExpression"; + public const string CoordinatorDistributionPlan = "coordinatorDistributionPlan"; + public const string DeclaredVariable = "DeclaredVariable"; + public const string DeclaredVariableExpression = "DeclaredVariableExpression"; + public const string Delegate = "Delegate"; public const string Distinct = "Distinct"; - public const string GroupBy = "GroupBy"; + public const string EnumerationKind = "EnumerationKind"; + public const string Expression = "Expression"; public const string Flatten = "Flatten"; + public const string FunctionKind = "FunctionKind"; + public const string GroupBy = "GroupBy"; + public const string Identifier = "Identifier"; + public const string Index = "Index"; public const string Input = "Input"; + public const string Items = "Items"; + public const string KeyCount = "KeyCount"; + public const string Kind = "Kind"; + public const string LeftExpression = "LeftExpression"; + public const string MaxDepth = "MaxDepth"; + public const string Name = "Name"; + public const string ObjectKind = "ObjectKind"; + public const string OperatorKind = "OperatorKind"; public const string OrderBy = "OrderBy"; + public const string Properties = "Properties"; + public const string PropertyName = "PropertyName"; + public const string RightExpression = "RightExpression"; public const string ScalarAsEnumerable = "ScalarAsEnumerable"; public const string Select = "Select"; - public const string SelectMany = "SelectMany"; - public const string Arguments = "Arguments"; - public const string Take = "Take"; - public const string Where = "Where"; - public const string Tuple = "Tuple"; - public const string CoordinatorDistributionPlan = "coordinatorDistributionPlan"; - public const string ClientQL = "clientQL"; - public const string SourceExpression = "SourceExpression"; - public const string DeclaredVariable = "DeclaredVariable"; - public const string EnumerationKind = "EnumerationKind"; public const string SelectorExpression = "SelectorExpression"; + public const string SelectMany = "SelectMany"; public const string SkipValue = "SkipValue"; + public const string SortOrder = "SortOrder"; + public const string SourceExpression = "SourceExpression"; + public const string Take = "Take"; public const string TakeValue = "TakeValue"; - public const string Delegate = "Delegate"; - public const string Kind = "Kind"; - public const string Index = "Index"; - public const string ArrayKind = "ArrayKind"; - public const string Expression = "Expression"; - public const string OperatorKind = "OperatorKind"; - public const string LeftExpression = "LeftExpression"; - public const string RightExpression = "RightExpression"; - public const string MaxDepth = "MaxDepth"; - public const string DeclaredVariableExpression = "DeclaredVariableExpression"; - public const string ConditionExpression = "ConditionExpression"; - public const string Properties = "Properties"; - public const string PropertyName = "PropertyName"; - public const string FunctionKind = "FunctionKind"; - public const string Identifier = "Identifier"; - public const string Builtin = "Builtin"; + public const string Tuple = "Tuple"; public const string Type = "Type"; - public const string KeyCount = "KeyCount"; - public const string Name = "Name"; public const string UniqueId = "UniqueId"; - public const string SortOrder = "SortOrder"; + public const string Value = "Value"; public const string Variable = "Variable"; - public const string ObjectKind = "ObjectKind"; - public const string Items = "Items"; + public const string Where = "Where"; } public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string jsonString) { CosmosObject cosmosObject = CosmosObject.Parse(jsonString); - CosmosElement coordinatorDistributionPlanElement = GetValue(cosmosObject, Constants.CoordinatorDistributionPlan); - CosmosElement clientQLElement = GetValue((CosmosObject)coordinatorDistributionPlanElement, Constants.ClientQL); - ClientQLEnumerableExpression expression = DeserializeClientQLEnumerableExpression((CosmosObject)clientQLElement); + CosmosObject coordinatorDistributionPlanElement = GetValue(cosmosObject, Constants.CoordinatorDistributionPlan); + CosmosObject clientQLElement = GetValue(coordinatorDistributionPlanElement, Constants.ClientQL); + ClientQLEnumerableExpression expression = DeserializeClientQLEnumerableExpression(clientQLElement); return new CoordinatorDistributionPlan(expression); } private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(CosmosObject cosmosObject) { - string kindProperty = GetValue(cosmosObject, Constants.Kind).Value; - switch (kindProperty) + CosmosString kindProperty = GetValue(cosmosObject, Constants.Kind); + switch (kindProperty.Value) { case Constants.Aggregate: return DeserializeAggregateEnumerableExpression(cosmosObject); @@ -100,7 +101,7 @@ private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpress case Constants.Where: return DeserializeWhereEnumerableExpression(cosmosObject); default: - throw new NotSupportedException($"Invalid ClientQLExpression kind: {kindProperty}"); + throw new NotSupportedException($"Invalid ClientQLExpression kind: {kindProperty.Value}"); } } @@ -122,9 +123,9 @@ private static ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerabl private static ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(CosmosObject cosmosObject) { ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - int keyCount = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.KeyCount).Value); + long keyCount = Number64.ToLong(GetValue(cosmosObject, Constants.KeyCount).Value); IReadOnlyList aggregates = DeserializeAggregateArray(GetValue(cosmosObject, Constants.Aggregates)); - return new ClientQLGroupByEnumerableExpression(sourceExpression, keyCount, aggregates); + return new ClientQLGroupByEnumerableExpression(sourceExpression, Convert.ToUInt64(keyCount), aggregates); } private static ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpression(CosmosObject cosmosObject) @@ -149,7 +150,7 @@ private static ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableE private static ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(CosmosObject cosmosObject) { ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - GetEnumValue(GetValue(cosmosObject, Constants.EnumerationKind).Value, out ClientQLEnumerationKind enumerationKind); + ClientQLEnumerationKind enumerationKind = GetEnumValue(GetValue(cosmosObject, Constants.EnumerationKind).Value); return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); } @@ -186,7 +187,7 @@ private static ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpre private static ClientQLScalarExpression DeserializeScalarExpression(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value, out ClientQLScalarExpressionKind scalarExpressionKind); + ClientQLScalarExpressionKind scalarExpressionKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); switch (scalarExpressionKind) { case ClientQLScalarExpressionKind.ArrayCreate: @@ -226,7 +227,7 @@ private static ClientQLScalarExpression DeserializeScalarExpression(CosmosObject private static ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.ArrayKind).Value, out ClientQLArrayKind arrayKind); + ClientQLArrayKind arrayKind = GetEnumValue(GetValue(cosmosObject, Constants.ArrayKind).Value); IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); return new ClientQLArrayCreateScalarExpression(arrayKind, items); } @@ -234,15 +235,15 @@ private static ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarE private static ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(CosmosObject cosmosObject) { ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - int index = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.Index).Value); + long index = Number64.ToLong(GetValue(cosmosObject, Constants.Index).Value); return new ClientQLArrayIndexerScalarExpression(expression, index); } private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value, out ClientQLBinaryScalarOperatorKind operatorKind); + ClientQLBinaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); bool success = TryGetValue(cosmosObject, Constants.MaxDepth, out CosmosNumber cosmosNumber); - int maxDepth = success ? (int)Number64.ToDouble(cosmosNumber.Value) : default; + long? maxDepth = success ? Number64.ToLong(cosmosNumber.Value) : null; ClientQLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); ClientQLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); return new ClientQLBinaryScalarExpression(operatorKind, maxDepth, leftExpression, rightExpression); @@ -250,7 +251,7 @@ private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExp private static ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value, out ClientQLIsOperatorKind operatorKind); + ClientQLIsOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); return new ClientQLIsOperatorScalarExpression(operatorKind, expression); } @@ -265,8 +266,63 @@ private static ClientQLLetScalarExpression DeserializeLetScalarExpression(Cosmos private static ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(CosmosObject cosmosObject) { - ClientQLLiteral literal = new ClientQLLiteral((ClientQLLiteralKind)ClientQLScalarExpressionKind.Literal); - return new ClientQLLiteralScalarExpression(literal); + CosmosObject literalObject = GetValue(cosmosObject, "Literal"); + ClientQLLiteralKind literalKind = GetEnumValue(GetValue(literalObject, Constants.Kind).Value); + switch (literalKind) + { + case ClientQLLiteralKind.Undefined: + ClientQLUndefinedLiteral undefinedLiteral = new ClientQLUndefinedLiteral(); + return new ClientQLLiteralScalarExpression(undefinedLiteral); + case ClientQLLiteralKind.Array: + IReadOnlyList literalExpressions = DeserializeLiteralArray(GetValue(literalObject, Constants.Items)); + return new ClientQLLiteralScalarExpression(new ClientQLArrayLiteral(literalExpressions)); + case ClientQLLiteralKind.Binary: + IReadOnlyList binaryExpressions = DeserializeBinaryArray(GetValue(literalObject, Constants.Value)); + return new ClientQLLiteralScalarExpression(new ClientQLBinaryLiteral(binaryExpressions)); + case ClientQLLiteralKind.Boolean: + ClientQLBooleanLiteral booleanLiteral = new ClientQLBooleanLiteral(GetValue(literalObject, Constants.Value).Value); + return new ClientQLLiteralScalarExpression(booleanLiteral); + case ClientQLLiteralKind.CGuid: + ClientQLCGuidLiteral cGuidLiteral = new ClientQLCGuidLiteral(GetValue(literalObject, Constants.Value).Value); + return new ClientQLLiteralScalarExpression(cGuidLiteral); + case ClientQLLiteralKind.CNumber: + ClientQLCNumberLiteral cNumberLiteral = new ClientQLCNumberLiteral(Number64.ToLong(GetValue(literalObject, Constants.Value).Value)); + return new ClientQLLiteralScalarExpression(cNumberLiteral); + case ClientQLLiteralKind.MDateTime: + ClientQLMDateTimeLiteral mDateTimeLiteral = new ClientQLMDateTimeLiteral(Number64.ToLong(GetValue(literalObject, Constants.Value).Value)); + return new ClientQLLiteralScalarExpression(mDateTimeLiteral); + case ClientQLLiteralKind.MJavaScript: + ClientQLMJavaScriptLiteral mJavaScriptLiteral = new ClientQLMJavaScriptLiteral(GetValue(literalObject, Constants.Name).Value); + return new ClientQLLiteralScalarExpression(mJavaScriptLiteral); + case ClientQLLiteralKind.MNumber: + ClientQLMNumberLiteral mNumberLiteral = new ClientQLMNumberLiteral(Number64.ToLong(GetValue(literalObject, Constants.Value).Value)); + return new ClientQLLiteralScalarExpression(mNumberLiteral); + case ClientQLLiteralKind.MRegex: + string pattern = GetValue(literalObject, "Pattern").Value; + string options = GetValue(literalObject, "Options").Value; + ClientQLMRegexLiteral mRegexLiteral = new ClientQLMRegexLiteral(pattern, options); + return new ClientQLLiteralScalarExpression(mRegexLiteral); + case ClientQLLiteralKind.MSingleton: + ClientQLMSingletonLiteral.Kind functionKind = GetEnumValue(GetValue(literalObject, "SingletonKind").Value); + return new ClientQLLiteralScalarExpression(new ClientQLMSingletonLiteral(functionKind)); + case ClientQLLiteralKind.MSymbol: + ClientQLMSymbolLiteral mSymbolLiteral = new ClientQLMSymbolLiteral(GetValue(literalObject, Constants.Value).Value); + return new ClientQLLiteralScalarExpression(mSymbolLiteral); + case ClientQLLiteralKind.Null: + ClientQLNullLiteral nullLiteral = new ClientQLNullLiteral(); + return new ClientQLLiteralScalarExpression(nullLiteral); + case ClientQLLiteralKind.Number: + ClientQLNumberLiteral numberLiteral = new ClientQLNumberLiteral(Number64.ToLong(GetValue(literalObject, Constants.Value).Value)); + return new ClientQLLiteralScalarExpression(numberLiteral); + case ClientQLLiteralKind.Object: + IReadOnlyList properties = DeserializeObjectLiteralArray(GetValue(literalObject, Constants.Properties)); + return new ClientQLLiteralScalarExpression(new ClientQLObjectLiteral(properties)); + case ClientQLLiteralKind.String: + ClientQLStringLiteral stringLiteral = new ClientQLStringLiteral(GetValue(literalObject, Constants.Value).Value); + return new ClientQLLiteralScalarExpression(stringLiteral); + default: + throw new NotSupportedException($"Invalid ClientQLExpression kind: {literalKind}"); + } } private static ClientQLMuxScalarExpression DeserializeMuxScalarExpression(CosmosObject cosmosObject) @@ -279,7 +335,7 @@ private static ClientQLMuxScalarExpression DeserializeMuxScalarExpression(Cosmos private static ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.ObjectKind).Value, out ClientQLObjectKind objectKind); + ClientQLObjectKind objectKind = GetEnumValue(GetValue(cosmosObject, Constants.ObjectKind).Value); IReadOnlyList properties = DeserializeObjectProperties(GetValue(cosmosObject, Constants.Properties)); return new ClientQLObjectCreateScalarExpression(properties, objectKind); } @@ -293,7 +349,7 @@ private static ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarE private static ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.FunctionKind).Value, out ClientQLBuiltinScalarFunctionKind functionKind); + ClientQLBuiltinScalarFunctionKind functionKind = GetEnumValue(GetValue(cosmosObject, Constants.FunctionKind).Value); IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); return new ClientQLSystemFunctionCallScalarExpression(functionKind, arguments); } @@ -307,13 +363,13 @@ private static ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarE private static ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(CosmosObject cosmosObject) { ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - int index = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.Index).Value); + long index = Number64.ToLong(GetValue(cosmosObject, Constants.Index).Value); return new ClientQLTupleItemRefScalarExpression(expression, index); } private static ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value, out ClientQLUnaryScalarOperatorKind operatorKind); + ClientQLUnaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); return new ClientQLUnaryScalarExpression(operatorKind, expression); } @@ -335,20 +391,20 @@ private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarE private static ClientQLDelegate DeserializeDelegateExpression(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value, out ClientQLDelegateKind kind); + ClientQLDelegateKind kind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); ClientQLType type = DeserializeType(GetValue(cosmosObject, Constants.Type)); return new ClientQLDelegate(kind, type); } private static ClientQLType DeserializeType(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value, out ClientQLTypeKind kind); + ClientQLTypeKind kind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); return new ClientQLType(kind); } private static ClientQLAggregate DeserializeAggregate(CosmosObject cosmosObject) { - GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value, out ClientQLAggregateKind kind); + ClientQLAggregateKind kind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); string operatorKind = GetValue(cosmosObject, Constants.OperatorKind).Value; return new ClientQLAggregate(kind, operatorKind); @@ -356,11 +412,8 @@ private static ClientQLAggregate DeserializeAggregate(CosmosObject cosmosObject) private static ClientQLVariable DeserializeClientQLVariable(CosmosObject cosmosObject) { - bool success = TryGetValue(cosmosObject, Constants.Name, out CosmosString cosmosString); - string name = success ? cosmosString.Value : default; - - success = TryGetValue(cosmosObject, Constants.UniqueId, out CosmosNumber cosmosNumber); - int uniqueId = success ? (int)Number64.ToDouble(cosmosNumber.Value) : default; + string name = GetValue(cosmosObject, Constants.Name).Value; + long uniqueId = Number64.ToLong(GetValue(cosmosObject, Constants.UniqueId).Value); return new ClientQLVariable(name, uniqueId); } @@ -392,59 +445,92 @@ private static ClientQLTupleAggregate DeserializeTupleAggregateExpression(Cosmos return new ClientQLTupleAggregate(tupleAggregateKind, expression); } - private static List DeserializeScalarExpressionArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeScalarExpressionArray(CosmosArray cosmosArray) { List expressions = new List(); - if (cosmosArray != null) + foreach (CosmosElement propertyElement in cosmosArray) { - foreach (CosmosElement propertyElement in cosmosArray) - { - ClientQLScalarExpression expression = DeserializeScalarExpression((CosmosObject)propertyElement); - expressions.Add(expression); - } + ClientQLScalarExpression expression = DeserializeScalarExpression((CosmosObject)propertyElement); + expressions.Add(expression); } + return expressions; } - private static List DeserializeOrderByItemArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeOrderByItemArray(CosmosArray cosmosArray) { List expressions = new List(); - if (cosmosArray != null) + foreach (CosmosElement propertyElement in cosmosArray) { - foreach (CosmosElement propertyElement in cosmosArray) - { - CosmosObject propertyObject = (CosmosObject)propertyElement; - GetEnumValue(GetValue(propertyObject, Constants.Kind).Value, out ClientQLScalarExpressionKind kind); - ClientQLScalarExpression scalarExpression = new ClientQLScalarExpression(kind); - expressions.Add(new ClientQLOrderByItem(scalarExpression, ClientQLSortOrder.Ascending)); - } + CosmosObject propertyObject = (CosmosObject)propertyElement; + ClientQLScalarExpressionKind kind = GetEnumValue(GetValue(propertyObject, Constants.Kind).Value); + ClientQLScalarExpression scalarExpression = new ClientQLScalarExpression(kind); + expressions.Add(new ClientQLOrderByItem(scalarExpression, ClientQLSortOrder.Ascending)); } return expressions; } - private static List DeserializeAggregateArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeAggregateArray(CosmosArray cosmosArray) { List expressions = new List(); - if (cosmosArray != null) + foreach (CosmosElement propertyElement in cosmosArray) { - foreach (CosmosElement propertyElement in cosmosArray) + ClientQLAggregate aggregateExpression = null; + CosmosObject propertyObject = (CosmosObject)propertyElement; + string kindProperty = GetValue(propertyObject, Constants.Kind).Value; + + if (kindProperty.Equals(Constants.Builtin)) { - ClientQLAggregate aggregateExpression = null; - CosmosObject propertyObject = (CosmosObject)propertyElement; - string kindProperty = GetValue(propertyObject, Constants.Kind).Value; - - if (kindProperty.Equals(Constants.Builtin)) - { - aggregateExpression = DeserializeAggregate((CosmosObject)propertyElement); - } - else if (kindProperty.Equals(Constants.Tuple)) - { - aggregateExpression = DeserializeTupleAggregateExpression((CosmosObject)propertyElement); - } - - expressions.Add(aggregateExpression); + aggregateExpression = DeserializeAggregate((CosmosObject)propertyElement); } + else if (kindProperty.Equals(Constants.Tuple)) + { + aggregateExpression = DeserializeTupleAggregateExpression((CosmosObject)propertyElement); + } + + expressions.Add(aggregateExpression); + } + + return expressions; + } + + private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosmosArray) + { + List expressions = new List(); + foreach (CosmosElement propertyElement in cosmosArray) + { + ClientQLLiteralKind kindProperty = GetEnumValue(GetValue((CosmosObject)propertyElement, Constants.Kind).Value); + ClientQLLiteral literal = new ClientQLLiteral(kindProperty); + expressions.Add(literal); + } + + return expressions; + } + + private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) + { + List expressions = new List(); + foreach (CosmosElement propertyElement in cosmosArray) + { + string name = GetValue((CosmosObject)propertyElement, Constants.Name).Value; + ClientQLLiteralKind kindProperty = GetEnumValue(GetValue((CosmosObject)propertyElement, Constants.Kind).Value); + ClientQLLiteral literal = new ClientQLLiteral(kindProperty); + ClientQLObjectLiteralProperty objectLiteralProperty = new ClientQLObjectLiteralProperty(name, literal); + expressions.Add(objectLiteralProperty); + } + + return expressions; + } + + private static IReadOnlyList DeserializeBinaryArray(CosmosArray cosmosArray) + { + List expressions = new List(); + foreach (CosmosElement propertyElement in cosmosArray) + { + ReadOnlyMemory binaryValue = GetValue((CosmosObject)propertyElement, Constants.Kind).Value; + BinaryData data = new BinaryData(binaryValue); + expressions.Add(data); } return expressions; @@ -457,7 +543,7 @@ private static T GetValue(CosmosObject cosmosObject, string propertyName) if (!found) { - throw new InvalidOperationException($"{GetExceptionMessage()}. The required property {propertyName} was not found in {cosmosObject}"); + throw new InvalidOperationException($"{GetExceptionMessage()} The required property {propertyName} was not found in {cosmosObject}"); } return value; @@ -468,31 +554,30 @@ private static bool TryGetValue(CosmosObject cosmosObject, string propertyNam { bool found = cosmosObject.TryGetValue(propertyName, out CosmosElement value); - if (found) + if (found && value != null) { result = value as T; if (result == null) { - throw new InvalidOperationException($"{GetExceptionMessage()}. The required property {propertyName} was not found in {cosmosObject}"); + throw new InvalidOperationException($"{GetExceptionMessage()} Type mismatch for property {propertyName}. Expected {typeof(T)}, Actual {value?.GetType()}"); } return found; } - result = null; + result = default(T); return found; } - private static TEnum GetEnumValue(string propertyName, out TEnum result) + private static TEnum GetEnumValue(string propertyName) where TEnum : struct { - bool success = Enum.TryParse(propertyName, out TEnum enumValue); + bool success = Enum.TryParse(propertyName, out TEnum result); if (!success) { - throw new InvalidOperationException($"{GetExceptionMessage()}. The string representation of {propertyName} enumerated constant was not able to be converted to an equivalent enumerated object"); + throw new InvalidOperationException($"{GetExceptionMessage()} The string representation of {propertyName} enumerated constant was not able to be converted to an equivalent enumerated object"); } - result = enumValue; return result; } @@ -501,7 +586,7 @@ private static string GetExceptionMessage() Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; string clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; - return $"Exception occurred while deserializing query plan. Version : '{clientSDKVersion}', Exception/Reason : '{1}'."; + return $"Exception occurred while deserializing query plan. Version : '{clientSDKVersion}', Exception/Reason : "; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml index 454377a812..3c8ba4e277 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml @@ -91,10 +91,10 @@ { "ConditionExpression": { "OperatorKind": 1, - "MaxDepth": 0, + "MaxDepth": null, "LeftExpression": { "OperatorKind": 14, - "MaxDepth": 0, + "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -112,9 +112,10 @@ }, "RightExpression": { "Literal": { - "Kind": 5 + "Value": 0, + "Kind": 15 }, - "Kind": 4 + "Kind": 5 }, "Kind": 2 }, @@ -147,9 +148,10 @@ }, "LeftExpression": { "Literal": { - "Kind": 5 + "Items": [], + "Kind": 1 }, - "Kind": 4 + "Kind": 5 }, "RightExpression": { "Expression": { @@ -173,10 +175,10 @@ { "ConditionExpression": { "OperatorKind": 1, - "MaxDepth": 0, + "MaxDepth": null, "LeftExpression": { "OperatorKind": 14, - "MaxDepth": 0, + "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -198,9 +200,10 @@ }, "RightExpression": { "Literal": { - "Kind": 5 + "Value": 0, + "Kind": 15 }, - "Kind": 4 + "Kind": 5 }, "Kind": 2 }, @@ -237,9 +240,10 @@ }, "LeftExpression": { "Literal": { - "Kind": 5 + "Items": [], + "Kind": 1 }, - "Kind": 4 + "Kind": 5 }, "RightExpression": { "Expression": { @@ -279,10 +283,10 @@ { "ConditionExpression": { "OperatorKind": 1, - "MaxDepth": 0, + "MaxDepth": null, "LeftExpression": { "OperatorKind": 14, - "MaxDepth": 0, + "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -300,9 +304,10 @@ }, "RightExpression": { "Literal": { - "Kind": 5 + "Value": 0, + "Kind": 15 }, - "Kind": 4 + "Kind": 5 }, "Kind": 2 }, @@ -335,9 +340,10 @@ }, "LeftExpression": { "Literal": { - "Kind": 5 + "Items": [], + "Kind": 1 }, - "Kind": 4 + "Kind": 5 }, "RightExpression": { "Expression": { @@ -431,7 +437,7 @@ "Expression": { "ConditionExpression": { "OperatorKind": 6, - "MaxDepth": 0, + "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -449,21 +455,22 @@ }, "RightExpression": { "Literal": { - "Kind": 5 + "Value": 0, + "Kind": 15 }, - "Kind": 4 + "Kind": 5 }, "Kind": 2 }, "LeftExpression": { "Literal": { - "Kind": 5 + "Kind": 0 }, - "Kind": 4 + "Kind": 5 }, "RightExpression": { "OperatorKind": 5, - "MaxDepth": 0, + "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -579,7 +586,7 @@ "Name": "count_a_plus_five", "Expression": { "OperatorKind": 0, - "MaxDepth": 0, + "MaxDepth": null, "LeftExpression": { "Variable": { "Name": "v0", @@ -589,9 +596,10 @@ }, "RightExpression": { "Literal": { - "Kind": 5 + "Value": 5, + "Kind": 15 }, - "Kind": 4 + "Kind": 5 }, "Kind": 2 } From 5d2d306e99d83db11182f0555c23b0f2acf9feba Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Fri, 8 Sep 2023 13:50:24 -0700 Subject: [PATCH 20/36] Changed parameter types from int to long --- .../ClientQL/ClientQLFunctionIdentifier.cs | 6 +++--- .../ClientQL/ClientQLILMRegexLiteral.cs | 20 ------------------- .../ClientQLTakeEnumerableExpression.cs | 6 +++--- ...CoordinatorDistributionPlanDeserializer.cs | 6 +++--- 4 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs index c0ac9c772c..03da12f4c3 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs @@ -6,11 +6,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLFunctionIdentifier { - public ClientQLFunctionIdentifier(string strName) + public ClientQLFunctionIdentifier(string name) { - this.StrName = strName; + this.Name = name; } - public string StrName { get; } + public string Name { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs deleted file mode 100644 index d17817ea1d..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLILMRegexLiteral.cs +++ /dev/null @@ -1,20 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLILMRegexLiteral : ClientQLLiteral - { - public ClientQLILMRegexLiteral(string strPatter, string strOption) - : base(ClientQLLiteralKind.MRegex) - { - this.StrPatter = strPatter; - this.StrOption = strOption; - } - - public string StrPatter { get; } - - public string StrOption { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs index 9b2ffb8b5f..11f1c940ed 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLTakeEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLTakeEnumerableExpression(ClientQLEnumerableExpression sourceExpression, int skipValue, int takeValue) + public ClientQLTakeEnumerableExpression(ClientQLEnumerableExpression sourceExpression, long skipValue, long takeValue) : base(ClientQLEnumerableExpressionKind.Take) { this.SourceExpression = sourceExpression; @@ -16,9 +16,9 @@ public ClientQLTakeEnumerableExpression(ClientQLEnumerableExpression sourceExpre public ClientQLEnumerableExpression SourceExpression { get; } - public int SkipValue { get; } + public long SkipValue { get; } - public int TakeValue { get; } + public long TakeValue { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 15796ce915..1397df2bb1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -173,8 +173,8 @@ private static ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpre private static ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(CosmosObject cosmosObject) { ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - int skipValue = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.SkipValue).Value); - int takeExpression = (int)Number64.ToDouble(GetValue(cosmosObject, Constants.TakeValue).Value); + long skipValue = Number64.ToLong(GetValue(cosmosObject, Constants.SkipValue).Value); + long takeExpression = Number64.ToLong(GetValue(cosmosObject, Constants.TakeValue).Value); return new ClientQLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); } @@ -418,7 +418,7 @@ private static ClientQLVariable DeserializeClientQLVariable(CosmosObject cosmosO return new ClientQLVariable(name, uniqueId); } - private static List DeserializeObjectProperties(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeObjectProperties(CosmosArray cosmosArray) { List properties = new List(); foreach (CosmosElement propertyElement in cosmosArray) From 020c39b664c6f51689aa8a351a4e67e6fad9116b Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 11 Sep 2023 17:44:28 -0700 Subject: [PATCH 21/36] Removed ClientQLDelegate --- .../ClientQLBinaryScalarExpression.cs | 6 +- .../ClientQL/ClientQLDelegate.cs | 19 --- .../ClientQL/ClientQLDelegateKind.cs | 11 -- .../ClientQL/ClientQLNullLiteral.cs | 2 + .../ClientQLScalarExpressionDelegate.cs | 20 --- .../ClientQL/ClientQLUndefinedLiteral.cs | 2 + .../ClientQLWhereEnumerableExpression.cs | 5 +- ...CoordinatorDistributionPlanDeserializer.cs | 138 ++++++++---------- ...dinatorDistributionPlanDeserialization.xml | 9 -- 9 files changed, 70 insertions(+), 142 deletions(-) delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs index 9e04d0fe3f..f30c23827c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs @@ -6,22 +6,18 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBinaryScalarExpression : ClientQLScalarExpression { - public ClientQLBinaryScalarExpression(ClientQLBinaryScalarOperatorKind operatorKind, long? maxDepth, ClientQLScalarExpression leftExpression, ClientQLScalarExpression rightExpression) + public ClientQLBinaryScalarExpression(ClientQLBinaryScalarOperatorKind operatorKind, ClientQLScalarExpression leftExpression, ClientQLScalarExpression rightExpression) : base(ClientQLScalarExpressionKind.BinaryOperator) { this.OperatorKind = operatorKind; - this.MaxDepth = maxDepth; this.LeftExpression = leftExpression; this.RightExpression = rightExpression; } public ClientQLBinaryScalarOperatorKind OperatorKind { get; } - public long? MaxDepth { get; } - public ClientQLScalarExpression LeftExpression { get; } public ClientQLScalarExpression RightExpression { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs deleted file mode 100644 index a2ca8d378e..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegate.cs +++ /dev/null @@ -1,19 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLDelegate - { - public ClientQLDelegate(ClientQLDelegateKind kind, ClientQLType type) - { - this.Kind = kind; - this.Type = type; - } - - public ClientQLDelegateKind Kind { get; } - - public ClientQLType Type { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs deleted file mode 100644 index 58c605788f..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDelegateKind.cs +++ /dev/null @@ -1,11 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal enum ClientQLDelegateKind - { - ScalarExpression, - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs index 37836951f8..d928290638 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLNullLiteral : ClientQLLiteral { + public static readonly ClientQLNullLiteral Singleton = new ClientQLNullLiteral(); + public ClientQLNullLiteral() : base(ClientQLLiteralKind.Null) { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs deleted file mode 100644 index 456f336e3d..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionDelegate.cs +++ /dev/null @@ -1,20 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLScalarExpressionDelegate : ClientQLDelegate - { - public ClientQLScalarExpressionDelegate(ClientQLType type, ClientQLVariable declaredVariable, ClientQLScalarExpression expression) - : base(ClientQLDelegateKind.ScalarExpression, type) - { - this.DeclaredVariable = declaredVariable; - this.Expression = expression; - } - - public ClientQLVariable DeclaredVariable { get; } - - public ClientQLScalarExpression Expression { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs index b615586203..8c7e81215d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs @@ -6,6 +6,8 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLUndefinedLiteral : ClientQLLiteral { + public static readonly ClientQLUndefinedLiteral Singleton = new ClientQLUndefinedLiteral(); + public ClientQLUndefinedLiteral() : base(ClientQLLiteralKind.Undefined) { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs index e6856f2d6e..a9f4fce5ab 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs @@ -6,16 +6,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLWhereEnumerableExpression : ClientQLEnumerableExpression { - public ClientQLWhereEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLDelegate clientQLDelegate) + public ClientQLWhereEnumerableExpression(ClientQLEnumerableExpression sourceExpression) : base(ClientQLEnumerableExpressionKind.Where) { this.SourceExpression = sourceExpression; - this.Delegate = clientQLDelegate; } public ClientQLEnumerableExpression SourceExpression { get; } - - public ClientQLDelegate Delegate { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 1397df2bb1..fad7c5a421 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -28,7 +28,6 @@ private static class Constants public const string Distinct = "Distinct"; public const string EnumerationKind = "EnumerationKind"; public const string Expression = "Expression"; - public const string Flatten = "Flatten"; public const string FunctionKind = "FunctionKind"; public const string GroupBy = "GroupBy"; public const string Identifier = "Identifier"; @@ -38,6 +37,7 @@ private static class Constants public const string KeyCount = "KeyCount"; public const string Kind = "Kind"; public const string LeftExpression = "LeftExpression"; + public const string Literal = "Literal"; public const string MaxDepth = "MaxDepth"; public const string Name = "Name"; public const string ObjectKind = "ObjectKind"; @@ -72,6 +72,8 @@ public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan return new CoordinatorDistributionPlan(expression); } + + // Deserialize Enumerable Expressions private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(CosmosObject cosmosObject) { @@ -84,8 +86,6 @@ private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpress return DeserializeDistinctEnumerableExpression(cosmosObject); case Constants.GroupBy: return DeserializeGroupByEnumerableExpression(cosmosObject); - case Constants.Flatten: - return DeserializeFlattenEnumerableExpression(cosmosObject); case Constants.Input: return DeserializeInputEnumerableExpression(cosmosObject); case Constants.OrderBy: @@ -128,12 +128,6 @@ private static ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableE return new ClientQLGroupByEnumerableExpression(sourceExpression, Convert.ToUInt64(keyCount), aggregates); } - private static ClientQLFlattenEnumerableExpression DeserializeFlattenEnumerableExpression(CosmosObject cosmosObject) - { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - return new ClientQLFlattenEnumerableExpression(sourceExpression); - } - private static ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(CosmosObject cosmosObject) { return new ClientQLInputEnumerableExpression(GetValue(cosmosObject, Constants.Name).Value); @@ -181,10 +175,11 @@ private static ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpress private static ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(CosmosObject cosmosObject) { ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - ClientQLDelegate clientDelegate = DeserializeDelegateExpression(GetValue(cosmosObject, Constants.Delegate)); - return new ClientQLWhereEnumerableExpression(sourceExpression, clientDelegate); + return new ClientQLWhereEnumerableExpression(sourceExpression); } + // Deserialize Scalar Expressions + private static ClientQLScalarExpression DeserializeScalarExpression(CosmosObject cosmosObject) { ClientQLScalarExpressionKind scalarExpressionKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); @@ -242,11 +237,9 @@ private static ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScala private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(CosmosObject cosmosObject) { ClientQLBinaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - bool success = TryGetValue(cosmosObject, Constants.MaxDepth, out CosmosNumber cosmosNumber); - long? maxDepth = success ? Number64.ToLong(cosmosNumber.Value) : null; ClientQLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); ClientQLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); - return new ClientQLBinaryScalarExpression(operatorKind, maxDepth, leftExpression, rightExpression); + return new ClientQLBinaryScalarExpression(operatorKind, leftExpression, rightExpression); } private static ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(CosmosObject cosmosObject) @@ -266,60 +259,50 @@ private static ClientQLLetScalarExpression DeserializeLetScalarExpression(Cosmos private static ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(CosmosObject cosmosObject) { - CosmosObject literalObject = GetValue(cosmosObject, "Literal"); + CosmosObject literalObject = GetValue(cosmosObject, Constants.Literal); ClientQLLiteralKind literalKind = GetEnumValue(GetValue(literalObject, Constants.Kind).Value); + return new ClientQLLiteralScalarExpression(DeserializeClientQLLiteral(literalObject, literalKind)); + } + + private static ClientQLLiteral DeserializeClientQLLiteral(CosmosObject cosmosObject, ClientQLLiteralKind literalKind) + { switch (literalKind) { case ClientQLLiteralKind.Undefined: - ClientQLUndefinedLiteral undefinedLiteral = new ClientQLUndefinedLiteral(); - return new ClientQLLiteralScalarExpression(undefinedLiteral); + return ClientQLUndefinedLiteral.Singleton; case ClientQLLiteralKind.Array: - IReadOnlyList literalExpressions = DeserializeLiteralArray(GetValue(literalObject, Constants.Items)); - return new ClientQLLiteralScalarExpression(new ClientQLArrayLiteral(literalExpressions)); + return new ClientQLArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); case ClientQLLiteralKind.Binary: - IReadOnlyList binaryExpressions = DeserializeBinaryArray(GetValue(literalObject, Constants.Value)); - return new ClientQLLiteralScalarExpression(new ClientQLBinaryLiteral(binaryExpressions)); + return new ClientQLBinaryLiteral(DeserializeBinaryArray(GetValue(cosmosObject, Constants.Value))); case ClientQLLiteralKind.Boolean: - ClientQLBooleanLiteral booleanLiteral = new ClientQLBooleanLiteral(GetValue(literalObject, Constants.Value).Value); - return new ClientQLLiteralScalarExpression(booleanLiteral); + ClientQLBooleanLiteral booleanLiteral = new ClientQLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); + return booleanLiteral; case ClientQLLiteralKind.CGuid: - ClientQLCGuidLiteral cGuidLiteral = new ClientQLCGuidLiteral(GetValue(literalObject, Constants.Value).Value); - return new ClientQLLiteralScalarExpression(cGuidLiteral); + return new ClientQLCGuidLiteral(GetValue(cosmosObject, Constants.Value).Value); case ClientQLLiteralKind.CNumber: - ClientQLCNumberLiteral cNumberLiteral = new ClientQLCNumberLiteral(Number64.ToLong(GetValue(literalObject, Constants.Value).Value)); - return new ClientQLLiteralScalarExpression(cNumberLiteral); + return new ClientQLCNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); case ClientQLLiteralKind.MDateTime: - ClientQLMDateTimeLiteral mDateTimeLiteral = new ClientQLMDateTimeLiteral(Number64.ToLong(GetValue(literalObject, Constants.Value).Value)); - return new ClientQLLiteralScalarExpression(mDateTimeLiteral); + return new ClientQLMDateTimeLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); case ClientQLLiteralKind.MJavaScript: - ClientQLMJavaScriptLiteral mJavaScriptLiteral = new ClientQLMJavaScriptLiteral(GetValue(literalObject, Constants.Name).Value); - return new ClientQLLiteralScalarExpression(mJavaScriptLiteral); + return new ClientQLMJavaScriptLiteral(GetValue(cosmosObject, Constants.Name).Value); case ClientQLLiteralKind.MNumber: - ClientQLMNumberLiteral mNumberLiteral = new ClientQLMNumberLiteral(Number64.ToLong(GetValue(literalObject, Constants.Value).Value)); - return new ClientQLLiteralScalarExpression(mNumberLiteral); + return new ClientQLMNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); case ClientQLLiteralKind.MRegex: - string pattern = GetValue(literalObject, "Pattern").Value; - string options = GetValue(literalObject, "Options").Value; - ClientQLMRegexLiteral mRegexLiteral = new ClientQLMRegexLiteral(pattern, options); - return new ClientQLLiteralScalarExpression(mRegexLiteral); + string pattern = GetValue(cosmosObject, "Pattern").Value; + string options = GetValue(cosmosObject, "Options").Value; + return new ClientQLMRegexLiteral(pattern, options); case ClientQLLiteralKind.MSingleton: - ClientQLMSingletonLiteral.Kind functionKind = GetEnumValue(GetValue(literalObject, "SingletonKind").Value); - return new ClientQLLiteralScalarExpression(new ClientQLMSingletonLiteral(functionKind)); + return new ClientQLMSingletonLiteral(GetEnumValue(GetValue(cosmosObject, "SingletonKind").Value)); case ClientQLLiteralKind.MSymbol: - ClientQLMSymbolLiteral mSymbolLiteral = new ClientQLMSymbolLiteral(GetValue(literalObject, Constants.Value).Value); - return new ClientQLLiteralScalarExpression(mSymbolLiteral); + return new ClientQLMSymbolLiteral(GetValue(cosmosObject, Constants.Value).Value); case ClientQLLiteralKind.Null: - ClientQLNullLiteral nullLiteral = new ClientQLNullLiteral(); - return new ClientQLLiteralScalarExpression(nullLiteral); + return ClientQLNullLiteral.Singleton; case ClientQLLiteralKind.Number: - ClientQLNumberLiteral numberLiteral = new ClientQLNumberLiteral(Number64.ToLong(GetValue(literalObject, Constants.Value).Value)); - return new ClientQLLiteralScalarExpression(numberLiteral); + return new ClientQLNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); case ClientQLLiteralKind.Object: - IReadOnlyList properties = DeserializeObjectLiteralArray(GetValue(literalObject, Constants.Properties)); - return new ClientQLLiteralScalarExpression(new ClientQLObjectLiteral(properties)); + return new ClientQLObjectLiteral(DeserializeObjectLiteralArray(GetValue(cosmosObject, Constants.Properties))); case ClientQLLiteralKind.String: - ClientQLStringLiteral stringLiteral = new ClientQLStringLiteral(GetValue(literalObject, Constants.Value).Value); - return new ClientQLLiteralScalarExpression(stringLiteral); + return new ClientQLStringLiteral(GetValue(cosmosObject, Constants.Value).Value); default: throw new NotSupportedException($"Invalid ClientQLExpression kind: {literalKind}"); } @@ -389,18 +372,7 @@ private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarE return new ClientQLVariableRefScalarExpression(variable); } - private static ClientQLDelegate DeserializeDelegateExpression(CosmosObject cosmosObject) - { - ClientQLDelegateKind kind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); - ClientQLType type = DeserializeType(GetValue(cosmosObject, Constants.Type)); - return new ClientQLDelegate(kind, type); - } - - private static ClientQLType DeserializeType(CosmosObject cosmosObject) - { - ClientQLTypeKind kind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); - return new ClientQLType(kind); - } + // Helper Functions for Deserialization private static ClientQLAggregate DeserializeAggregate(CosmosObject cosmosObject) { @@ -423,7 +395,7 @@ private static IReadOnlyList DeserializeObjectProperties List properties = new List(); foreach (CosmosElement propertyElement in cosmosArray) { - CosmosObject propertyObject = propertyElement as CosmosObject; + CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); string objectPropertyName = GetValue(propertyObject, Constants.Name).Value; ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); properties.Add(new ClientQLObjectProperty(objectPropertyName, expression)); @@ -438,7 +410,8 @@ private static ClientQLTupleAggregate DeserializeTupleAggregateExpression(Cosmos List expression = new List(); foreach (CosmosElement propertyElement in GetValue(cosmosObject, Constants.Items)) { - ClientQLAggregate aggregateExpression = DeserializeAggregate((CosmosObject)propertyElement); + CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); + ClientQLAggregate aggregateExpression = DeserializeAggregate(propertyObject); expression.Add(aggregateExpression); } @@ -450,7 +423,8 @@ private static IReadOnlyList DeserializeScalarExpressi List expressions = new List(); foreach (CosmosElement propertyElement in cosmosArray) { - ClientQLScalarExpression expression = DeserializeScalarExpression((CosmosObject)propertyElement); + CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); + ClientQLScalarExpression expression = DeserializeScalarExpression(propertyObject); expressions.Add(expression); } @@ -462,7 +436,7 @@ private static IReadOnlyList DeserializeOrderByItemArray(Co List expressions = new List(); foreach (CosmosElement propertyElement in cosmosArray) { - CosmosObject propertyObject = (CosmosObject)propertyElement; + CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); ClientQLScalarExpressionKind kind = GetEnumValue(GetValue(propertyObject, Constants.Kind).Value); ClientQLScalarExpression scalarExpression = new ClientQLScalarExpression(kind); expressions.Add(new ClientQLOrderByItem(scalarExpression, ClientQLSortOrder.Ascending)); @@ -477,16 +451,16 @@ private static IReadOnlyList DeserializeAggregateArray(Cosmos foreach (CosmosElement propertyElement in cosmosArray) { ClientQLAggregate aggregateExpression = null; - CosmosObject propertyObject = (CosmosObject)propertyElement; + CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); string kindProperty = GetValue(propertyObject, Constants.Kind).Value; if (kindProperty.Equals(Constants.Builtin)) { - aggregateExpression = DeserializeAggregate((CosmosObject)propertyElement); + aggregateExpression = DeserializeAggregate(propertyObject); } else if (kindProperty.Equals(Constants.Tuple)) { - aggregateExpression = DeserializeTupleAggregateExpression((CosmosObject)propertyElement); + aggregateExpression = DeserializeTupleAggregateExpression(propertyObject); } expressions.Add(aggregateExpression); @@ -499,8 +473,9 @@ private static IReadOnlyList DeserializeLiteralArray(CosmosArra { List expressions = new List(); foreach (CosmosElement propertyElement in cosmosArray) - { - ClientQLLiteralKind kindProperty = GetEnumValue(GetValue((CosmosObject)propertyElement, Constants.Kind).Value); + { + CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); + ClientQLLiteralKind kindProperty = GetEnumValue(GetValue(propertyObject, Constants.Kind).Value); ClientQLLiteral literal = new ClientQLLiteral(kindProperty); expressions.Add(literal); } @@ -513,8 +488,9 @@ private static IReadOnlyList DeserializeObjectLit List expressions = new List(); foreach (CosmosElement propertyElement in cosmosArray) { - string name = GetValue((CosmosObject)propertyElement, Constants.Name).Value; - ClientQLLiteralKind kindProperty = GetEnumValue(GetValue((CosmosObject)propertyElement, Constants.Kind).Value); + CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); + string name = GetValue(propertyObject, Constants.Name).Value; + ClientQLLiteralKind kindProperty = GetEnumValue(GetValue(propertyObject, Constants.Kind).Value); ClientQLLiteral literal = new ClientQLLiteral(kindProperty); ClientQLObjectLiteralProperty objectLiteralProperty = new ClientQLObjectLiteralProperty(name, literal); expressions.Add(objectLiteralProperty); @@ -528,7 +504,8 @@ private static IReadOnlyList DeserializeBinaryArray(CosmosArray cosm List expressions = new List(); foreach (CosmosElement propertyElement in cosmosArray) { - ReadOnlyMemory binaryValue = GetValue((CosmosObject)propertyElement, Constants.Kind).Value; + CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); + ReadOnlyMemory binaryValue = GetValue(propertyObject, Constants.Kind).Value; BinaryData data = new BinaryData(binaryValue); expressions.Add(data); } @@ -585,8 +562,21 @@ private static string GetExceptionMessage() { Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; string clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; - + return $"Exception occurred while deserializing query plan. Version : '{clientSDKVersion}', Exception/Reason : "; } + + private static CosmosObject ConvertToCosmosObject(CosmosElement cosmosElement) + { + CosmosObject propertyObject = cosmosElement as CosmosObject; + if (propertyObject != null) + { + return propertyObject; + } + else + { + throw new InvalidOperationException("Unable to cast CosmosElement to CosmosObject."); + } + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml index 3c8ba4e277..c7924566ac 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml @@ -91,10 +91,8 @@ { "ConditionExpression": { "OperatorKind": 1, - "MaxDepth": null, "LeftExpression": { "OperatorKind": 14, - "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -175,10 +173,8 @@ { "ConditionExpression": { "OperatorKind": 1, - "MaxDepth": null, "LeftExpression": { "OperatorKind": 14, - "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -283,10 +279,8 @@ { "ConditionExpression": { "OperatorKind": 1, - "MaxDepth": null, "LeftExpression": { "OperatorKind": 14, - "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -437,7 +431,6 @@ "Expression": { "ConditionExpression": { "OperatorKind": 6, - "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -470,7 +463,6 @@ }, "RightExpression": { "OperatorKind": 5, - "MaxDepth": null, "LeftExpression": { "Expression": { "Expression": { @@ -586,7 +578,6 @@ "Name": "count_a_plus_five", "Expression": { "OperatorKind": 0, - "MaxDepth": null, "LeftExpression": { "Variable": { "Name": "v0", From 563b98e1203ce43577ad0b88b4c5dd47e4093662 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 11 Sep 2023 17:52:52 -0700 Subject: [PATCH 22/36] Syntax Fixes --- .../CoordinatorDistributionPlanDeserializer.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index fad7c5a421..19618ce592 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -42,7 +42,9 @@ private static class Constants public const string Name = "Name"; public const string ObjectKind = "ObjectKind"; public const string OperatorKind = "OperatorKind"; + public const string Options = "Options"; public const string OrderBy = "OrderBy"; + public const string Pattern = "Pattern"; public const string Properties = "Properties"; public const string PropertyName = "PropertyName"; public const string RightExpression = "RightExpression"; @@ -50,6 +52,7 @@ private static class Constants public const string Select = "Select"; public const string SelectorExpression = "SelectorExpression"; public const string SelectMany = "SelectMany"; + public const string SingletonKind = "SingletonKind"; public const string SkipValue = "SkipValue"; public const string SortOrder = "SortOrder"; public const string SourceExpression = "SourceExpression"; @@ -275,8 +278,7 @@ private static ClientQLLiteral DeserializeClientQLLiteral(CosmosObject cosmosObj case ClientQLLiteralKind.Binary: return new ClientQLBinaryLiteral(DeserializeBinaryArray(GetValue(cosmosObject, Constants.Value))); case ClientQLLiteralKind.Boolean: - ClientQLBooleanLiteral booleanLiteral = new ClientQLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); - return booleanLiteral; + return new ClientQLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); case ClientQLLiteralKind.CGuid: return new ClientQLCGuidLiteral(GetValue(cosmosObject, Constants.Value).Value); case ClientQLLiteralKind.CNumber: @@ -288,11 +290,11 @@ private static ClientQLLiteral DeserializeClientQLLiteral(CosmosObject cosmosObj case ClientQLLiteralKind.MNumber: return new ClientQLMNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); case ClientQLLiteralKind.MRegex: - string pattern = GetValue(cosmosObject, "Pattern").Value; - string options = GetValue(cosmosObject, "Options").Value; + string pattern = GetValue(cosmosObject, Constants.Pattern).Value; + string options = GetValue(cosmosObject, Constants.Options).Value; return new ClientQLMRegexLiteral(pattern, options); case ClientQLLiteralKind.MSingleton: - return new ClientQLMSingletonLiteral(GetEnumValue(GetValue(cosmosObject, "SingletonKind").Value)); + return new ClientQLMSingletonLiteral(GetEnumValue(GetValue(cosmosObject, Constants.SingletonKind).Value)); case ClientQLLiteralKind.MSymbol: return new ClientQLMSymbolLiteral(GetValue(cosmosObject, Constants.Value).Value); case ClientQLLiteralKind.Null: From d4f97917a53c4b6dbf2cb1e993daafcfda791aa5 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 12 Sep 2023 15:30:11 -0700 Subject: [PATCH 23/36] Removed ClientQLFlattenEnumerable file. This is JS. --- .../ClientQLFlattenEnumerableExpression.cs | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs deleted file mode 100644 index 653e32659a..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFlattenEnumerableExpression.cs +++ /dev/null @@ -1,18 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLFlattenEnumerableExpression : ClientQLEnumerableExpression - { - public ClientQLFlattenEnumerableExpression(ClientQLEnumerableExpression sourceExpression) - : base(ClientQLEnumerableExpressionKind.Flatten) - { - this.SourceExpression = sourceExpression; - } - - public ClientQLEnumerableExpression SourceExpression { get; } - } - -} \ No newline at end of file From ab5f029b7788d97872bdfb96549a2ec57d4bd907 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 12 Sep 2023 23:37:22 -0700 Subject: [PATCH 24/36] Fixed List helper functions --- .../ClientQL/ClientQLAggregate.cs | 7 +- .../ClientQL/ClientQLAggregateSignature.cs | 19 -- .../ClientQL/ClientQLBuiltinAggregate.cs | 8 +- .../ClientQL/ClientQLEnumerableExpression.cs | 2 +- .../ClientQL/ClientQLLiteral.cs | 2 +- .../ClientQL/ClientQLScalarExpression.cs | 2 +- .../ClientQL/ClientQLTupleAggregate.cs | 4 +- .../ClientQL/ClientQLType.cs | 2 +- ...CoordinatorDistributionPlanDeserializer.cs | 178 +++++++++--------- ...dinatorDistributionPlanDeserialization.xml | 27 ++- 10 files changed, 113 insertions(+), 138 deletions(-) delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs index dca6a9480a..54fa7b3c0a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs @@ -4,16 +4,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - internal class ClientQLAggregate + internal abstract class ClientQLAggregate { - public ClientQLAggregate(ClientQLAggregateKind kind, string operatorKind) + public ClientQLAggregate(ClientQLAggregateKind kind) { this.Kind = kind; - this.OperatorKind = operatorKind; } public ClientQLAggregateKind Kind { get; } - - public string OperatorKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs deleted file mode 100644 index c900e6b515..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateSignature.cs +++ /dev/null @@ -1,19 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLAggregateSignature - { - public ClientQLAggregateSignature(ClientQLTypeKind itemType, ClientQLTypeKind resultType) - { - this.ItemType = itemType; - this.ResultType = resultType; - } - - public ClientQLTypeKind ItemType { get; } - - public ClientQLTypeKind ResultType { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs index 8dbc42ea75..bdb40aaac2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs @@ -6,12 +6,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { internal class ClientQLBuiltinAggregate : ClientQLAggregate { - public ClientQLBuiltinAggregate(string operatorKind, ClientQLAggregateOperatorKind aggregateOperatorKind) - : base(ClientQLAggregateKind.Builtin, operatorKind) + public ClientQLBuiltinAggregate(ClientQLAggregateOperatorKind operatorKind) + : base(ClientQLAggregateKind.Builtin) { - this.AggregateOperatorKind = aggregateOperatorKind; + this.OperatorKind = operatorKind; } - public ClientQLAggregateOperatorKind AggregateOperatorKind { get; } + public ClientQLAggregateOperatorKind OperatorKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs index c2ed7305c7..ef8a2c744c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs @@ -4,7 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - internal class ClientQLEnumerableExpression : ClientQLExpression + internal abstract class ClientQLEnumerableExpression : ClientQLExpression { public ClientQLEnumerableExpression(ClientQLEnumerableExpressionKind kind) { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs index 02bf828c50..ad1b945d99 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs @@ -4,7 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - internal class ClientQLLiteral + internal abstract class ClientQLLiteral { public ClientQLLiteral(ClientQLLiteralKind kind) { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs index e0299827cf..4896ded0bf 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs @@ -4,7 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - internal class ClientQLScalarExpression : ClientQLExpression + internal abstract class ClientQLScalarExpression : ClientQLExpression { public ClientQLScalarExpression(ClientQLScalarExpressionKind kind) { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs index 821ba52e36..d59e060ff4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs @@ -8,8 +8,8 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLTupleAggregate : ClientQLAggregate { - public ClientQLTupleAggregate(string operatorKind, IReadOnlyList items) - : base(ClientQLAggregateKind.Tuple, operatorKind) + public ClientQLTupleAggregate(IReadOnlyList items) + : base(ClientQLAggregateKind.Tuple) { this.Items = items; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs index f0ffadc3f3..978fddd62f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs @@ -4,7 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL { - internal class ClientQLType + internal abstract class ClientQLType { public ClientQLType(ClientQLTypeKind kind) { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 19618ce592..02e7ebc071 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -263,51 +263,7 @@ private static ClientQLLetScalarExpression DeserializeLetScalarExpression(Cosmos private static ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(CosmosObject cosmosObject) { CosmosObject literalObject = GetValue(cosmosObject, Constants.Literal); - ClientQLLiteralKind literalKind = GetEnumValue(GetValue(literalObject, Constants.Kind).Value); - return new ClientQLLiteralScalarExpression(DeserializeClientQLLiteral(literalObject, literalKind)); - } - - private static ClientQLLiteral DeserializeClientQLLiteral(CosmosObject cosmosObject, ClientQLLiteralKind literalKind) - { - switch (literalKind) - { - case ClientQLLiteralKind.Undefined: - return ClientQLUndefinedLiteral.Singleton; - case ClientQLLiteralKind.Array: - return new ClientQLArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); - case ClientQLLiteralKind.Binary: - return new ClientQLBinaryLiteral(DeserializeBinaryArray(GetValue(cosmosObject, Constants.Value))); - case ClientQLLiteralKind.Boolean: - return new ClientQLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); - case ClientQLLiteralKind.CGuid: - return new ClientQLCGuidLiteral(GetValue(cosmosObject, Constants.Value).Value); - case ClientQLLiteralKind.CNumber: - return new ClientQLCNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case ClientQLLiteralKind.MDateTime: - return new ClientQLMDateTimeLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case ClientQLLiteralKind.MJavaScript: - return new ClientQLMJavaScriptLiteral(GetValue(cosmosObject, Constants.Name).Value); - case ClientQLLiteralKind.MNumber: - return new ClientQLMNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case ClientQLLiteralKind.MRegex: - string pattern = GetValue(cosmosObject, Constants.Pattern).Value; - string options = GetValue(cosmosObject, Constants.Options).Value; - return new ClientQLMRegexLiteral(pattern, options); - case ClientQLLiteralKind.MSingleton: - return new ClientQLMSingletonLiteral(GetEnumValue(GetValue(cosmosObject, Constants.SingletonKind).Value)); - case ClientQLLiteralKind.MSymbol: - return new ClientQLMSymbolLiteral(GetValue(cosmosObject, Constants.Value).Value); - case ClientQLLiteralKind.Null: - return ClientQLNullLiteral.Singleton; - case ClientQLLiteralKind.Number: - return new ClientQLNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case ClientQLLiteralKind.Object: - return new ClientQLObjectLiteral(DeserializeObjectLiteralArray(GetValue(cosmosObject, Constants.Properties))); - case ClientQLLiteralKind.String: - return new ClientQLStringLiteral(GetValue(cosmosObject, Constants.Value).Value); - default: - throw new NotSupportedException($"Invalid ClientQLExpression kind: {literalKind}"); - } + return new ClientQLLiteralScalarExpression(DeserializeClientQLLiteral(literalObject)); } private static ClientQLMuxScalarExpression DeserializeMuxScalarExpression(CosmosObject cosmosObject) @@ -376,12 +332,62 @@ private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarE // Helper Functions for Deserialization - private static ClientQLAggregate DeserializeAggregate(CosmosObject cosmosObject) + private static ClientQLLiteral DeserializeClientQLLiteral(CosmosObject cosmosObject) { - ClientQLAggregateKind kind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); - string operatorKind = GetValue(cosmosObject, Constants.OperatorKind).Value; + ClientQLLiteralKind literalKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); + switch (literalKind) + { + case ClientQLLiteralKind.Undefined: + return ClientQLUndefinedLiteral.Singleton; + case ClientQLLiteralKind.Array: + return new ClientQLArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); + case ClientQLLiteralKind.Binary: + return new ClientQLBinaryLiteral(DeserializeBinaryArray(GetValue(cosmosObject, Constants.Value))); + case ClientQLLiteralKind.Boolean: + return new ClientQLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); + case ClientQLLiteralKind.CGuid: + return new ClientQLCGuidLiteral(GetValue(cosmosObject, Constants.Value).Value); + case ClientQLLiteralKind.CNumber: + return new ClientQLCNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); + case ClientQLLiteralKind.MDateTime: + return new ClientQLMDateTimeLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); + case ClientQLLiteralKind.MJavaScript: + return new ClientQLMJavaScriptLiteral(GetValue(cosmosObject, Constants.Name).Value); + case ClientQLLiteralKind.MNumber: + return new ClientQLMNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); + case ClientQLLiteralKind.MRegex: + string pattern = GetValue(cosmosObject, Constants.Pattern).Value; + string options = GetValue(cosmosObject, Constants.Options).Value; + return new ClientQLMRegexLiteral(pattern, options); + case ClientQLLiteralKind.MSingleton: + return new ClientQLMSingletonLiteral(GetEnumValue(GetValue(cosmosObject, Constants.SingletonKind).Value)); + case ClientQLLiteralKind.MSymbol: + return new ClientQLMSymbolLiteral(GetValue(cosmosObject, Constants.Value).Value); + case ClientQLLiteralKind.Null: + return ClientQLNullLiteral.Singleton; + case ClientQLLiteralKind.Number: + return new ClientQLNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); + case ClientQLLiteralKind.Object: + return new ClientQLObjectLiteral(DeserializeObjectLiteralArray(GetValue(cosmosObject, Constants.Properties))); + case ClientQLLiteralKind.String: + return new ClientQLStringLiteral(GetValue(cosmosObject, Constants.Value).Value); + default: + throw new NotSupportedException($"Invalid ClientQLExpression kind: {literalKind}"); + } + } - return new ClientQLAggregate(kind, operatorKind); + private static ClientQLAggregate DeserializeAggregate(CosmosObject cosmosObject) + { + ClientQLAggregateKind aggregateKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); + switch (aggregateKind) + { + case ClientQLAggregateKind.Tuple: + return DeserializeTupleAggregateExpression(cosmosObject); + case ClientQLAggregateKind.Builtin: + return DeserializeBuiltInAggregateExpression(cosmosObject); + default: + throw new NotSupportedException($"Invalid ClientQLExpression kind: {aggregateKind}"); + } } private static ClientQLVariable DeserializeClientQLVariable(CosmosObject cosmosObject) @@ -392,37 +398,44 @@ private static ClientQLVariable DeserializeClientQLVariable(CosmosObject cosmosO return new ClientQLVariable(name, uniqueId); } - private static IReadOnlyList DeserializeObjectProperties(CosmosArray cosmosArray) + private static ClientQLBuiltinAggregate DeserializeBuiltInAggregateExpression(CosmosObject cosmosObject) { - List properties = new List(); - foreach (CosmosElement propertyElement in cosmosArray) + ClientQLAggregateOperatorKind aggregateOperatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + return new ClientQLBuiltinAggregate(aggregateOperatorKind); + } + + private static ClientQLTupleAggregate DeserializeTupleAggregateExpression(CosmosObject cosmosObject) + { + CosmosArray propertyArray = GetValue(cosmosObject, Constants.Items); + List expression = new List(propertyArray.Count); + + foreach (CosmosElement propertyElement in propertyArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - string objectPropertyName = GetValue(propertyObject, Constants.Name).Value; - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); - properties.Add(new ClientQLObjectProperty(objectPropertyName, expression)); + ClientQLAggregate aggregateExpression = DeserializeAggregate(propertyObject); + expression.Add(aggregateExpression); } - return properties; + return new ClientQLTupleAggregate(expression); } - private static ClientQLTupleAggregate DeserializeTupleAggregateExpression(CosmosObject cosmosObject) + private static IReadOnlyList DeserializeObjectProperties(CosmosArray cosmosArray) { - string tupleAggregateKind = GetValue(cosmosObject, Constants.Kind).Value; - List expression = new List(); - foreach (CosmosElement propertyElement in GetValue(cosmosObject, Constants.Items)) + List properties = new List(cosmosArray.Count); + foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - ClientQLAggregate aggregateExpression = DeserializeAggregate(propertyObject); - expression.Add(aggregateExpression); + string objectPropertyName = GetValue(propertyObject, Constants.Name).Value; + ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); + properties.Add(new ClientQLObjectProperty(objectPropertyName, expression)); } - return new ClientQLTupleAggregate(tupleAggregateKind, expression); + return properties; } private static IReadOnlyList DeserializeScalarExpressionArray(CosmosArray cosmosArray) { - List expressions = new List(); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); @@ -435,13 +448,13 @@ private static IReadOnlyList DeserializeScalarExpressi private static IReadOnlyList DeserializeOrderByItemArray(CosmosArray cosmosArray) { - List expressions = new List(); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - ClientQLScalarExpressionKind kind = GetEnumValue(GetValue(propertyObject, Constants.Kind).Value); - ClientQLScalarExpression scalarExpression = new ClientQLScalarExpression(kind); - expressions.Add(new ClientQLOrderByItem(scalarExpression, ClientQLSortOrder.Ascending)); + ClientQLSortOrder sortOrder = GetEnumValue(GetValue(propertyObject, Constants.SortOrder).Value); + ClientQLScalarExpression scalarExpression = DeserializeScalarExpression(propertyObject); + expressions.Add(new ClientQLOrderByItem(scalarExpression, sortOrder)); } return expressions; @@ -449,23 +462,11 @@ private static IReadOnlyList DeserializeOrderByItemArray(Co private static IReadOnlyList DeserializeAggregateArray(CosmosArray cosmosArray) { - List expressions = new List(); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { - ClientQLAggregate aggregateExpression = null; CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - string kindProperty = GetValue(propertyObject, Constants.Kind).Value; - - if (kindProperty.Equals(Constants.Builtin)) - { - aggregateExpression = DeserializeAggregate(propertyObject); - } - else if (kindProperty.Equals(Constants.Tuple)) - { - aggregateExpression = DeserializeTupleAggregateExpression(propertyObject); - } - - expressions.Add(aggregateExpression); + expressions.Add(DeserializeAggregate(propertyObject)); } return expressions; @@ -473,13 +474,11 @@ private static IReadOnlyList DeserializeAggregateArray(Cosmos private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosmosArray) { - List expressions = new List(); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - ClientQLLiteralKind kindProperty = GetEnumValue(GetValue(propertyObject, Constants.Kind).Value); - ClientQLLiteral literal = new ClientQLLiteral(kindProperty); - expressions.Add(literal); + expressions.Add(DeserializeClientQLLiteral(propertyObject)); } return expressions; @@ -487,13 +486,12 @@ private static IReadOnlyList DeserializeLiteralArray(CosmosArra private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) { - List expressions = new List(); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); string name = GetValue(propertyObject, Constants.Name).Value; - ClientQLLiteralKind kindProperty = GetEnumValue(GetValue(propertyObject, Constants.Kind).Value); - ClientQLLiteral literal = new ClientQLLiteral(kindProperty); + ClientQLLiteral literal = DeserializeClientQLLiteral(propertyObject); ClientQLObjectLiteralProperty objectLiteralProperty = new ClientQLObjectLiteralProperty(name, literal); expressions.Add(objectLiteralProperty); } @@ -503,7 +501,7 @@ private static IReadOnlyList DeserializeObjectLit private static IReadOnlyList DeserializeBinaryArray(CosmosArray cosmosArray) { - List expressions = new List(); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml index c7924566ac..5a9238bb91 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml @@ -27,8 +27,8 @@ "Kind": 4 }, "Aggregate": { - "Kind": 0, - "OperatorKind": "Sum" + "OperatorKind": 11, + "Kind": 0 }, "Kind": 0 }, @@ -364,26 +364,25 @@ "KeyCount": 1, "Aggregates": [ { - "Kind": 0, - "OperatorKind": "Sum" + "OperatorKind": 11, + "Kind": 0 }, { "Items": [ { - "Kind": 0, - "OperatorKind": "Sum" + "OperatorKind": 11, + "Kind": 0 }, { - "Kind": 0, - "OperatorKind": "Sum" + "OperatorKind": 11, + "Kind": 0 } ], - "Kind": 1, - "OperatorKind": "Tuple" + "Kind": 1 }, { - "Kind": 0, - "OperatorKind": "Max" + "OperatorKind": 9, + "Kind": 0 } ], "Kind": 2 @@ -563,8 +562,8 @@ "Kind": 4 }, "Aggregate": { - "Kind": 0, - "OperatorKind": "Sum" + "OperatorKind": 11, + "Kind": 0 }, "Kind": 0 }, From 0925d97877d81f3f34147c15dd2a9bf06d7ab53d Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Thu, 14 Sep 2023 11:59:18 -0700 Subject: [PATCH 25/36] Made singleton constructors from public to private --- .../CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs | 2 +- .../ClientQL/ClientQLUndefinedLiteral.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs index d928290638..e89eddcd3a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs @@ -8,7 +8,7 @@ internal class ClientQLNullLiteral : ClientQLLiteral { public static readonly ClientQLNullLiteral Singleton = new ClientQLNullLiteral(); - public ClientQLNullLiteral() + private ClientQLNullLiteral() : base(ClientQLLiteralKind.Null) { } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs index 8c7e81215d..a9bfd5f773 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs @@ -8,7 +8,7 @@ internal class ClientQLUndefinedLiteral : ClientQLLiteral { public static readonly ClientQLUndefinedLiteral Singleton = new ClientQLUndefinedLiteral(); - public ClientQLUndefinedLiteral() + private ClientQLUndefinedLiteral() : base(ClientQLLiteralKind.Undefined) { } From 3afb5c21ce40c23bd0bddb507e7233b0df45d2ac Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Sun, 17 Sep 2023 17:55:17 -0700 Subject: [PATCH 26/36] Updated the DeserializeClientQLBinaryLiteral function --- .../ClientQL/ClientQLBinaryLiteral.cs | 4 +-- ...CoordinatorDistributionPlanDeserializer.cs | 35 +++++++++++++------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs index d11fb75fcf..cded07dc10 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs @@ -9,12 +9,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL internal class ClientQLBinaryLiteral : ClientQLLiteral { - public ClientQLBinaryLiteral(IReadOnlyList value) + public ClientQLBinaryLiteral(byte[] value) : base(ClientQLLiteralKind.Binary) { this.Value = value; } - public IReadOnlyList Value { get; } + public byte[] Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 02e7ebc071..ef661377c1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -75,8 +75,8 @@ public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan return new CoordinatorDistributionPlan(expression); } - - // Deserialize Enumerable Expressions + + #region Enumerable Expressions private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(CosmosObject cosmosObject) { @@ -181,7 +181,8 @@ private static ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpre return new ClientQLWhereEnumerableExpression(sourceExpression); } - // Deserialize Scalar Expressions + #endregion + #region Scalar Expressions private static ClientQLScalarExpression DeserializeScalarExpression(CosmosObject cosmosObject) { @@ -330,8 +331,8 @@ private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarE return new ClientQLVariableRefScalarExpression(variable); } - // Helper Functions for Deserialization - + #endregion + #region Literal Expressions private static ClientQLLiteral DeserializeClientQLLiteral(CosmosObject cosmosObject) { ClientQLLiteralKind literalKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); @@ -499,20 +500,32 @@ private static IReadOnlyList DeserializeObjectLit return expressions; } - private static IReadOnlyList DeserializeBinaryArray(CosmosArray cosmosArray) + private static byte[] DeserializeBinaryArray(CosmosArray cosmosArray) { - List expressions = new List(cosmosArray.Count); + List> expressions = new List>(cosmosArray.Count); + int memoryLength = 0; foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); ReadOnlyMemory binaryValue = GetValue(propertyObject, Constants.Kind).Value; - BinaryData data = new BinaryData(binaryValue); - expressions.Add(data); + memoryLength += binaryValue.Length; + expressions.Add(binaryValue); } - return expressions; + byte[] newArray = new byte[memoryLength]; + int currentIndex = 0; + foreach (ReadOnlyMemory byteCollection in expressions) + { + byteCollection.CopyTo(newArray.AsMemory(currentIndex)); + currentIndex += byteCollection.Length; + } + + return newArray; } + #endregion + #region Helper Functions + private static T GetValue(CosmosObject cosmosObject, string propertyName) where T : CosmosElement { @@ -578,5 +591,7 @@ private static CosmosObject ConvertToCosmosObject(CosmosElement cosmosElement) throw new InvalidOperationException("Unable to cast CosmosElement to CosmosObject."); } } + + #endregion } } \ No newline at end of file From 029fbb8b3f4b950844e1f5fff7c478580327edb9 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Sun, 17 Sep 2023 18:46:17 -0700 Subject: [PATCH 27/36] Renamed ClientQL to QL --- .../ClientQLAggregateEnumerableExpression.cs | 21 - .../ClientQLBinaryScalarExpression.cs | 23 -- .../ClientQLDistinctEnumerableExpression.cs | 26 -- .../ClientQL/ClientQLEnumerableExpression.cs | 16 - .../ClientQL/ClientQLMuxScalarExpression.cs | 24 -- .../ClientQL/ClientQLNullLiteral.cs | 16 - .../ClientQLOrderByEnumerableExpression.cs | 26 -- .../ClientQL/ClientQLProgram.cs | 11 - .../ClientQLScalarAsEnumerableExpression.cs | 21 - .../ClientQLSelectEnumerableExpression.cs | 24 -- .../ClientQLSelectManyEnumerableExpression.cs | 24 -- ...entQLSystemFunctionCallScalarExpression.cs | 23 -- .../ClientQL/ClientQLUnaryScalarExpression.cs | 21 - .../ClientQL/ClientQLUndefinedLiteral.cs | 16 - .../ClietnQLUnaryScalarOperatorKind.cs | 14 - ...CoordinatorDistributionPlanDeserializer.cs | 377 +++++++++--------- .../CoordinatorDistributionPlan.cs | 6 +- .../ClientQLType.cs => QL/QLAggregate.cs} | 8 +- .../QL/QLAggregateEnumerableExpression.cs | 21 + .../QLAggregateKind.cs} | 4 +- .../QLAggregateOperatorKind.cs} | 4 +- .../QLArrayCreateScalarExpression.cs} | 12 +- .../QLArrayIndexerScalarExpression.cs} | 10 +- .../QLArrayKind.cs} | 4 +- .../QLArrayLiteral.cs} | 10 +- .../ClientQLBaseType.cs => QL/QLBaseType.cs} | 8 +- .../QLBaseTypeKind.cs} | 4 +- .../QLBinaryLiteral.cs} | 8 +- .../QL/QLBinaryScalarExpression.cs | 23 ++ .../QLBinaryScalarOperatorKind.cs} | 4 +- .../QLBooleanLiteral.cs} | 8 +- .../QLBuiltinAggregate.cs} | 10 +- .../QLBuiltinScalarFunctionKind.cs} | 4 +- .../QLCGuidLiteral.cs} | 8 +- .../QLCNumberLiteral.cs} | 8 +- .../QL/QLDistinctEnumerableExpression.cs | 26 ++ .../ClientQLEnumType.cs => QL/QLEnumType.cs} | 10 +- .../QLEnumerableExpression.cs} | 8 +- .../QLEnumerableExpressionKind.cs} | 4 +- .../QLEnumerationKind.cs} | 4 +- .../QLExpression.cs} | 4 +- .../QLFunctionIdentifier.cs} | 6 +- .../QLGroupByEnumerableExpression.cs} | 12 +- .../QLGroupByKey.cs} | 8 +- .../QLInputEnumerableExpression.cs} | 8 +- .../QLIsOperatorKind.cs} | 4 +- .../QLIsOperatorScalarExpression.cs} | 12 +- .../QLLetScalarExpression.cs} | 14 +- .../ClientQLLiteral.cs => QL/QLLiteral.cs} | 8 +- .../QLLiteralKind.cs} | 4 +- .../QLLiteralScalarExpression.cs} | 10 +- .../QLMDateTimeLiteral.cs} | 8 +- .../QLMJavaScriptLiteral.cs} | 8 +- .../QLMNumberLiteral.cs} | 8 +- .../QLMRegexLiteral.cs} | 8 +- .../QLMSingletonLiteral.cs} | 8 +- .../QLMSymbolLiteral.cs} | 8 +- .../QL/QLMuxScalarExpression.cs | 24 ++ .../QL/QLNullLiteral.cs | 16 + .../QLNumberLiteral.cs} | 8 +- .../QLObjectCreateScalarExpression.cs} | 12 +- .../QLObjectKind.cs} | 4 +- .../QLObjectLiteral.cs} | 10 +- .../QLObjectLiteralProperty.cs} | 8 +- .../QLObjectProperty.cs} | 8 +- .../QL/QLOrderByEnumerableExpression.cs | 26 ++ .../QLOrderByItem.cs} | 10 +- .../QL/QLProgram.cs | 11 + .../QLPropertyRefScalarExpression.cs} | 10 +- .../QL/QLScalarAsEnumerableExpression.cs | 21 + .../QL/QLScalarExpression.cs | 16 + .../QLScalarExpressionKind.cs} | 4 +- .../QL/QLSelectEnumerableExpression.cs | 24 ++ .../QL/QLSelectManyEnumerableExpression.cs | 24 ++ .../QLSortOrder.cs} | 4 +- .../QLStringLiteral.cs} | 8 +- .../QLSystemFunctionCallScalarExpression.cs | 23 ++ .../QLTakeEnumerableExpression.cs} | 10 +- .../QLTupleAggregate.cs} | 10 +- .../QLTupleCreateScalarExpression.cs} | 10 +- .../QLTupleItemRefScalarExpression.cs} | 10 +- .../QLTupleType.cs} | 10 +- .../ClientQLAggregate.cs => QL/QLType.cs} | 8 +- .../ClientQLTypeKind.cs => QL/QLTypeKind.cs} | 4 +- .../QL/QLUnaryScalarExpression.cs | 21 + .../QLUnaryScalarOperatorKind.cs} | 4 +- .../QL/QLUndefinedLiteral.cs | 16 + ...serDefinedFunctionCallScalarExpression.cs} | 12 +- .../ClientQLVariable.cs => QL/QLVariable.cs} | 6 +- .../QLVariableRefScalarExpression.cs} | 10 +- .../QLWhereEnumerableExpression.cs} | 10 +- ...oordinatorDistributionPlanBaselineTests.cs | 2 +- 92 files changed, 719 insertions(+), 732 deletions(-) delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClietnQLUnaryScalarOperatorKind.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL => QL}/CoordinatorDistributionPlan.cs (72%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLType.cs => QL/QLAggregate.cs} (67%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLAggregateKind.cs => QL/QLAggregateKind.cs} (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLAggregateOperatorKind.cs => QL/QLAggregateOperatorKind.cs} (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLArrayCreateScalarExpression.cs => QL/QLArrayCreateScalarExpression.cs} (50%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLTupleItemRefScalarExpression.cs => QL/QLArrayIndexerScalarExpression.cs} (55%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLArrayKind.cs => QL/QLArrayKind.cs} (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLArrayLiteral.cs => QL/QLArrayLiteral.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLBaseType.cs => QL/QLBaseType.cs} (70%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLBaseTypeKind.cs => QL/QLBaseTypeKind.cs} (90%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLBinaryLiteral.cs => QL/QLBinaryLiteral.cs} (70%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLBinaryScalarOperatorKind.cs => QL/QLBinaryScalarOperatorKind.cs} (90%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLBooleanLiteral.cs => QL/QLBooleanLiteral.cs} (67%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLBuiltinAggregate.cs => QL/QLBuiltinAggregate.cs} (54%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLBuiltinScalarFunctionKind.cs => QL/QLBuiltinScalarFunctionKind.cs} (98%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLCGuidLiteral.cs => QL/QLCGuidLiteral.cs} (67%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLCNumberLiteral.cs => QL/QLCNumberLiteral.cs} (67%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLEnumType.cs => QL/QLEnumType.cs} (60%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLScalarExpression.cs => QL/QLEnumerableExpression.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLEnumerableExpressionKind.cs => QL/QLEnumerableExpressionKind.cs} (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLEnumerationKind.cs => QL/QLEnumerationKind.cs} (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLExpression.cs => QL/QLExpression.cs} (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLFunctionIdentifier.cs => QL/QLFunctionIdentifier.cs} (75%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLGroupByEnumerableExpression.cs => QL/QLGroupByEnumerableExpression.cs} (52%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLGroupByKey.cs => QL/QLGroupByKey.cs} (68%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLInputEnumerableExpression.cs => QL/QLInputEnumerableExpression.cs} (61%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLIsOperatorKind.cs => QL/QLIsOperatorKind.cs} (83%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLIsOperatorScalarExpression.cs => QL/QLIsOperatorScalarExpression.cs} (51%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLLetScalarExpression.cs => QL/QLLetScalarExpression.cs} (50%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLLiteral.cs => QL/QLLiteral.cs} (65%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLLiteralKind.cs => QL/QLLiteralKind.cs} (91%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLLiteralScalarExpression.cs => QL/QLLiteralScalarExpression.cs} (54%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLMNumberLiteral.cs => QL/QLMDateTimeLiteral.cs} (67%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLMJavaScriptLiteral.cs => QL/QLMJavaScriptLiteral.cs} (65%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLMDateTimeLiteral.cs => QL/QLMNumberLiteral.cs} (66%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLMRegexLiteral.cs => QL/QLMRegexLiteral.cs} (70%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLMSingletonLiteral.cs => QL/QLMSingletonLiteral.cs} (72%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLStringLiteral.cs => QL/QLMSymbolLiteral.cs} (67%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNullLiteral.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLNumberLiteral.cs => QL/QLNumberLiteral.cs} (69%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLObjectCreateScalarExpression.cs => QL/QLObjectCreateScalarExpression.cs} (50%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLObjectKind.cs => QL/QLObjectKind.cs} (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLObjectLiteral.cs => QL/QLObjectLiteral.cs} (55%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLObjectLiteralProperty.cs => QL/QLObjectLiteralProperty.cs} (66%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLObjectProperty.cs => QL/QLObjectProperty.cs} (66%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLOrderByItem.cs => QL/QLOrderByItem.cs} (58%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLProgram.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLPropertyRefScalarExpression.cs => QL/QLPropertyRefScalarExpression.cs} (58%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLScalarExpressionKind.cs => QL/QLScalarExpressionKind.cs} (90%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLSortOrder.cs => QL/QLSortOrder.cs} (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLMSymbolLiteral.cs => QL/QLStringLiteral.cs} (67%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLTakeEnumerableExpression.cs => QL/QLTakeEnumerableExpression.cs} (59%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLTupleAggregate.cs => QL/QLTupleAggregate.cs} (57%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLTupleCreateScalarExpression.cs => QL/QLTupleCreateScalarExpression.cs} (52%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLArrayIndexerScalarExpression.cs => QL/QLTupleItemRefScalarExpression.cs} (55%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLTupleType.cs => QL/QLTupleType.cs} (60%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLAggregate.cs => QL/QLType.cs} (64%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLTypeKind.cs => QL/QLTypeKind.cs} (85%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLUnaryScalarOperatorKind.cs => QL/QLUnaryScalarOperatorKind.cs} (83%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUndefinedLiteral.cs rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs => QL/QLUserDefinedFunctionCallScalarExpression.cs} (50%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLVariable.cs => QL/QLVariable.cs} (79%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLVariableRefScalarExpression.cs => QL/QLVariableRefScalarExpression.cs} (53%) rename Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/{ClientQL/ClientQLWhereEnumerableExpression.cs => QL/QLWhereEnumerableExpression.cs} (51%) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs deleted file mode 100644 index 920f961a86..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateEnumerableExpression.cs +++ /dev/null @@ -1,21 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLAggregateEnumerableExpression : ClientQLEnumerableExpression - { - public ClientQLAggregateEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLAggregate aggregate) - : base(ClientQLEnumerableExpressionKind.Aggregate) - { - this.SourceExpression = sourceExpression; - this.Aggregate = aggregate; - } - - public ClientQLEnumerableExpression SourceExpression { get; } - - public ClientQLAggregate Aggregate { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs deleted file mode 100644 index f30c23827c..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarExpression.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLBinaryScalarExpression : ClientQLScalarExpression - { - public ClientQLBinaryScalarExpression(ClientQLBinaryScalarOperatorKind operatorKind, ClientQLScalarExpression leftExpression, ClientQLScalarExpression rightExpression) - : base(ClientQLScalarExpressionKind.BinaryOperator) - { - this.OperatorKind = operatorKind; - this.LeftExpression = leftExpression; - this.RightExpression = rightExpression; - } - - public ClientQLBinaryScalarOperatorKind OperatorKind { get; } - - public ClientQLScalarExpression LeftExpression { get; } - - public ClientQLScalarExpression RightExpression { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs deleted file mode 100644 index 25c9527dd7..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLDistinctEnumerableExpression.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - using System.Collections.Generic; - - internal class ClientQLDistinctEnumerableExpression : ClientQLEnumerableExpression - { - public ClientQLDistinctEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, IReadOnlyList expression) - : base(ClientQLEnumerableExpressionKind.Distinct) - { - this.SourceExpression = sourceExpression; - this.DeclaredVariable = declaredVariable; - this.Expression = expression; - } - - public ClientQLEnumerableExpression SourceExpression { get; } - - public ClientQLVariable DeclaredVariable { get; } - - public IReadOnlyList Expression { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs deleted file mode 100644 index ef8a2c744c..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpression.cs +++ /dev/null @@ -1,16 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal abstract class ClientQLEnumerableExpression : ClientQLExpression - { - public ClientQLEnumerableExpression(ClientQLEnumerableExpressionKind kind) - { - this.Kind = kind; - } - - public ClientQLEnumerableExpressionKind Kind { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs deleted file mode 100644 index 630db72d53..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMuxScalarExpression.cs +++ /dev/null @@ -1,24 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLMuxScalarExpression : ClientQLScalarExpression - { - public ClientQLMuxScalarExpression(ClientQLScalarExpression conditionExpression, ClientQLScalarExpression leftExpression, ClientQLScalarExpression rightExpression) - : base(ClientQLScalarExpressionKind.Mux) - { - this.ConditionExpression = conditionExpression; - this.LeftExpression = leftExpression; - this.RightExpression = rightExpression; - } - - public ClientQLScalarExpression ConditionExpression { get; } - - public ClientQLScalarExpression LeftExpression { get; } - - public ClientQLScalarExpression RightExpression { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs deleted file mode 100644 index e89eddcd3a..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNullLiteral.cs +++ /dev/null @@ -1,16 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLNullLiteral : ClientQLLiteral - { - public static readonly ClientQLNullLiteral Singleton = new ClientQLNullLiteral(); - - private ClientQLNullLiteral() - : base(ClientQLLiteralKind.Null) - { - } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs deleted file mode 100644 index 88e4bd1bf2..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByEnumerableExpression.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - using System.Collections.Generic; - - internal class ClientQLOrderByEnumerableExpression : ClientQLEnumerableExpression - { - public ClientQLOrderByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, IReadOnlyList items) - : base(ClientQLEnumerableExpressionKind.OrderBy) - { - this.SourceExpression = sourceExpression; - this.DeclaredVariable = declaredVariable; - this.Items = items; - } - - public ClientQLEnumerableExpression SourceExpression { get; } - - public ClientQLVariable DeclaredVariable { get; } - - public IReadOnlyList Items { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs deleted file mode 100644 index ad33a22439..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLProgram.cs +++ /dev/null @@ -1,11 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLProgram - { - public ClientQLEnumerableExpression Expression { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs deleted file mode 100644 index 36433b707f..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarAsEnumerableExpression.cs +++ /dev/null @@ -1,21 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLScalarAsEnumerableExpression : ClientQLEnumerableExpression - { - public ClientQLScalarAsEnumerableExpression(ClientQLScalarExpression expression, ClientQLEnumerationKind enumerationKind) - : base(ClientQLEnumerableExpressionKind.ScalarAsEnumerable) - { - this.Expression = expression; - this.EnumerationKind = enumerationKind; - } - - public ClientQLScalarExpression Expression { get; } - - public ClientQLEnumerationKind EnumerationKind { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs deleted file mode 100644 index 29ca8d88ec..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectEnumerableExpression.cs +++ /dev/null @@ -1,24 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLSelectEnumerableExpression : ClientQLEnumerableExpression - { - public ClientQLSelectEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, ClientQLScalarExpression expression) - : base(ClientQLEnumerableExpressionKind.Select) - { - this.SourceExpression = sourceExpression; - this.DeclaredVariable = declaredVariable; - this.Expression = expression; - } - - public ClientQLEnumerableExpression SourceExpression { get; } - - public ClientQLVariable DeclaredVariable { get; } - - public ClientQLScalarExpression Expression { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs deleted file mode 100644 index 93a6c917c8..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSelectManyEnumerableExpression.cs +++ /dev/null @@ -1,24 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLSelectManyEnumerableExpression : ClientQLEnumerableExpression - { - public ClientQLSelectManyEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ClientQLVariable declaredVariable, ClientQLEnumerableExpression selectorExpression) - : base(ClientQLEnumerableExpressionKind.SelectMany) - { - this.SourceExpression = sourceExpression; - this.DeclaredVariable = declaredVariable; - this.SelectorExpression = selectorExpression; - } - - public ClientQLEnumerableExpression SourceExpression { get; } - - public ClientQLVariable DeclaredVariable { get; } - - public ClientQLEnumerableExpression SelectorExpression { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs deleted file mode 100644 index 76a7675168..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSystemFunctionCallScalarExpression.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - using System.Collections.Generic; - - internal class ClientQLSystemFunctionCallScalarExpression : ClientQLScalarExpression - { - public ClientQLSystemFunctionCallScalarExpression(ClientQLBuiltinScalarFunctionKind functionKind, IReadOnlyList arguments) - : base(ClientQLScalarExpressionKind.SystemFunctionCall) - { - this.FunctionKind = functionKind; - this.Arguments = arguments; - } - - public ClientQLBuiltinScalarFunctionKind FunctionKind { get; } - - public IReadOnlyList Arguments { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs deleted file mode 100644 index 9f9ae1cf76..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarExpression.cs +++ /dev/null @@ -1,21 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLUnaryScalarExpression : ClientQLScalarExpression - { - public ClientQLUnaryScalarExpression(ClientQLUnaryScalarOperatorKind operatorKind, ClientQLScalarExpression expression) - : base(ClientQLScalarExpressionKind.UnaryOperator) - { - this.OperatorKind = operatorKind; - this.Expression = expression; - } - - public ClientQLUnaryScalarOperatorKind OperatorKind { get; } - - public ClientQLScalarExpression Expression { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs deleted file mode 100644 index a9bfd5f773..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUndefinedLiteral.cs +++ /dev/null @@ -1,16 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal class ClientQLUndefinedLiteral : ClientQLLiteral - { - public static readonly ClientQLUndefinedLiteral Singleton = new ClientQLUndefinedLiteral(); - - private ClientQLUndefinedLiteral() - : base(ClientQLLiteralKind.Undefined) - { - } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClietnQLUnaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClietnQLUnaryScalarOperatorKind.cs deleted file mode 100644 index df9d568e44..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClietnQLUnaryScalarOperatorKind.cs +++ /dev/null @@ -1,14 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL -{ - internal enum ClietnQLUnaryScalarOperatorKind - { - BitwiseNot, - Minus, - Not, - Plus, - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index ef661377c1..2c922bea5a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -7,8 +7,8 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan using System; using System.Collections.Generic; using System.Reflection; - using ClientQL; using Microsoft.Azure.Cosmos.CosmosElements; + using QL; internal static class CoordinatorDistributionPlanDeserializer { @@ -47,6 +47,7 @@ private static class Constants public const string Pattern = "Pattern"; public const string Properties = "Properties"; public const string PropertyName = "PropertyName"; + public const string QL = "QL"; public const string RightExpression = "RightExpression"; public const string ScalarAsEnumerable = "ScalarAsEnumerable"; public const string Select = "Select"; @@ -71,14 +72,14 @@ public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan CosmosObject cosmosObject = CosmosObject.Parse(jsonString); CosmosObject coordinatorDistributionPlanElement = GetValue(cosmosObject, Constants.CoordinatorDistributionPlan); CosmosObject clientQLElement = GetValue(coordinatorDistributionPlanElement, Constants.ClientQL); - ClientQLEnumerableExpression expression = DeserializeClientQLEnumerableExpression(clientQLElement); + QLEnumerableExpression expression = DeserializeQLEnumerableExpression(clientQLElement); return new CoordinatorDistributionPlan(expression); } #region Enumerable Expressions - private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpression(CosmosObject cosmosObject) + private static QLEnumerableExpression DeserializeQLEnumerableExpression(CosmosObject cosmosObject) { CosmosString kindProperty = GetValue(cosmosObject, Constants.Kind); switch (kindProperty.Value) @@ -104,366 +105,366 @@ private static ClientQLEnumerableExpression DeserializeClientQLEnumerableExpress case Constants.Where: return DeserializeWhereEnumerableExpression(cosmosObject); default: - throw new NotSupportedException($"Invalid ClientQLExpression kind: {kindProperty.Value}"); + throw new NotSupportedException($"Invalid QLExpression kind: {kindProperty.Value}"); } } - private static ClientQLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(CosmosObject cosmosObject) + private static QLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - ClientQLAggregate aggregate = DeserializeAggregate(GetValue(cosmosObject, Constants.Aggregate)); - return new ClientQLAggregateEnumerableExpression(sourceExpression, aggregate); + QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + QLAggregate aggregate = DeserializeAggregate(GetValue(cosmosObject, Constants.Aggregate)); + return new QLAggregateEnumerableExpression(sourceExpression, aggregate); } - private static ClientQLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(CosmosObject cosmosObject) + private static QLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - IReadOnlyList expressions = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Expression)); - return new ClientQLDistinctEnumerableExpression(sourceExpression, declaredVariable, expressions); + QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + IReadOnlyList expressions = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Expression)); + return new QLDistinctEnumerableExpression(sourceExpression, declaredVariable, expressions); } - private static ClientQLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(CosmosObject cosmosObject) + private static QLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); long keyCount = Number64.ToLong(GetValue(cosmosObject, Constants.KeyCount).Value); - IReadOnlyList aggregates = DeserializeAggregateArray(GetValue(cosmosObject, Constants.Aggregates)); - return new ClientQLGroupByEnumerableExpression(sourceExpression, Convert.ToUInt64(keyCount), aggregates); + IReadOnlyList aggregates = DeserializeAggregateArray(GetValue(cosmosObject, Constants.Aggregates)); + return new QLGroupByEnumerableExpression(sourceExpression, Convert.ToUInt64(keyCount), aggregates); } - private static ClientQLInputEnumerableExpression DeserializeInputEnumerableExpression(CosmosObject cosmosObject) + private static QLInputEnumerableExpression DeserializeInputEnumerableExpression(CosmosObject cosmosObject) { - return new ClientQLInputEnumerableExpression(GetValue(cosmosObject, Constants.Name).Value); + return new QLInputEnumerableExpression(GetValue(cosmosObject, Constants.Name).Value); } - private static ClientQLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(CosmosObject cosmosObject) + private static QLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - IReadOnlyList orderByItems = DeserializeOrderByItemArray(GetValue(cosmosObject, Constants.Items)); - return new ClientQLOrderByEnumerableExpression(sourceExpression, declaredVariable, orderByItems); + QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + IReadOnlyList orderByItems = DeserializeOrderByItemArray(GetValue(cosmosObject, Constants.Items)); + return new QLOrderByEnumerableExpression(sourceExpression, declaredVariable, orderByItems); } - private static ClientQLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(CosmosObject cosmosObject) + private static QLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - ClientQLEnumerationKind enumerationKind = GetEnumValue(GetValue(cosmosObject, Constants.EnumerationKind).Value); - return new ClientQLScalarAsEnumerableExpression(expression, enumerationKind); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + QLEnumerationKind enumerationKind = GetEnumValue(GetValue(cosmosObject, Constants.EnumerationKind).Value); + return new QLScalarAsEnumerableExpression(expression, enumerationKind); } - private static ClientQLSelectEnumerableExpression DeserializeSelectEnumerableExpression(CosmosObject cosmosObject) + private static QLSelectEnumerableExpression DeserializeSelectEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new ClientQLSelectEnumerableExpression(sourceExpression, declaredVariable, expression); + QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new QLSelectEnumerableExpression(sourceExpression, declaredVariable, expression); } - private static ClientQLSelectManyEnumerableExpression DeserializeSelectManyExpression(CosmosObject cosmosObject) + private static QLSelectManyEnumerableExpression DeserializeSelectManyExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - ClientQLEnumerableExpression selectorExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SelectorExpression)); - return new ClientQLSelectManyEnumerableExpression(sourceExpression, declaredVariable, selectorExpression); + QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + QLEnumerableExpression selectorExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SelectorExpression)); + return new QLSelectManyEnumerableExpression(sourceExpression, declaredVariable, selectorExpression); } - private static ClientQLTakeEnumerableExpression DeserializeTakeEnumerableExpression(CosmosObject cosmosObject) + private static QLTakeEnumerableExpression DeserializeTakeEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); long skipValue = Number64.ToLong(GetValue(cosmosObject, Constants.SkipValue).Value); long takeExpression = Number64.ToLong(GetValue(cosmosObject, Constants.TakeValue).Value); - return new ClientQLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); + return new QLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); } - private static ClientQLWhereEnumerableExpression DeserializeWhereEnumerableExpression(CosmosObject cosmosObject) + private static QLWhereEnumerableExpression DeserializeWhereEnumerableExpression(CosmosObject cosmosObject) { - ClientQLEnumerableExpression sourceExpression = DeserializeClientQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - return new ClientQLWhereEnumerableExpression(sourceExpression); + QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + return new QLWhereEnumerableExpression(sourceExpression); } #endregion #region Scalar Expressions - private static ClientQLScalarExpression DeserializeScalarExpression(CosmosObject cosmosObject) + private static QLScalarExpression DeserializeScalarExpression(CosmosObject cosmosObject) { - ClientQLScalarExpressionKind scalarExpressionKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); + QLScalarExpressionKind scalarExpressionKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); switch (scalarExpressionKind) { - case ClientQLScalarExpressionKind.ArrayCreate: + case QLScalarExpressionKind.ArrayCreate: return DeserializeArrayCreateScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.ArrayIndexer: + case QLScalarExpressionKind.ArrayIndexer: return DeserializeArrayIndexerScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.BinaryOperator: + case QLScalarExpressionKind.BinaryOperator: return DeserializeBinaryOperatorScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.IsOperator: + case QLScalarExpressionKind.IsOperator: return DeserializeIsOperatorScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.Let: + case QLScalarExpressionKind.Let: return DeserializeLetScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.Literal: + case QLScalarExpressionKind.Literal: return DeserializeLiteralScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.Mux: + case QLScalarExpressionKind.Mux: return DeserializeMuxScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.ObjectCreate: + case QLScalarExpressionKind.ObjectCreate: return DeserializeObjectCreateScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.PropertyRef: + case QLScalarExpressionKind.PropertyRef: return DeserializePropertyRefScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.SystemFunctionCall: + case QLScalarExpressionKind.SystemFunctionCall: return DeserializeSystemFunctionCallScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.TupleCreate: + case QLScalarExpressionKind.TupleCreate: return DeserializeTupleCreateScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.TupleItemRef: + case QLScalarExpressionKind.TupleItemRef: return DeserializeTupleItemRefScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.UnaryOperator: + case QLScalarExpressionKind.UnaryOperator: return DeserializeUnaryScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.UserDefinedFunctionCall: + case QLScalarExpressionKind.UserDefinedFunctionCall: return DeserializeUserDefinedFunctionCallScalarExpression(cosmosObject); - case ClientQLScalarExpressionKind.VariableRef: + case QLScalarExpressionKind.VariableRef: return DeserializeVariableRefScalarExpression(cosmosObject); default: - throw new NotSupportedException($"Invalid ClientQLExpression kind: {scalarExpressionKind}"); + throw new NotSupportedException($"Invalid QLExpression kind: {scalarExpressionKind}"); } } - private static ClientQLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(CosmosObject cosmosObject) + private static QLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(CosmosObject cosmosObject) { - ClientQLArrayKind arrayKind = GetEnumValue(GetValue(cosmosObject, Constants.ArrayKind).Value); - IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); - return new ClientQLArrayCreateScalarExpression(arrayKind, items); + QLArrayKind arrayKind = GetEnumValue(GetValue(cosmosObject, Constants.ArrayKind).Value); + IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); + return new QLArrayCreateScalarExpression(arrayKind, items); } - private static ClientQLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(CosmosObject cosmosObject) + private static QLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); long index = Number64.ToLong(GetValue(cosmosObject, Constants.Index).Value); - return new ClientQLArrayIndexerScalarExpression(expression, index); + return new QLArrayIndexerScalarExpression(expression, index); } - private static ClientQLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(CosmosObject cosmosObject) + private static QLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(CosmosObject cosmosObject) { - ClientQLBinaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - ClientQLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); - ClientQLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); - return new ClientQLBinaryScalarExpression(operatorKind, leftExpression, rightExpression); + QLBinaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + QLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); + QLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); + return new QLBinaryScalarExpression(operatorKind, leftExpression, rightExpression); } - private static ClientQLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(CosmosObject cosmosObject) + private static QLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(CosmosObject cosmosObject) { - ClientQLIsOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new ClientQLIsOperatorScalarExpression(operatorKind, expression); + QLIsOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new QLIsOperatorScalarExpression(operatorKind, expression); } - private static ClientQLLetScalarExpression DeserializeLetScalarExpression(CosmosObject cosmosObject) + private static QLLetScalarExpression DeserializeLetScalarExpression(CosmosObject cosmosObject) { - ClientQLVariable declaredVariable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - ClientQLScalarExpression declaredVariableExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.DeclaredVariableExpression)); - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new ClientQLLetScalarExpression(declaredVariable, declaredVariableExpression, expression); + QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + QLScalarExpression declaredVariableExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.DeclaredVariableExpression)); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new QLLetScalarExpression(declaredVariable, declaredVariableExpression, expression); } - private static ClientQLLiteralScalarExpression DeserializeLiteralScalarExpression(CosmosObject cosmosObject) + private static QLLiteralScalarExpression DeserializeLiteralScalarExpression(CosmosObject cosmosObject) { CosmosObject literalObject = GetValue(cosmosObject, Constants.Literal); - return new ClientQLLiteralScalarExpression(DeserializeClientQLLiteral(literalObject)); + return new QLLiteralScalarExpression(DeserializeQLLiteral(literalObject)); } - private static ClientQLMuxScalarExpression DeserializeMuxScalarExpression(CosmosObject cosmosObject) + private static QLMuxScalarExpression DeserializeMuxScalarExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression conditionExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.ConditionExpression)); - ClientQLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); - ClientQLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); - return new ClientQLMuxScalarExpression(conditionExpression, leftExpression, rightExpression); + QLScalarExpression conditionExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.ConditionExpression)); + QLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); + QLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); + return new QLMuxScalarExpression(conditionExpression, leftExpression, rightExpression); } - private static ClientQLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(CosmosObject cosmosObject) + private static QLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(CosmosObject cosmosObject) { - ClientQLObjectKind objectKind = GetEnumValue(GetValue(cosmosObject, Constants.ObjectKind).Value); - IReadOnlyList properties = DeserializeObjectProperties(GetValue(cosmosObject, Constants.Properties)); - return new ClientQLObjectCreateScalarExpression(properties, objectKind); + QLObjectKind objectKind = GetEnumValue(GetValue(cosmosObject, Constants.ObjectKind).Value); + IReadOnlyList properties = DeserializeObjectProperties(GetValue(cosmosObject, Constants.Properties)); + return new QLObjectCreateScalarExpression(properties, objectKind); } - private static ClientQLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(CosmosObject cosmosObject) + private static QLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); string propertyName = GetValue(cosmosObject, Constants.PropertyName).Value; - return new ClientQLPropertyRefScalarExpression(expression, propertyName); + return new QLPropertyRefScalarExpression(expression, propertyName); } - private static ClientQLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(CosmosObject cosmosObject) + private static QLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(CosmosObject cosmosObject) { - ClientQLBuiltinScalarFunctionKind functionKind = GetEnumValue(GetValue(cosmosObject, Constants.FunctionKind).Value); - IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); - return new ClientQLSystemFunctionCallScalarExpression(functionKind, arguments); + QLBuiltinScalarFunctionKind functionKind = GetEnumValue(GetValue(cosmosObject, Constants.FunctionKind).Value); + IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); + return new QLSystemFunctionCallScalarExpression(functionKind, arguments); } - private static ClientQLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(CosmosObject cosmosObject) + private static QLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(CosmosObject cosmosObject) { - IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); - return new ClientQLTupleCreateScalarExpression(items); + IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); + return new QLTupleCreateScalarExpression(items); } - private static ClientQLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(CosmosObject cosmosObject) + private static QLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(CosmosObject cosmosObject) { - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); long index = Number64.ToLong(GetValue(cosmosObject, Constants.Index).Value); - return new ClientQLTupleItemRefScalarExpression(expression, index); + return new QLTupleItemRefScalarExpression(expression, index); } - private static ClientQLUnaryScalarExpression DeserializeUnaryScalarExpression(CosmosObject cosmosObject) + private static QLUnaryScalarExpression DeserializeUnaryScalarExpression(CosmosObject cosmosObject) { - ClientQLUnaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new ClientQLUnaryScalarExpression(operatorKind, expression); + QLUnaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new QLUnaryScalarExpression(operatorKind, expression); } - private static ClientQLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(CosmosObject cosmosObject) + private static QLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(CosmosObject cosmosObject) { string identifierString = GetValue(cosmosObject, Constants.Identifier).Value; - ClientQLFunctionIdentifier functionIdentifier = new ClientQLFunctionIdentifier(identifierString); - IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); + QLFunctionIdentifier functionIdentifier = new QLFunctionIdentifier(identifierString); + IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); bool builtin = GetValue(cosmosObject, Constants.Builtin).Value; - return new ClientQLUserDefinedFunctionCallScalarExpression(functionIdentifier, arguments, builtin); + return new QLUserDefinedFunctionCallScalarExpression(functionIdentifier, arguments, builtin); } - private static ClientQLVariableRefScalarExpression DeserializeVariableRefScalarExpression(CosmosObject cosmosObject) + private static QLVariableRefScalarExpression DeserializeVariableRefScalarExpression(CosmosObject cosmosObject) { - ClientQLVariable variable = DeserializeClientQLVariable(GetValue(cosmosObject, Constants.Variable)); - return new ClientQLVariableRefScalarExpression(variable); + QLVariable variable = DeserializeQLVariable(GetValue(cosmosObject, Constants.Variable)); + return new QLVariableRefScalarExpression(variable); } #endregion #region Literal Expressions - private static ClientQLLiteral DeserializeClientQLLiteral(CosmosObject cosmosObject) + private static QLLiteral DeserializeQLLiteral(CosmosObject cosmosObject) { - ClientQLLiteralKind literalKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); + QLLiteralKind literalKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); switch (literalKind) { - case ClientQLLiteralKind.Undefined: - return ClientQLUndefinedLiteral.Singleton; - case ClientQLLiteralKind.Array: - return new ClientQLArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); - case ClientQLLiteralKind.Binary: - return new ClientQLBinaryLiteral(DeserializeBinaryArray(GetValue(cosmosObject, Constants.Value))); - case ClientQLLiteralKind.Boolean: - return new ClientQLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); - case ClientQLLiteralKind.CGuid: - return new ClientQLCGuidLiteral(GetValue(cosmosObject, Constants.Value).Value); - case ClientQLLiteralKind.CNumber: - return new ClientQLCNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case ClientQLLiteralKind.MDateTime: - return new ClientQLMDateTimeLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case ClientQLLiteralKind.MJavaScript: - return new ClientQLMJavaScriptLiteral(GetValue(cosmosObject, Constants.Name).Value); - case ClientQLLiteralKind.MNumber: - return new ClientQLMNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case ClientQLLiteralKind.MRegex: + case QLLiteralKind.Undefined: + return QLUndefinedLiteral.Singleton; + case QLLiteralKind.Array: + return new QLArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); + case QLLiteralKind.Binary: + return new QLBinaryLiteral(DeserializeBinaryArray(GetValue(cosmosObject, Constants.Value))); + case QLLiteralKind.Boolean: + return new QLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); + case QLLiteralKind.CGuid: + return new QLCGuidLiteral(GetValue(cosmosObject, Constants.Value).Value); + case QLLiteralKind.CNumber: + return new QLCNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); + case QLLiteralKind.MDateTime: + return new QLMDateTimeLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); + case QLLiteralKind.MJavaScript: + return new QLMJavaScriptLiteral(GetValue(cosmosObject, Constants.Name).Value); + case QLLiteralKind.MNumber: + return new QLMNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); + case QLLiteralKind.MRegex: string pattern = GetValue(cosmosObject, Constants.Pattern).Value; string options = GetValue(cosmosObject, Constants.Options).Value; - return new ClientQLMRegexLiteral(pattern, options); - case ClientQLLiteralKind.MSingleton: - return new ClientQLMSingletonLiteral(GetEnumValue(GetValue(cosmosObject, Constants.SingletonKind).Value)); - case ClientQLLiteralKind.MSymbol: - return new ClientQLMSymbolLiteral(GetValue(cosmosObject, Constants.Value).Value); - case ClientQLLiteralKind.Null: - return ClientQLNullLiteral.Singleton; - case ClientQLLiteralKind.Number: - return new ClientQLNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case ClientQLLiteralKind.Object: - return new ClientQLObjectLiteral(DeserializeObjectLiteralArray(GetValue(cosmosObject, Constants.Properties))); - case ClientQLLiteralKind.String: - return new ClientQLStringLiteral(GetValue(cosmosObject, Constants.Value).Value); + return new QLMRegexLiteral(pattern, options); + case QLLiteralKind.MSingleton: + return new QLMSingletonLiteral(GetEnumValue(GetValue(cosmosObject, Constants.SingletonKind).Value)); + case QLLiteralKind.MSymbol: + return new QLMSymbolLiteral(GetValue(cosmosObject, Constants.Value).Value); + case QLLiteralKind.Null: + return QLNullLiteral.Singleton; + case QLLiteralKind.Number: + return new QLNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); + case QLLiteralKind.Object: + return new QLObjectLiteral(DeserializeObjectLiteralArray(GetValue(cosmosObject, Constants.Properties))); + case QLLiteralKind.String: + return new QLStringLiteral(GetValue(cosmosObject, Constants.Value).Value); default: - throw new NotSupportedException($"Invalid ClientQLExpression kind: {literalKind}"); + throw new NotSupportedException($"Invalid QLExpression kind: {literalKind}"); } } - private static ClientQLAggregate DeserializeAggregate(CosmosObject cosmosObject) + private static QLAggregate DeserializeAggregate(CosmosObject cosmosObject) { - ClientQLAggregateKind aggregateKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); + QLAggregateKind aggregateKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); switch (aggregateKind) { - case ClientQLAggregateKind.Tuple: + case QLAggregateKind.Tuple: return DeserializeTupleAggregateExpression(cosmosObject); - case ClientQLAggregateKind.Builtin: + case QLAggregateKind.Builtin: return DeserializeBuiltInAggregateExpression(cosmosObject); default: - throw new NotSupportedException($"Invalid ClientQLExpression kind: {aggregateKind}"); + throw new NotSupportedException($"Invalid QLExpression kind: {aggregateKind}"); } } - private static ClientQLVariable DeserializeClientQLVariable(CosmosObject cosmosObject) + private static QLVariable DeserializeQLVariable(CosmosObject cosmosObject) { string name = GetValue(cosmosObject, Constants.Name).Value; long uniqueId = Number64.ToLong(GetValue(cosmosObject, Constants.UniqueId).Value); - return new ClientQLVariable(name, uniqueId); + return new QLVariable(name, uniqueId); } - private static ClientQLBuiltinAggregate DeserializeBuiltInAggregateExpression(CosmosObject cosmosObject) + private static QLBuiltinAggregate DeserializeBuiltInAggregateExpression(CosmosObject cosmosObject) { - ClientQLAggregateOperatorKind aggregateOperatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - return new ClientQLBuiltinAggregate(aggregateOperatorKind); + QLAggregateOperatorKind aggregateOperatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + return new QLBuiltinAggregate(aggregateOperatorKind); } - private static ClientQLTupleAggregate DeserializeTupleAggregateExpression(CosmosObject cosmosObject) + private static QLTupleAggregate DeserializeTupleAggregateExpression(CosmosObject cosmosObject) { CosmosArray propertyArray = GetValue(cosmosObject, Constants.Items); - List expression = new List(propertyArray.Count); + List expression = new List(propertyArray.Count); foreach (CosmosElement propertyElement in propertyArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - ClientQLAggregate aggregateExpression = DeserializeAggregate(propertyObject); + QLAggregate aggregateExpression = DeserializeAggregate(propertyObject); expression.Add(aggregateExpression); } - return new ClientQLTupleAggregate(expression); + return new QLTupleAggregate(expression); } - private static IReadOnlyList DeserializeObjectProperties(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeObjectProperties(CosmosArray cosmosArray) { - List properties = new List(cosmosArray.Count); + List properties = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); string objectPropertyName = GetValue(propertyObject, Constants.Name).Value; - ClientQLScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); - properties.Add(new ClientQLObjectProperty(objectPropertyName, expression)); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); + properties.Add(new QLObjectProperty(objectPropertyName, expression)); } return properties; } - private static IReadOnlyList DeserializeScalarExpressionArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeScalarExpressionArray(CosmosArray cosmosArray) { - List expressions = new List(cosmosArray.Count); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - ClientQLScalarExpression expression = DeserializeScalarExpression(propertyObject); + QLScalarExpression expression = DeserializeScalarExpression(propertyObject); expressions.Add(expression); } return expressions; } - private static IReadOnlyList DeserializeOrderByItemArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeOrderByItemArray(CosmosArray cosmosArray) { - List expressions = new List(cosmosArray.Count); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - ClientQLSortOrder sortOrder = GetEnumValue(GetValue(propertyObject, Constants.SortOrder).Value); - ClientQLScalarExpression scalarExpression = DeserializeScalarExpression(propertyObject); - expressions.Add(new ClientQLOrderByItem(scalarExpression, sortOrder)); + QLSortOrder sortOrder = GetEnumValue(GetValue(propertyObject, Constants.SortOrder).Value); + QLScalarExpression scalarExpression = DeserializeScalarExpression(propertyObject); + expressions.Add(new QLOrderByItem(scalarExpression, sortOrder)); } return expressions; } - private static IReadOnlyList DeserializeAggregateArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeAggregateArray(CosmosArray cosmosArray) { - List expressions = new List(cosmosArray.Count); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); @@ -473,27 +474,27 @@ private static IReadOnlyList DeserializeAggregateArray(Cosmos return expressions; } - private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosmosArray) { - List expressions = new List(cosmosArray.Count); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - expressions.Add(DeserializeClientQLLiteral(propertyObject)); + expressions.Add(DeserializeQLLiteral(propertyObject)); } return expressions; } - private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) { - List expressions = new List(cosmosArray.Count); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); string name = GetValue(propertyObject, Constants.Name).Value; - ClientQLLiteral literal = DeserializeClientQLLiteral(propertyObject); - ClientQLObjectLiteralProperty objectLiteralProperty = new ClientQLObjectLiteralProperty(name, literal); + QLLiteral literal = DeserializeQLLiteral(propertyObject); + QLObjectLiteralProperty objectLiteralProperty = new QLObjectLiteralProperty(name, literal); expressions.Add(objectLiteralProperty); } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs similarity index 72% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs index 7dea7be63f..a7a89405cc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/CoordinatorDistributionPlan.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { internal class CoordinatorDistributionPlan { - public CoordinatorDistributionPlan(ClientQLExpression clientQL) + public CoordinatorDistributionPlan(QLExpression clientQL) { this.ClientQL = clientQL; } - public ClientQLExpression ClientQL { get; } + public QLExpression ClientQL { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs index 978fddd62f..850dbb2497 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal abstract class ClientQLType + internal abstract class QLAggregate { - public ClientQLType(ClientQLTypeKind kind) + public QLAggregate(QLAggregateKind kind) { this.Kind = kind; } - public ClientQLTypeKind Kind { get; } + public QLAggregateKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs new file mode 100644 index 0000000000..70226a99ea --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLAggregateEnumerableExpression : QLEnumerableExpression + { + public QLAggregateEnumerableExpression(QLEnumerableExpression sourceExpression, QLAggregate aggregate) + : base(QLEnumerableExpressionKind.Aggregate) + { + this.SourceExpression = sourceExpression; + this.Aggregate = aggregate; + } + + public QLEnumerableExpression SourceExpression { get; } + + public QLAggregate Aggregate { get; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateKind.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateKind.cs index 774a5c1577..e1d156240e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLAggregateKind + internal enum QLAggregateKind { Builtin, Tuple, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateOperatorKind.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateOperatorKind.cs index 94fc4816a5..a64c9e23f7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregateOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateOperatorKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLAggregateOperatorKind + internal enum QLAggregateOperatorKind { All, Any, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs similarity index 50% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs index 35c9209801..5e66ce967f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs @@ -2,22 +2,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLArrayCreateScalarExpression : ClientQLScalarExpression + internal class QLArrayCreateScalarExpression : QLScalarExpression { - public ClientQLArrayCreateScalarExpression(ClientQLArrayKind arrayKind, IReadOnlyList items) - : base(ClientQLScalarExpressionKind.ArrayCreate) + public QLArrayCreateScalarExpression(QLArrayKind arrayKind, IReadOnlyList items) + : base(QLScalarExpressionKind.ArrayCreate) { this.ArrayKind = arrayKind; this.Items = items; } - public ClientQLArrayKind ArrayKind { get; } + public QLArrayKind ArrayKind { get; } - public IReadOnlyList Items { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs similarity index 55% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs index 2d2415de95..e8c425bafc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleItemRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs @@ -2,18 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLTupleItemRefScalarExpression : ClientQLScalarExpression + internal class QLArrayIndexerScalarExpression : QLScalarExpression { - public ClientQLTupleItemRefScalarExpression(ClientQLScalarExpression expression, long index) - : base(ClientQLScalarExpressionKind.TupleItemRef) + public QLArrayIndexerScalarExpression(QLScalarExpression expression, long index) + : base(QLScalarExpressionKind.ArrayIndexer) { this.Expression = expression; this.Index = index; } - public ClientQLScalarExpression Expression { get; } + public QLScalarExpression Expression { get; } public long Index { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayKind.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayKind.cs index 731ebcdba2..0dd59532ed 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLArrayKind + internal enum QLArrayKind { Array, CList, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayLiteral.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayLiteral.cs index 5be8d17dd2..1244c2c96f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayLiteral.cs @@ -2,18 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLArrayLiteral : ClientQLLiteral + internal class QLArrayLiteral : QLLiteral { - public ClientQLArrayLiteral(IReadOnlyList items) - : base(ClientQLLiteralKind.Array) + public QLArrayLiteral(IReadOnlyList items) + : base(QLLiteralKind.Array) { this.Items = items; } - public IReadOnlyList Items { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseType.cs similarity index 70% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseType.cs index 00704ed595..dae641caef 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseType.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLBaseType : ClientQLType + internal class QLBaseType : QLType { - public ClientQLBaseType(bool excludesUndefined) - : base(ClientQLTypeKind.Base) + public QLBaseType(bool excludesUndefined) + : base(QLTypeKind.Base) { this.ExcludesUndefined = excludesUndefined; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseTypeKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseTypeKind.cs similarity index 90% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseTypeKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseTypeKind.cs index 4d3cec7911..0e9c68d759 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBaseTypeKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseTypeKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLBaseTypeKind + internal enum QLBaseTypeKind { Array, Binary, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs similarity index 70% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs index cded07dc10..23a593b894 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System; using System.Collections.Generic; - internal class ClientQLBinaryLiteral : ClientQLLiteral + internal class QLBinaryLiteral : QLLiteral { - public ClientQLBinaryLiteral(byte[] value) - : base(ClientQLLiteralKind.Binary) + public QLBinaryLiteral(byte[] value) + : base(QLLiteralKind.Binary) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs new file mode 100644 index 0000000000..a5b7f7e367 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLBinaryScalarExpression : QLScalarExpression + { + public QLBinaryScalarExpression(QLBinaryScalarOperatorKind operatorKind, QLScalarExpression leftExpression, QLScalarExpression rightExpression) + : base(QLScalarExpressionKind.BinaryOperator) + { + this.OperatorKind = operatorKind; + this.LeftExpression = leftExpression; + this.RightExpression = rightExpression; + } + + public QLBinaryScalarOperatorKind OperatorKind { get; } + + public QLScalarExpression LeftExpression { get; } + + public QLScalarExpression RightExpression { get; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarOperatorKind.cs similarity index 90% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarOperatorKind.cs index ec8b2a8529..9e9780fbf8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBinaryScalarOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarOperatorKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLBinaryScalarOperatorKind + internal enum QLBinaryScalarOperatorKind { Add, And, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBooleanLiteral.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBooleanLiteral.cs index 0cd571cfac..cf3a5d93dd 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBooleanLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBooleanLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLBooleanLiteral : ClientQLLiteral + internal class QLBooleanLiteral : QLLiteral { - public ClientQLBooleanLiteral(bool value) - : base(ClientQLLiteralKind.Boolean) + public QLBooleanLiteral(bool value) + : base(QLLiteralKind.Boolean) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinAggregate.cs similarity index 54% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinAggregate.cs index bdb40aaac2..1a5b0bf9c5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinAggregate.cs @@ -2,16 +2,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLBuiltinAggregate : ClientQLAggregate + internal class QLBuiltinAggregate : QLAggregate { - public ClientQLBuiltinAggregate(ClientQLAggregateOperatorKind operatorKind) - : base(ClientQLAggregateKind.Builtin) + public QLBuiltinAggregate(QLAggregateOperatorKind operatorKind) + : base(QLAggregateKind.Builtin) { this.OperatorKind = operatorKind; } - public ClientQLAggregateOperatorKind OperatorKind { get; } + public QLAggregateOperatorKind OperatorKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinScalarFunctionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs similarity index 98% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinScalarFunctionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs index 6883f7b805..d28656cb06 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLBuiltinScalarFunctionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLBuiltinScalarFunctionKind + internal enum QLBuiltinScalarFunctionKind { _C_Compare_EQ, _C_Compare_GT, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCGuidLiteral.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCGuidLiteral.cs index 3e6a12c597..9545575d76 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCGuidLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCGuidLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLCGuidLiteral : ClientQLLiteral + internal class QLCGuidLiteral : QLLiteral { - public ClientQLCGuidLiteral(System.Guid value) - : base(ClientQLLiteralKind.CGuid) + public QLCGuidLiteral(System.Guid value) + : base(QLLiteralKind.CGuid) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCNumberLiteral.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCNumberLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCNumberLiteral.cs index 4ac3f6093d..aa129b3fae 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLCNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCNumberLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLCNumberLiteral : ClientQLLiteral + internal class QLCNumberLiteral : QLLiteral { - public ClientQLCNumberLiteral(long value) - : base(ClientQLLiteralKind.CNumber) + public QLCNumberLiteral(long value) + : base(QLLiteralKind.CNumber) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs new file mode 100644 index 0000000000..0d04d7e43e --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + using System.Collections.Generic; + + internal class QLDistinctEnumerableExpression : QLEnumerableExpression + { + public QLDistinctEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, IReadOnlyList expression) + : base(QLEnumerableExpressionKind.Distinct) + { + this.SourceExpression = sourceExpression; + this.DeclaredVariable = declaredVariable; + this.Expression = expression; + } + + public QLEnumerableExpression SourceExpression { get; } + + public QLVariable DeclaredVariable { get; } + + public IReadOnlyList Expression { get; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumType.cs similarity index 60% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumType.cs index 1179ff82c6..5498848c95 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumType.cs @@ -2,16 +2,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLEnumType : ClientQLType + internal class QLEnumType : QLType { - public ClientQLEnumType(ClientQLType itemType) - : base(ClientQLTypeKind.Enum) + public QLEnumType(QLType itemType) + : base(QLTypeKind.Enum) { this.ItemType = itemType; } - public ClientQLType ItemType { get; } + public QLType ItemType { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs index 4896ded0bf..460ca5ff06 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal abstract class ClientQLScalarExpression : ClientQLExpression + internal abstract class QLEnumerableExpression : QLExpression { - public ClientQLScalarExpression(ClientQLScalarExpressionKind kind) + public QLEnumerableExpression(QLEnumerableExpressionKind kind) { this.Kind = kind; } - public ClientQLScalarExpressionKind Kind { get; } + public QLEnumerableExpressionKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpressionKind.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpressionKind.cs index 6a46b1ed98..950b83630f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerableExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpressionKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLEnumerableExpressionKind + internal enum QLEnumerableExpressionKind { Aggregate, Distinct, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerationKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerationKind.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerationKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerationKind.cs index 744aff72d4..fb23ddd0ce 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLEnumerationKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerationKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLEnumerationKind + internal enum QLEnumerationKind { ArrayItems, PropertyValues, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLExpression.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLExpression.cs index c33801d1e2..9cc9e47410 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLExpression.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal abstract class ClientQLExpression + internal abstract class QLExpression { // Decided to keep this empty as it does not provide new information } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs similarity index 75% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs index 03da12f4c3..08420d515f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLFunctionIdentifier.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs @@ -2,11 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLFunctionIdentifier + internal class QLFunctionIdentifier { - public ClientQLFunctionIdentifier(string name) + public QLFunctionIdentifier(string name) { this.Name = name; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs similarity index 52% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs index 0871c7e176..aac8b5ca55 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs @@ -2,25 +2,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLGroupByEnumerableExpression : ClientQLEnumerableExpression + internal class QLGroupByEnumerableExpression : QLEnumerableExpression { - public ClientQLGroupByEnumerableExpression(ClientQLEnumerableExpression sourceExpression, ulong keyCount, IReadOnlyList aggregates) - : base(ClientQLEnumerableExpressionKind.GroupBy) + public QLGroupByEnumerableExpression(QLEnumerableExpression sourceExpression, ulong keyCount, IReadOnlyList aggregates) + : base(QLEnumerableExpressionKind.GroupBy) { this.SourceExpression = sourceExpression; this.KeyCount = keyCount; this.Aggregates = aggregates; } - public ClientQLEnumerableExpression SourceExpression { get; } + public QLEnumerableExpression SourceExpression { get; } public ulong KeyCount { get; } - public IReadOnlyList Aggregates { get; } + public IReadOnlyList Aggregates { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByKey.cs similarity index 68% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByKey.cs index 04deb6bdab..166b95387f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLGroupByKey.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByKey.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLGroupByKey + internal class QLGroupByKey { - public ClientQLGroupByKey(ClientQLType type) + public QLGroupByKey(QLType type) { this.Type = type; } - public ClientQLType Type { get; } + public QLType Type { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs similarity index 61% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs index 2c33292402..e1b9004e8e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLInputEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLInputEnumerableExpression : ClientQLEnumerableExpression + internal class QLInputEnumerableExpression : QLEnumerableExpression { - public ClientQLInputEnumerableExpression(string name) - : base(ClientQLEnumerableExpressionKind.Input) + public QLInputEnumerableExpression(string name) + : base(QLEnumerableExpressionKind.Input) { this.Name = name; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorKind.cs similarity index 83% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorKind.cs index 03fc6fffd6..f90fb7b84b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLIsOperatorKind + internal enum QLIsOperatorKind { Defined, } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs similarity index 51% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs index dc7c8f71ea..78436562c2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLIsOperatorScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs @@ -2,22 +2,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLIsOperatorScalarExpression : ClientQLScalarExpression + internal class QLIsOperatorScalarExpression : QLScalarExpression { - public ClientQLIsOperatorScalarExpression(ClientQLIsOperatorKind operatorKind, ClientQLScalarExpression expression) - : base(ClientQLScalarExpressionKind.IsOperator) + public QLIsOperatorScalarExpression(QLIsOperatorKind operatorKind, QLScalarExpression expression) + : base(QLScalarExpressionKind.IsOperator) { this.OperatorKind = operatorKind; this.Expression = expression; } - public ClientQLIsOperatorKind OperatorKind { get; } + public QLIsOperatorKind OperatorKind { get; } - public ClientQLScalarExpression Expression { get; } + public QLScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs similarity index 50% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs index f3b4b864ab..f24af3e60c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLetScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs @@ -2,25 +2,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLLetScalarExpression : ClientQLScalarExpression + internal class QLLetScalarExpression : QLScalarExpression { - public ClientQLLetScalarExpression(ClientQLVariable declaredVariable, ClientQLScalarExpression declaredVariableExpression, ClientQLScalarExpression expression) - : base(ClientQLScalarExpressionKind.Let) + public QLLetScalarExpression(QLVariable declaredVariable, QLScalarExpression declaredVariableExpression, QLScalarExpression expression) + : base(QLScalarExpressionKind.Let) { this.DeclaredVariable = declaredVariable; this.DeclaredVariableExpression = declaredVariableExpression; this.Expression = expression; } - public ClientQLVariable DeclaredVariable { get; } + public QLVariable DeclaredVariable { get; } - public ClientQLScalarExpression DeclaredVariableExpression { get; } + public QLScalarExpression DeclaredVariableExpression { get; } - public ClientQLScalarExpression Expression { get; } + public QLScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs similarity index 65% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs index ad1b945d99..f0947f47b7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal abstract class ClientQLLiteral + internal abstract class QLLiteral { - public ClientQLLiteral(ClientQLLiteralKind kind) + public QLLiteral(QLLiteralKind kind) { this.Kind = kind; } - public ClientQLLiteralKind Kind { get; } + public QLLiteralKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralKind.cs similarity index 91% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralKind.cs index b1cdbc902b..1c5b7acf1d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLLiteralKind + internal enum QLLiteralKind { Undefined, Array, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs similarity index 54% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs index 3148df56c6..7113704554 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLLiteralScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs @@ -2,17 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLLiteralScalarExpression : ClientQLScalarExpression + internal class QLLiteralScalarExpression : QLScalarExpression { - public ClientQLLiteralScalarExpression(ClientQLLiteral literal) - : base(ClientQLScalarExpressionKind.Literal) + public QLLiteralScalarExpression(QLLiteral literal) + : base(QLScalarExpressionKind.Literal) { this.Literal = literal; } - public ClientQLLiteral Literal { get; } + public QLLiteral Literal { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMDateTimeLiteral.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMDateTimeLiteral.cs index 5361731825..a326370571 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMDateTimeLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLMNumberLiteral : ClientQLLiteral + internal class QLMDateTimeLiteral : QLLiteral { - public ClientQLMNumberLiteral(long value) - : base(ClientQLLiteralKind.MNumber) + public QLMDateTimeLiteral(long value) + : base(QLLiteralKind.MDateTime) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs similarity index 65% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs index bc65e4a9d1..768f9b96bb 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMJavaScriptLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLMJavaScriptLiteral : ClientQLLiteral + internal class QLMJavaScriptLiteral : QLLiteral { - public ClientQLMJavaScriptLiteral(string name) - : base(ClientQLLiteralKind.MJavaScript) + public QLMJavaScriptLiteral(string name) + : base(QLLiteralKind.MJavaScript) { this.Name = name; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMNumberLiteral.cs similarity index 66% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMNumberLiteral.cs index 466db7854a..c0d3911009 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMDateTimeLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMNumberLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLMDateTimeLiteral : ClientQLLiteral + internal class QLMNumberLiteral : QLLiteral { - public ClientQLMDateTimeLiteral(long value) - : base(ClientQLLiteralKind.MDateTime) + public QLMNumberLiteral(long value) + : base(QLLiteralKind.MNumber) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMRegexLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs similarity index 70% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMRegexLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs index 6b237db511..67cb0b5380 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMRegexLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLMRegexLiteral : ClientQLLiteral + internal class QLMRegexLiteral : QLLiteral { - public ClientQLMRegexLiteral(string pattern, string options) - : base(ClientQLLiteralKind.MRegex) + public QLMRegexLiteral(string pattern, string options) + : base(QLLiteralKind.MRegex) { this.Pattern = pattern; this.Options = options; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSingletonLiteral.cs similarity index 72% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSingletonLiteral.cs index 70409a0629..ac6c792151 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSingletonLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSingletonLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLMSingletonLiteral : ClientQLLiteral + internal class QLMSingletonLiteral : QLLiteral { - public ClientQLMSingletonLiteral(Kind singletonKind) - : base(ClientQLLiteralKind.MSingleton) + public QLMSingletonLiteral(Kind singletonKind) + : base(QLLiteralKind.MSingleton) { this.SingletonKind = singletonKind; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs index 54574016a3..a163eabc33 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLStringLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLStringLiteral : ClientQLLiteral + internal class QLMSymbolLiteral : QLLiteral { - public ClientQLStringLiteral(string value) - : base(ClientQLLiteralKind.String) + public QLMSymbolLiteral(string value) + : base(QLLiteralKind.MSymbol) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs new file mode 100644 index 0000000000..cdd4f7b7bf --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLMuxScalarExpression : QLScalarExpression + { + public QLMuxScalarExpression(QLScalarExpression conditionExpression, QLScalarExpression leftExpression, QLScalarExpression rightExpression) + : base(QLScalarExpressionKind.Mux) + { + this.ConditionExpression = conditionExpression; + this.LeftExpression = leftExpression; + this.RightExpression = rightExpression; + } + + public QLScalarExpression ConditionExpression { get; } + + public QLScalarExpression LeftExpression { get; } + + public QLScalarExpression RightExpression { get; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNullLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNullLiteral.cs new file mode 100644 index 0000000000..171bdf994a --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNullLiteral.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLNullLiteral : QLLiteral + { + public static readonly QLNullLiteral Singleton = new QLNullLiteral(); + + private QLNullLiteral() + : base(QLLiteralKind.Null) + { + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs similarity index 69% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs index 0ef8d5c1f0..eee16281fc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs @@ -2,14 +2,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLNumberLiteral : ClientQLLiteral + internal class QLNumberLiteral : QLLiteral { - public ClientQLNumberLiteral(long value) - : base(ClientQLLiteralKind.Number) + public QLNumberLiteral(long value) + : base(QLLiteralKind.Number) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs similarity index 50% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs index 12c01b160a..055352795f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs @@ -2,22 +2,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLObjectCreateScalarExpression : ClientQLScalarExpression + internal class QLObjectCreateScalarExpression : QLScalarExpression { - public ClientQLObjectCreateScalarExpression(IReadOnlyList properties, ClientQLObjectKind objectKind) - : base(ClientQLScalarExpressionKind.ObjectCreate) + public QLObjectCreateScalarExpression(IReadOnlyList properties, QLObjectKind objectKind) + : base(QLScalarExpressionKind.ObjectCreate) { this.Properties = properties; this.ObjectKind = objectKind; } - public IReadOnlyList Properties { get; } + public IReadOnlyList Properties { get; } - public ClientQLObjectKind ObjectKind { get; } + public QLObjectKind ObjectKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectKind.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectKind.cs index 20fa4a17f4..543b481b86 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLObjectKind + internal enum QLObjectKind { CUdt, Object diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs similarity index 55% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs index f9b89bc861..235449f7bc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs @@ -2,18 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLObjectLiteral : ClientQLLiteral + internal class QLObjectLiteral : QLLiteral { - public ClientQLObjectLiteral(IReadOnlyList properties) - : base(ClientQLLiteralKind.Object) + public QLObjectLiteral(IReadOnlyList properties) + : base(QLLiteralKind.Object) { this.Properties = properties; } - public IReadOnlyList Properties { get; } + public IReadOnlyList Properties { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs similarity index 66% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs index 44a3240dc0..2af3016704 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectLiteralProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs @@ -2,11 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLObjectLiteralProperty + internal class QLObjectLiteralProperty { - public ClientQLObjectLiteralProperty(string name, ClientQLLiteral literal) + public QLObjectLiteralProperty(string name, QLLiteral literal) { this.Name = name; this.Literal = literal; @@ -14,6 +14,6 @@ public ClientQLObjectLiteralProperty(string name, ClientQLLiteral literal) public string Name { get; } - public ClientQLLiteral Literal { get; } + public QLLiteral Literal { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs similarity index 66% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs index b947b7fbac..43555930fe 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLObjectProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs @@ -2,11 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLObjectProperty + internal class QLObjectProperty { - public ClientQLObjectProperty(string name, ClientQLScalarExpression expression) + public QLObjectProperty(string name, QLScalarExpression expression) { this.Name = name; this.Expression = expression; @@ -14,6 +14,6 @@ public ClientQLObjectProperty(string name, ClientQLScalarExpression expression) public string Name { get; } - public ClientQLScalarExpression Expression { get; } + public QLScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs new file mode 100644 index 0000000000..f5ab5b799d --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + using System.Collections.Generic; + + internal class QLOrderByEnumerableExpression : QLEnumerableExpression + { + public QLOrderByEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, IReadOnlyList items) + : base(QLEnumerableExpressionKind.OrderBy) + { + this.SourceExpression = sourceExpression; + this.DeclaredVariable = declaredVariable; + this.Items = items; + } + + public QLEnumerableExpression SourceExpression { get; } + + public QLVariable DeclaredVariable { get; } + + public IReadOnlyList Items { get; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs index 18042582af..b01a1330f7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLOrderByItem.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs @@ -2,18 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLOrderByItem + internal class QLOrderByItem { - public ClientQLOrderByItem(ClientQLScalarExpression expression, ClientQLSortOrder sortOrder) + public QLOrderByItem(QLScalarExpression expression, QLSortOrder sortOrder) { this.Expression = expression; this.SortOrder = sortOrder; } - public ClientQLScalarExpression Expression { get; } + public QLScalarExpression Expression { get; } - public ClientQLSortOrder SortOrder { get; } + public QLSortOrder SortOrder { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLProgram.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLProgram.cs new file mode 100644 index 0000000000..396b2c76b3 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLProgram.cs @@ -0,0 +1,11 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLProgram + { + public QLEnumerableExpression Expression { get; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs index ed56e51fe9..2ea78b775e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLPropertyRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs @@ -2,20 +2,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLPropertyRefScalarExpression : ClientQLScalarExpression + internal class QLPropertyRefScalarExpression : QLScalarExpression { - public ClientQLPropertyRefScalarExpression(ClientQLScalarExpression expression, string propertyName) - : base(ClientQLScalarExpressionKind.PropertyRef) + public QLPropertyRefScalarExpression(QLScalarExpression expression, string propertyName) + : base(QLScalarExpressionKind.PropertyRef) { this.Expression = expression; this.PropertyName = propertyName; } - public ClientQLScalarExpression Expression { get; } + public QLScalarExpression Expression { get; } public string PropertyName { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs new file mode 100644 index 0000000000..e3c822bfdd --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLScalarAsEnumerableExpression : QLEnumerableExpression + { + public QLScalarAsEnumerableExpression(QLScalarExpression expression, QLEnumerationKind enumerationKind) + : base(QLEnumerableExpressionKind.ScalarAsEnumerable) + { + this.Expression = expression; + this.EnumerationKind = enumerationKind; + } + + public QLScalarExpression Expression { get; } + + public QLEnumerationKind EnumerationKind { get; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs new file mode 100644 index 0000000000..b1e574c5cf --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal abstract class QLScalarExpression : QLExpression + { + public QLScalarExpression(QLScalarExpressionKind kind) + { + this.Kind = kind; + } + + public QLScalarExpressionKind Kind { get; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpressionKind.cs similarity index 90% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpressionKind.cs index 74093950cb..ab939ab1f9 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLScalarExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpressionKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLScalarExpressionKind + internal enum QLScalarExpressionKind { ArrayCreate, ArrayIndexer, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs new file mode 100644 index 0000000000..97b7de0c2e --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLSelectEnumerableExpression : QLEnumerableExpression + { + public QLSelectEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, QLScalarExpression expression) + : base(QLEnumerableExpressionKind.Select) + { + this.SourceExpression = sourceExpression; + this.DeclaredVariable = declaredVariable; + this.Expression = expression; + } + + public QLEnumerableExpression SourceExpression { get; } + + public QLVariable DeclaredVariable { get; } + + public QLScalarExpression Expression { get; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs new file mode 100644 index 0000000000..34baeacab2 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLSelectManyEnumerableExpression : QLEnumerableExpression + { + public QLSelectManyEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, QLEnumerableExpression selectorExpression) + : base(QLEnumerableExpressionKind.SelectMany) + { + this.SourceExpression = sourceExpression; + this.DeclaredVariable = declaredVariable; + this.SelectorExpression = selectorExpression; + } + + public QLEnumerableExpression SourceExpression { get; } + + public QLVariable DeclaredVariable { get; } + + public QLEnumerableExpression SelectorExpression { get; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSortOrder.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSortOrder.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSortOrder.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSortOrder.cs index 078b368280..c9aa9af8c7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLSortOrder.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSortOrder.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLSortOrder + internal enum QLSortOrder { Ascending, Descending diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs index 27c9da8ddd..fb679296e8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLMSymbolLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLMSymbolLiteral : ClientQLLiteral + internal class QLStringLiteral : QLLiteral { - public ClientQLMSymbolLiteral(string value) - : base(ClientQLLiteralKind.MSymbol) + public QLStringLiteral(string value) + : base(QLLiteralKind.String) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs new file mode 100644 index 0000000000..bdb3328648 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + using System.Collections.Generic; + + internal class QLSystemFunctionCallScalarExpression : QLScalarExpression + { + public QLSystemFunctionCallScalarExpression(QLBuiltinScalarFunctionKind functionKind, IReadOnlyList arguments) + : base(QLScalarExpressionKind.SystemFunctionCall) + { + this.FunctionKind = functionKind; + this.Arguments = arguments; + } + + public QLBuiltinScalarFunctionKind FunctionKind { get; } + + public IReadOnlyList Arguments { get; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs similarity index 59% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs index 11f1c940ed..b58f02053a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTakeEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs @@ -2,19 +2,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLTakeEnumerableExpression : ClientQLEnumerableExpression + internal class QLTakeEnumerableExpression : QLEnumerableExpression { - public ClientQLTakeEnumerableExpression(ClientQLEnumerableExpression sourceExpression, long skipValue, long takeValue) - : base(ClientQLEnumerableExpressionKind.Take) + public QLTakeEnumerableExpression(QLEnumerableExpression sourceExpression, long skipValue, long takeValue) + : base(QLEnumerableExpressionKind.Take) { this.SourceExpression = sourceExpression; this.SkipValue = skipValue; this.TakeValue = takeValue; } - public ClientQLEnumerableExpression SourceExpression { get; } + public QLEnumerableExpression SourceExpression { get; } public long SkipValue { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs similarity index 57% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs index d59e060ff4..1481fd9384 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs @@ -2,18 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLTupleAggregate : ClientQLAggregate + internal class QLTupleAggregate : QLAggregate { - public ClientQLTupleAggregate(IReadOnlyList items) - : base(ClientQLAggregateKind.Tuple) + public QLTupleAggregate(IReadOnlyList items) + : base(QLAggregateKind.Tuple) { this.Items = items; } - public IReadOnlyList Items { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs similarity index 52% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs index 3bbc1e4366..4648768381 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs @@ -2,19 +2,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLTupleCreateScalarExpression : ClientQLScalarExpression + internal class QLTupleCreateScalarExpression : QLScalarExpression { - public ClientQLTupleCreateScalarExpression(IReadOnlyList items) - : base(ClientQLScalarExpressionKind.TupleCreate) + public QLTupleCreateScalarExpression(IReadOnlyList items) + : base(QLScalarExpressionKind.TupleCreate) { this.Items = items; } - public IReadOnlyList Items { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs similarity index 55% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs index 8c928132d1..1e4a204a49 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLArrayIndexerScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs @@ -2,18 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLArrayIndexerScalarExpression : ClientQLScalarExpression + internal class QLTupleItemRefScalarExpression : QLScalarExpression { - public ClientQLArrayIndexerScalarExpression(ClientQLScalarExpression expression, long index) - : base(ClientQLScalarExpressionKind.ArrayIndexer) + public QLTupleItemRefScalarExpression(QLScalarExpression expression, long index) + : base(QLScalarExpressionKind.TupleItemRef) { this.Expression = expression; this.Index = index; } - public ClientQLScalarExpression Expression { get; } + public QLScalarExpression Expression { get; } public long Index { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleType.cs similarity index 60% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleType.cs index 02f6548a94..b7b0ce44bf 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTupleType.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleType.cs @@ -2,19 +2,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLTupleType : ClientQLType + internal class QLTupleType : QLType { - public ClientQLTupleType(IReadOnlyList types) - : base(ClientQLTypeKind.Tuple) + public QLTupleType(IReadOnlyList types) + : base(QLTypeKind.Tuple) { this.Types = types; } - public IReadOnlyList Types { get; } + public IReadOnlyList Types { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLType.cs similarity index 64% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLType.cs index 54fa7b3c0a..becfd2f737 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLType.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal abstract class ClientQLAggregate + internal abstract class QLType { - public ClientQLAggregate(ClientQLAggregateKind kind) + public QLType(QLTypeKind kind) { this.Kind = kind; } - public ClientQLAggregateKind Kind { get; } + public QLTypeKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTypeKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTypeKind.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTypeKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTypeKind.cs index 3249ea1dd6..6b6690135c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLTypeKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTypeKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLTypeKind + internal enum QLTypeKind { Base, Enum, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs new file mode 100644 index 0000000000..4f2c53cef6 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs @@ -0,0 +1,21 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLUnaryScalarExpression : QLScalarExpression + { + public QLUnaryScalarExpression(QLUnaryScalarOperatorKind operatorKind, QLScalarExpression expression) + : base(QLScalarExpressionKind.UnaryOperator) + { + this.OperatorKind = operatorKind; + this.Expression = expression; + } + + public QLUnaryScalarOperatorKind OperatorKind { get; } + + public QLScalarExpression Expression { get; } + } + +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarOperatorKind.cs similarity index 83% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarOperatorKind.cs index 930cf942d4..1d1d14c5a0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUnaryScalarOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarOperatorKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal enum ClientQLUnaryScalarOperatorKind + internal enum QLUnaryScalarOperatorKind { BitwiseNot, Minus, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUndefinedLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUndefinedLiteral.cs new file mode 100644 index 0000000000..c7bf84e805 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUndefinedLiteral.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +{ + internal class QLUndefinedLiteral : QLLiteral + { + public static readonly QLUndefinedLiteral Singleton = new QLUndefinedLiteral(); + + private QLUndefinedLiteral() + : base(QLLiteralKind.Undefined) + { + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs similarity index 50% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs index a0673d3721..0d6006ce0d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLUserDefinedFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs @@ -2,23 +2,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { using System.Collections.Generic; - internal class ClientQLUserDefinedFunctionCallScalarExpression : ClientQLScalarExpression + internal class QLUserDefinedFunctionCallScalarExpression : QLScalarExpression { - public ClientQLUserDefinedFunctionCallScalarExpression(ClientQLFunctionIdentifier identifier, IReadOnlyList arguments, bool builtin) - : base(ClientQLScalarExpressionKind.UserDefinedFunctionCall) + public QLUserDefinedFunctionCallScalarExpression(QLFunctionIdentifier identifier, IReadOnlyList arguments, bool builtin) + : base(QLScalarExpressionKind.UserDefinedFunctionCall) { this.Identifier = identifier; this.Arguments = arguments; this.Builtin = builtin; } - public ClientQLFunctionIdentifier Identifier { get; } + public QLFunctionIdentifier Identifier { get; } - public IReadOnlyList Arguments { get; } + public IReadOnlyList Arguments { get; } public bool Builtin { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs similarity index 79% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs index 081dd8fda7..1d1c1bd7d0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariable.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs @@ -2,11 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLVariable + internal class QLVariable { - public ClientQLVariable(string name, long uniqueId) + public QLVariable(string name, long uniqueId) { this.Name = name; this.UniqueId = uniqueId; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs similarity index 53% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs index f5ac5414ba..41ebbdda25 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLVariableRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs @@ -2,17 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLVariableRefScalarExpression : ClientQLScalarExpression + internal class QLVariableRefScalarExpression : QLScalarExpression { - public ClientQLVariableRefScalarExpression(ClientQLVariable variable) - : base(ClientQLScalarExpressionKind.VariableRef) + public QLVariableRefScalarExpression(QLVariable variable) + : base(QLScalarExpressionKind.VariableRef) { this.Variable = variable; } - public ClientQLVariable Variable { get; } + public QLVariable Variable { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs similarity index 51% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs index a9f4fce5ab..9748bdbc76 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/ClientQL/ClientQLWhereEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs @@ -2,17 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL +namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal class ClientQLWhereEnumerableExpression : ClientQLEnumerableExpression + internal class QLWhereEnumerableExpression : QLEnumerableExpression { - public ClientQLWhereEnumerableExpression(ClientQLEnumerableExpression sourceExpression) - : base(ClientQLEnumerableExpressionKind.Where) + public QLWhereEnumerableExpression(QLEnumerableExpression sourceExpression) + : base(QLEnumerableExpressionKind.Where) { this.SourceExpression = sourceExpression; } - public ClientQLEnumerableExpression SourceExpression { get; } + public QLEnumerableExpression SourceExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs index f0f32f4e01..f845a77334 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Xml; using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan; - using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.ClientQL; + using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL; using Microsoft.Azure.Cosmos.Test.BaselineTest; using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; From 5c29c54fd061a2dad109ff4f20dca663bff6a27a Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 18 Sep 2023 08:27:51 -0700 Subject: [PATCH 28/36] Fixed variable names --- ...CoordinatorDistributionPlanDeserializer.cs | 224 +++++++++--------- 1 file changed, 114 insertions(+), 110 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 2c922bea5a..acc0b2b5e6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -99,7 +99,7 @@ private static QLEnumerableExpression DeserializeQLEnumerableExpression(CosmosOb case Constants.Select: return DeserializeSelectEnumerableExpression(cosmosObject); case Constants.SelectMany: - return DeserializeSelectManyExpression(cosmosObject); + return DeserializeSelectManyEnumerableExpression(cosmosObject); case Constants.Take: return DeserializeTakeEnumerableExpression(cosmosObject); case Constants.Where: @@ -160,7 +160,7 @@ private static QLSelectEnumerableExpression DeserializeSelectEnumerableExpressio return new QLSelectEnumerableExpression(sourceExpression, declaredVariable, expression); } - private static QLSelectManyEnumerableExpression DeserializeSelectManyExpression(CosmosObject cosmosObject) + private static QLSelectManyEnumerableExpression DeserializeSelectManyEnumerableExpression(CosmosObject cosmosObject) { QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); @@ -313,8 +313,8 @@ private static QLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpre private static QLUnaryScalarExpression DeserializeUnaryScalarExpression(CosmosObject cosmosObject) { QLUnaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new QLUnaryScalarExpression(operatorKind, expression); + QLScalarExpression scalarExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new QLUnaryScalarExpression(operatorKind, scalarExpression); } private static QLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(CosmosObject cosmosObject) @@ -332,19 +332,68 @@ private static QLVariableRefScalarExpression DeserializeVariableRefScalarExpress return new QLVariableRefScalarExpression(variable); } + #endregion + #region Aggregate Expressions + + private static IReadOnlyList DeserializeAggregateArray(CosmosArray cosmosArray) + { + List aggregates = new List(cosmosArray.Count); + foreach (CosmosElement aggregateElement in cosmosArray) + { + CosmosObject propertyObject = CastToCosmosObject(aggregateElement); + aggregates.Add(DeserializeAggregate(propertyObject)); + } + + return aggregates; + } + + private static QLAggregate DeserializeAggregate(CosmosObject cosmosObject) + { + QLAggregateKind aggregateKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); + switch (aggregateKind) + { + case QLAggregateKind.Builtin: + return DeserializeBuiltInAggregateExpression(cosmosObject); + case QLAggregateKind.Tuple: + return DeserializeTupleAggregateExpression(cosmosObject); + default: + throw new NotSupportedException($"Invalid QLExpression kind: {aggregateKind}"); + } + } + + private static QLBuiltinAggregate DeserializeBuiltInAggregateExpression(CosmosObject cosmosObject) + { + QLAggregateOperatorKind aggregateOperatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + return new QLBuiltinAggregate(aggregateOperatorKind); + } + + private static QLTupleAggregate DeserializeTupleAggregateExpression(CosmosObject cosmosObject) + { + CosmosArray tupleArray = GetValue(cosmosObject, Constants.Items); + List aggregates = new List(tupleArray.Count); + + foreach (CosmosElement tupleElement in tupleArray) + { + CosmosObject tupleObject = CastToCosmosObject(tupleElement); + QLAggregate aggregate = DeserializeAggregate(tupleObject); + aggregates.Add(aggregate); + } + + return new QLTupleAggregate(aggregates); + } + #endregion #region Literal Expressions + private static QLLiteral DeserializeQLLiteral(CosmosObject cosmosObject) { QLLiteralKind literalKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); switch (literalKind) { - case QLLiteralKind.Undefined: - return QLUndefinedLiteral.Singleton; case QLLiteralKind.Array: return new QLArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); case QLLiteralKind.Binary: - return new QLBinaryLiteral(DeserializeBinaryArray(GetValue(cosmosObject, Constants.Value))); + return new QLBinaryLiteral(DeserializeBinaryLiteral(GetValue(cosmosObject, Constants.Value))); case QLLiteralKind.Boolean: return new QLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); case QLLiteralKind.CGuid: @@ -373,52 +422,72 @@ private static QLLiteral DeserializeQLLiteral(CosmosObject cosmosObject) return new QLObjectLiteral(DeserializeObjectLiteralArray(GetValue(cosmosObject, Constants.Properties))); case QLLiteralKind.String: return new QLStringLiteral(GetValue(cosmosObject, Constants.Value).Value); + case QLLiteralKind.Undefined: + return QLUndefinedLiteral.Singleton; default: throw new NotSupportedException($"Invalid QLExpression kind: {literalKind}"); } } - private static QLAggregate DeserializeAggregate(CosmosObject cosmosObject) + private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosmosArray) { - QLAggregateKind aggregateKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); - switch (aggregateKind) + List literals = new List(cosmosArray.Count); + foreach (CosmosElement literalElement in cosmosArray) { - case QLAggregateKind.Tuple: - return DeserializeTupleAggregateExpression(cosmosObject); - case QLAggregateKind.Builtin: - return DeserializeBuiltInAggregateExpression(cosmosObject); - default: - throw new NotSupportedException($"Invalid QLExpression kind: {aggregateKind}"); + CosmosObject literalObject = CastToCosmosObject(literalElement); + literals.Add(DeserializeQLLiteral(literalObject)); } + + return literals; } - private static QLVariable DeserializeQLVariable(CosmosObject cosmosObject) + private static byte[] DeserializeBinaryLiteral(CosmosArray cosmosArray) { - string name = GetValue(cosmosObject, Constants.Name).Value; - long uniqueId = Number64.ToLong(GetValue(cosmosObject, Constants.UniqueId).Value); + List> expressions = new List>(cosmosArray.Count); + int memoryLength = 0; + foreach (CosmosElement propertyElement in cosmosArray) + { + CosmosObject propertyObject = CastToCosmosObject(propertyElement); + ReadOnlyMemory binaryValue = GetValue(propertyObject, Constants.Kind).Value; + memoryLength += binaryValue.Length; + expressions.Add(binaryValue); + } - return new QLVariable(name, uniqueId); - } + byte[] newArray = new byte[memoryLength]; + int currentIndex = 0; + foreach (ReadOnlyMemory byteCollection in expressions) + { + byteCollection.CopyTo(newArray.AsMemory(currentIndex)); + currentIndex += byteCollection.Length; + } - private static QLBuiltinAggregate DeserializeBuiltInAggregateExpression(CosmosObject cosmosObject) - { - QLAggregateOperatorKind aggregateOperatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - return new QLBuiltinAggregate(aggregateOperatorKind); + return newArray; } - private static QLTupleAggregate DeserializeTupleAggregateExpression(CosmosObject cosmosObject) + private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) { - CosmosArray propertyArray = GetValue(cosmosObject, Constants.Items); - List expression = new List(propertyArray.Count); - - foreach (CosmosElement propertyElement in propertyArray) + List objectLiterals = new List(cosmosArray.Count); + foreach (CosmosElement objectLiteralElement in cosmosArray) { - CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - QLAggregate aggregateExpression = DeserializeAggregate(propertyObject); - expression.Add(aggregateExpression); + CosmosObject propertyObject = CastToCosmosObject(objectLiteralElement); + string name = GetValue(propertyObject, Constants.Name).Value; + QLLiteral literal = DeserializeQLLiteral(propertyObject); + QLObjectLiteralProperty objectLiteralProperty = new QLObjectLiteralProperty(name, literal); + objectLiterals.Add(objectLiteralProperty); } - return new QLTupleAggregate(expression); + return objectLiterals; + } + + #endregion + #region Helper Functions + + private static QLVariable DeserializeQLVariable(CosmosObject cosmosObject) + { + string name = GetValue(cosmosObject, Constants.Name).Value; + long uniqueId = Number64.ToLong(GetValue(cosmosObject, Constants.UniqueId).Value); + + return new QLVariable(name, uniqueId); } private static IReadOnlyList DeserializeObjectProperties(CosmosArray cosmosArray) @@ -426,9 +495,9 @@ private static IReadOnlyList DeserializeObjectProperties(Cosmo List properties = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { - CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); + CosmosObject propertyObject = CastToCosmosObject(propertyElement); string objectPropertyName = GetValue(propertyObject, Constants.Name).Value; - QLScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); properties.Add(new QLObjectProperty(objectPropertyName, expression)); } @@ -438,10 +507,10 @@ private static IReadOnlyList DeserializeObjectProperties(Cosmo private static IReadOnlyList DeserializeScalarExpressionArray(CosmosArray cosmosArray) { List expressions = new List(cosmosArray.Count); - foreach (CosmosElement propertyElement in cosmosArray) + foreach (CosmosElement itemElement in cosmosArray) { - CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - QLScalarExpression expression = DeserializeScalarExpression(propertyObject); + CosmosObject itemObject = CastToCosmosObject(itemElement); + QLScalarExpression expression = DeserializeScalarExpression(itemObject); expressions.Add(expression); } @@ -451,82 +520,17 @@ private static IReadOnlyList DeserializeScalarExpressionArra private static IReadOnlyList DeserializeOrderByItemArray(CosmosArray cosmosArray) { List expressions = new List(cosmosArray.Count); - foreach (CosmosElement propertyElement in cosmosArray) + foreach (CosmosElement itemElement in cosmosArray) { - CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - QLSortOrder sortOrder = GetEnumValue(GetValue(propertyObject, Constants.SortOrder).Value); - QLScalarExpression scalarExpression = DeserializeScalarExpression(propertyObject); + CosmosObject itemObject = CastToCosmosObject(itemElement); + QLSortOrder sortOrder = GetEnumValue(GetValue(itemObject, Constants.SortOrder).Value); + QLScalarExpression scalarExpression = DeserializeScalarExpression(itemObject); expressions.Add(new QLOrderByItem(scalarExpression, sortOrder)); } return expressions; } - private static IReadOnlyList DeserializeAggregateArray(CosmosArray cosmosArray) - { - List expressions = new List(cosmosArray.Count); - foreach (CosmosElement propertyElement in cosmosArray) - { - CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - expressions.Add(DeserializeAggregate(propertyObject)); - } - - return expressions; - } - - private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosmosArray) - { - List expressions = new List(cosmosArray.Count); - foreach (CosmosElement propertyElement in cosmosArray) - { - CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - expressions.Add(DeserializeQLLiteral(propertyObject)); - } - - return expressions; - } - - private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) - { - List expressions = new List(cosmosArray.Count); - foreach (CosmosElement propertyElement in cosmosArray) - { - CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - string name = GetValue(propertyObject, Constants.Name).Value; - QLLiteral literal = DeserializeQLLiteral(propertyObject); - QLObjectLiteralProperty objectLiteralProperty = new QLObjectLiteralProperty(name, literal); - expressions.Add(objectLiteralProperty); - } - - return expressions; - } - - private static byte[] DeserializeBinaryArray(CosmosArray cosmosArray) - { - List> expressions = new List>(cosmosArray.Count); - int memoryLength = 0; - foreach (CosmosElement propertyElement in cosmosArray) - { - CosmosObject propertyObject = ConvertToCosmosObject(propertyElement); - ReadOnlyMemory binaryValue = GetValue(propertyObject, Constants.Kind).Value; - memoryLength += binaryValue.Length; - expressions.Add(binaryValue); - } - - byte[] newArray = new byte[memoryLength]; - int currentIndex = 0; - foreach (ReadOnlyMemory byteCollection in expressions) - { - byteCollection.CopyTo(newArray.AsMemory(currentIndex)); - currentIndex += byteCollection.Length; - } - - return newArray; - } - - #endregion - #region Helper Functions - private static T GetValue(CosmosObject cosmosObject, string propertyName) where T : CosmosElement { @@ -563,7 +567,7 @@ private static bool TryGetValue(CosmosObject cosmosObject, string propertyNam private static TEnum GetEnumValue(string propertyName) where TEnum : struct { - bool success = Enum.TryParse(propertyName, out TEnum result); + bool success = Enum.TryParse(propertyName, ignoreCase: true, out TEnum result); if (!success) { throw new InvalidOperationException($"{GetExceptionMessage()} The string representation of {propertyName} enumerated constant was not able to be converted to an equivalent enumerated object"); @@ -580,7 +584,7 @@ private static string GetExceptionMessage() return $"Exception occurred while deserializing query plan. Version : '{clientSDKVersion}', Exception/Reason : "; } - private static CosmosObject ConvertToCosmosObject(CosmosElement cosmosElement) + private static CosmosObject CastToCosmosObject(CosmosElement cosmosElement) { CosmosObject propertyObject = cosmosElement as CosmosObject; if (propertyObject != null) From 9f93c92de378ef9e8662bfb31cedfd59e300948a Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 18 Sep 2023 09:13:06 -0700 Subject: [PATCH 29/36] Updated more variable names --- ...CoordinatorDistributionPlanDeserializer.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index acc0b2b5e6..34241363fe 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -340,8 +340,8 @@ private static IReadOnlyList DeserializeAggregateArray(CosmosArray List aggregates = new List(cosmosArray.Count); foreach (CosmosElement aggregateElement in cosmosArray) { - CosmosObject propertyObject = CastToCosmosObject(aggregateElement); - aggregates.Add(DeserializeAggregate(propertyObject)); + CosmosObject aggregateObject = CastToCosmosObject(aggregateElement); + aggregates.Add(DeserializeAggregate(aggregateObject)); } return aggregates; @@ -443,25 +443,25 @@ private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosm private static byte[] DeserializeBinaryLiteral(CosmosArray cosmosArray) { - List> expressions = new List>(cosmosArray.Count); + List> binaryLiterals = new List>(cosmosArray.Count); int memoryLength = 0; foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = CastToCosmosObject(propertyElement); - ReadOnlyMemory binaryValue = GetValue(propertyObject, Constants.Kind).Value; - memoryLength += binaryValue.Length; - expressions.Add(binaryValue); + ReadOnlyMemory bytes = GetValue(propertyObject, Constants.Kind).Value; + memoryLength += bytes.Length; + binaryLiterals.Add(bytes); } - byte[] newArray = new byte[memoryLength]; + byte[] byteCollection = new byte[memoryLength]; int currentIndex = 0; - foreach (ReadOnlyMemory byteCollection in expressions) + foreach (ReadOnlyMemory bytes in binaryLiterals) { - byteCollection.CopyTo(newArray.AsMemory(currentIndex)); - currentIndex += byteCollection.Length; + bytes.CopyTo(byteCollection.AsMemory(currentIndex)); + currentIndex += bytes.Length; } - return newArray; + return byteCollection; } private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) From efa258f49d5d206fb74fdd10b8be240fbd64d36f Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 19 Sep 2023 11:33:49 -0700 Subject: [PATCH 30/36] Removed support for Type --- ...CoordinatorDistributionPlanDeserializer.cs | 52 +++++------- .../QL/CoordinatorDistributionPlan.cs | 4 +- .../QL/QLAggregate.cs | 2 +- .../QL/QLAggregateEnumerableExpression.cs | 1 - .../QL/QLArrayIndexerScalarExpression.cs | 5 +- .../QL/QLBaseType.cs | 17 ---- .../QL/QLBaseTypeKind.cs | 27 ------- .../QL/QLBuiltinScalarFunctionKind.cs | 80 ------------------- .../QL/QLEnumType.cs | 17 ---- .../QL/QLEnumerableExpression.cs | 4 +- .../QL/QLExpression.cs | 11 --- .../QL/QLGroupByKey.cs | 16 ---- .../QL/QLLiteral.cs | 2 +- .../QL/QLNumberLiteral.cs | 4 +- .../QL/QLProgram.cs | 11 --- .../QL/QLScalarExpression.cs | 4 +- .../QL/QLSelectEnumerableExpression.cs | 1 - .../QL/QLTakeEnumerableExpression.cs | 6 +- .../QL/QLTupleItemRefScalarExpression.cs | 5 +- .../QL/QLTupleType.cs | 20 ----- .../CoordinatorDistributionPlan/QL/QLType.cs | 16 ---- .../QL/QLTypeKind.cs | 13 --- .../QL/QLWhereEnumerableExpression.cs | 9 ++- 23 files changed, 46 insertions(+), 281 deletions(-) delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseType.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseTypeKind.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumType.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLExpression.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByKey.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLProgram.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleType.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLType.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTypeKind.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs index 34241363fe..87b987bb84 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs @@ -173,16 +173,19 @@ private static QLTakeEnumerableExpression DeserializeTakeEnumerableExpression(Co QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); long skipValue = Number64.ToLong(GetValue(cosmosObject, Constants.SkipValue).Value); long takeExpression = Number64.ToLong(GetValue(cosmosObject, Constants.TakeValue).Value); - return new QLTakeEnumerableExpression(sourceExpression, skipValue, takeExpression); + return new QLTakeEnumerableExpression(sourceExpression, Convert.ToUInt64(skipValue), Convert.ToUInt64(takeExpression)); } private static QLWhereEnumerableExpression DeserializeWhereEnumerableExpression(CosmosObject cosmosObject) { QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - return new QLWhereEnumerableExpression(sourceExpression); + QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new QLWhereEnumerableExpression(sourceExpression, declaredVariable, expression); } #endregion + #region Scalar Expressions private static QLScalarExpression DeserializeScalarExpression(CosmosObject cosmosObject) @@ -236,7 +239,7 @@ private static QLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpre { QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); long index = Number64.ToLong(GetValue(cosmosObject, Constants.Index).Value); - return new QLArrayIndexerScalarExpression(expression, index); + return new QLArrayIndexerScalarExpression(expression, Convert.ToUInt64(index)); } private static QLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(CosmosObject cosmosObject) @@ -265,7 +268,7 @@ private static QLLetScalarExpression DeserializeLetScalarExpression(CosmosObject private static QLLiteralScalarExpression DeserializeLiteralScalarExpression(CosmosObject cosmosObject) { CosmosObject literalObject = GetValue(cosmosObject, Constants.Literal); - return new QLLiteralScalarExpression(DeserializeQLLiteral(literalObject)); + return new QLLiteralScalarExpression(DeserializeLiteral(literalObject)); } private static QLMuxScalarExpression DeserializeMuxScalarExpression(CosmosObject cosmosObject) @@ -307,7 +310,7 @@ private static QLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpre { QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); long index = Number64.ToLong(GetValue(cosmosObject, Constants.Index).Value); - return new QLTupleItemRefScalarExpression(expression, index); + return new QLTupleItemRefScalarExpression(expression, Convert.ToUInt64(index)); } private static QLUnaryScalarExpression DeserializeUnaryScalarExpression(CosmosObject cosmosObject) @@ -333,7 +336,8 @@ private static QLVariableRefScalarExpression DeserializeVariableRefScalarExpress } #endregion - #region Aggregate Expressions + + #region Aggregate private static IReadOnlyList DeserializeAggregateArray(CosmosArray cosmosArray) { @@ -383,9 +387,10 @@ private static QLTupleAggregate DeserializeTupleAggregateExpression(CosmosObject } #endregion - #region Literal Expressions - private static QLLiteral DeserializeQLLiteral(CosmosObject cosmosObject) + #region Literal + + private static QLLiteral DeserializeLiteral(CosmosObject cosmosObject) { QLLiteralKind literalKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); switch (literalKind) @@ -393,7 +398,7 @@ private static QLLiteral DeserializeQLLiteral(CosmosObject cosmosObject) case QLLiteralKind.Array: return new QLArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); case QLLiteralKind.Binary: - return new QLBinaryLiteral(DeserializeBinaryLiteral(GetValue(cosmosObject, Constants.Value))); + return new QLBinaryLiteral(DeserializeBinaryLiteral(GetValue(cosmosObject, Constants.Value))); case QLLiteralKind.Boolean: return new QLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); case QLLiteralKind.CGuid: @@ -417,7 +422,7 @@ private static QLLiteral DeserializeQLLiteral(CosmosObject cosmosObject) case QLLiteralKind.Null: return QLNullLiteral.Singleton; case QLLiteralKind.Number: - return new QLNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); + return new QLNumberLiteral(GetValue(cosmosObject, Constants.Value).Value); case QLLiteralKind.Object: return new QLObjectLiteral(DeserializeObjectLiteralArray(GetValue(cosmosObject, Constants.Properties))); case QLLiteralKind.String: @@ -435,31 +440,17 @@ private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosm foreach (CosmosElement literalElement in cosmosArray) { CosmosObject literalObject = CastToCosmosObject(literalElement); - literals.Add(DeserializeQLLiteral(literalObject)); + literals.Add(DeserializeLiteral(literalObject)); } return literals; } - private static byte[] DeserializeBinaryLiteral(CosmosArray cosmosArray) + private static byte[] DeserializeBinaryLiteral(CosmosObject cosmosObject) { - List> binaryLiterals = new List>(cosmosArray.Count); - int memoryLength = 0; - foreach (CosmosElement propertyElement in cosmosArray) - { - CosmosObject propertyObject = CastToCosmosObject(propertyElement); - ReadOnlyMemory bytes = GetValue(propertyObject, Constants.Kind).Value; - memoryLength += bytes.Length; - binaryLiterals.Add(bytes); - } - - byte[] byteCollection = new byte[memoryLength]; - int currentIndex = 0; - foreach (ReadOnlyMemory bytes in binaryLiterals) - { - bytes.CopyTo(byteCollection.AsMemory(currentIndex)); - currentIndex += bytes.Length; - } + ReadOnlyMemory bytes = GetValue(cosmosObject, Constants.Kind).Value; + byte[] byteCollection = new byte[bytes.Length]; + bytes.CopyTo(byteCollection.AsMemory(0)); return byteCollection; } @@ -471,7 +462,7 @@ private static IReadOnlyList DeserializeObjectLiteralAr { CosmosObject propertyObject = CastToCosmosObject(objectLiteralElement); string name = GetValue(propertyObject, Constants.Name).Value; - QLLiteral literal = DeserializeQLLiteral(propertyObject); + QLLiteral literal = DeserializeLiteral(propertyObject); QLObjectLiteralProperty objectLiteralProperty = new QLObjectLiteralProperty(name, literal); objectLiterals.Add(objectLiteralProperty); } @@ -480,6 +471,7 @@ private static IReadOnlyList DeserializeObjectLiteralAr } #endregion + #region Helper Functions private static QLVariable DeserializeQLVariable(CosmosObject cosmosObject) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs index a7a89405cc..a1d68f828d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs @@ -6,11 +6,11 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { internal class CoordinatorDistributionPlan { - public CoordinatorDistributionPlan(QLExpression clientQL) + public CoordinatorDistributionPlan(QLEnumerableExpression clientQL) { this.ClientQL = clientQL; } - public QLExpression ClientQL { get; } + public QLEnumerableExpression ClientQL { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs index 850dbb2497..c73e924865 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { internal abstract class QLAggregate { - public QLAggregate(QLAggregateKind kind) + protected QLAggregate(QLAggregateKind kind) { this.Kind = kind; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs index 70226a99ea..2bf2bd71ea 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs @@ -17,5 +17,4 @@ public QLAggregateEnumerableExpression(QLEnumerableExpression sourceExpression, public QLAggregate Aggregate { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs index e8c425bafc..1369613ef5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { internal class QLArrayIndexerScalarExpression : QLScalarExpression { - public QLArrayIndexerScalarExpression(QLScalarExpression expression, long index) + public QLArrayIndexerScalarExpression(QLScalarExpression expression, ulong index) : base(QLScalarExpressionKind.ArrayIndexer) { this.Expression = expression; @@ -15,7 +15,6 @@ public QLArrayIndexerScalarExpression(QLScalarExpression expression, long index) public QLScalarExpression Expression { get; } - public long Index { get; } + public ulong Index { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseType.cs deleted file mode 100644 index dae641caef..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseType.cs +++ /dev/null @@ -1,17 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL -{ - internal class QLBaseType : QLType - { - public QLBaseType(bool excludesUndefined) - : base(QLTypeKind.Base) - { - this.ExcludesUndefined = excludesUndefined; - } - - public bool ExcludesUndefined { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseTypeKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseTypeKind.cs deleted file mode 100644 index 0e9c68d759..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBaseTypeKind.cs +++ /dev/null @@ -1,27 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL -{ - internal enum QLBaseTypeKind - { - Array, - Binary, - Boolean, - CGuid, - CNumber, - MDateTime, - MJavaScript, - MNumber, - MObjectId, - MRegex, - MSingleton, - MSymbol, - MTimestamp, - Number, - Object, - String, - Variant, - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs index d28656cb06..2d0296c4ce 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs @@ -6,86 +6,6 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { internal enum QLBuiltinScalarFunctionKind { - _C_Compare_EQ, - _C_Compare_GT, - _C_Compare_GTE, - _C_Compare_LT, - _C_Compare_LTE, - _C_Compare_NEQ, - _C_ComputeAvg, - _C_ConvertToNumber, - _Compare_Bson_BinaryData, - _Compare_Objects, - _EpkInRange, - _M_Abs, - _M_Acos, - _M_Asin, - _M_Atan, - _M_Atan2, - _M_Binary, - _M_Ceil, - _M_Convert, - _M_Compare_EQ, - _M_Compare_GT, - _M_Compare_GTE, - _M_Compare_LT, - _M_Compare_LTE, - _M_Compare_NEQ, - _M_Cos, - _M_Date, - _M_DegreesToRadians, - _M_Divide, - _M_Double, - _M_Eval_EQ, - _M_Eval_GT, - _M_Eval_GTE, - _M_Eval_IN, - _M_Eval_IsDefined, - _M_Eval_LT, - _M_Eval_LTE, - _M_Eval_NEQ, - _M_Eval_NIN, - _M_Eval_NotIsDefined, - _M_Eval_NotRegex, - _M_Eval_Regex, - _M_Exp, - _M_Floor, - _M_Int32, - _M_Int64, - _M_JavaScript, - _M_Ln, - _M_Log10, - _M_Ltrim, - _M_MaxKey, - _M_MinKey, - _M_Mod, - _M_Multiply, - _M_ObjectId, - _M_Pow, - _M_RadiansToDegrees, - _M_Regex, - _M_Rtrim, - _M_Sin, - _M_Sqrt, - _M_Symbol, - _M_Tan, - _M_Timestamp, - _M_ToBool, - _M_ToDate, - _M_ToDouble, - _M_ToInt, - _M_ToLong, - _M_ToObjectId, - _M_ToString, - _M_Trim, - _M_Undefined, - _ObjectToArray, - _Proxy_Projection, - _Regex_Match, - _ST_Distance, - _ST_Intersects, - _ST_Within, - _Try_Array_Contains, Abs, Acos, All, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumType.cs deleted file mode 100644 index 5498848c95..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumType.cs +++ /dev/null @@ -1,17 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL -{ - internal class QLEnumType : QLType - { - public QLEnumType(QLType itemType) - : base(QLTypeKind.Enum) - { - this.ItemType = itemType; - } - - public QLType ItemType { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs index 460ca5ff06..0fbdedd57f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs @@ -4,9 +4,9 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal abstract class QLEnumerableExpression : QLExpression + internal abstract class QLEnumerableExpression { - public QLEnumerableExpression(QLEnumerableExpressionKind kind) + protected QLEnumerableExpression(QLEnumerableExpressionKind kind) { this.Kind = kind; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLExpression.cs deleted file mode 100644 index 9cc9e47410..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLExpression.cs +++ /dev/null @@ -1,11 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL -{ - internal abstract class QLExpression - { - // Decided to keep this empty as it does not provide new information - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByKey.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByKey.cs deleted file mode 100644 index 166b95387f..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByKey.cs +++ /dev/null @@ -1,16 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL -{ - internal class QLGroupByKey - { - public QLGroupByKey(QLType type) - { - this.Type = type; - } - - public QLType Type { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs index f0947f47b7..f04a6e886d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { internal abstract class QLLiteral { - public QLLiteral(QLLiteralKind kind) + protected QLLiteral(QLLiteralKind kind) { this.Kind = kind; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs index eee16281fc..d29d55b893 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs @@ -8,12 +8,12 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL internal class QLNumberLiteral : QLLiteral { - public QLNumberLiteral(long value) + public QLNumberLiteral(Number64 value) : base(QLLiteralKind.Number) { this.Value = value; } - public long Value { get; } + public Number64 Value { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLProgram.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLProgram.cs deleted file mode 100644 index 396b2c76b3..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLProgram.cs +++ /dev/null @@ -1,11 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL -{ - internal class QLProgram - { - public QLEnumerableExpression Expression { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs index b1e574c5cf..efd998a53d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs @@ -4,9 +4,9 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { - internal abstract class QLScalarExpression : QLExpression + internal abstract class QLScalarExpression { - public QLScalarExpression(QLScalarExpressionKind kind) + protected QLScalarExpression(QLScalarExpressionKind kind) { this.Kind = kind; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs index 97b7de0c2e..348c316255 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs @@ -20,5 +20,4 @@ public QLSelectEnumerableExpression(QLEnumerableExpression sourceExpression, QLV public QLScalarExpression Expression { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs index b58f02053a..3743ab1b53 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { internal class QLTakeEnumerableExpression : QLEnumerableExpression { - public QLTakeEnumerableExpression(QLEnumerableExpression sourceExpression, long skipValue, long takeValue) + public QLTakeEnumerableExpression(QLEnumerableExpression sourceExpression, ulong skipValue, ulong takeValue) : base(QLEnumerableExpressionKind.Take) { this.SourceExpression = sourceExpression; @@ -16,9 +16,9 @@ public QLTakeEnumerableExpression(QLEnumerableExpression sourceExpression, long public QLEnumerableExpression SourceExpression { get; } - public long SkipValue { get; } + public ulong SkipValue { get; } - public long TakeValue { get; } + public ulong TakeValue { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs index 1e4a204a49..0cd4c713b5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { internal class QLTupleItemRefScalarExpression : QLScalarExpression { - public QLTupleItemRefScalarExpression(QLScalarExpression expression, long index) + public QLTupleItemRefScalarExpression(QLScalarExpression expression, ulong index) : base(QLScalarExpressionKind.TupleItemRef) { this.Expression = expression; @@ -15,7 +15,6 @@ public QLTupleItemRefScalarExpression(QLScalarExpression expression, long index) public QLScalarExpression Expression { get; } - public long Index { get; } + public ulong Index { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleType.cs deleted file mode 100644 index b7b0ce44bf..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleType.cs +++ /dev/null @@ -1,20 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL -{ - using System.Collections.Generic; - - internal class QLTupleType : QLType - { - public QLTupleType(IReadOnlyList types) - : base(QLTypeKind.Tuple) - { - this.Types = types; - } - - public IReadOnlyList Types { get; } - } - -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLType.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLType.cs deleted file mode 100644 index becfd2f737..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLType.cs +++ /dev/null @@ -1,16 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL -{ - internal abstract class QLType - { - public QLType(QLTypeKind kind) - { - this.Kind = kind; - } - - public QLTypeKind Kind { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTypeKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTypeKind.cs deleted file mode 100644 index 6b6690135c..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTypeKind.cs +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL -{ - internal enum QLTypeKind - { - Base, - Enum, - Tuple, - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs index 9748bdbc76..e0941b58c2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs @@ -6,13 +6,18 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { internal class QLWhereEnumerableExpression : QLEnumerableExpression { - public QLWhereEnumerableExpression(QLEnumerableExpression sourceExpression) + public QLWhereEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, QLScalarExpression expression) : base(QLEnumerableExpressionKind.Where) { this.SourceExpression = sourceExpression; + this.DeclaredVariable = declaredVariable; + this.Expression = expression; } public QLEnumerableExpression SourceExpression { get; } - } + public QLVariable DeclaredVariable { get; } + + public QLScalarExpression Expression { get; } + } } \ No newline at end of file From 3d2bf7ddda89b934654e0219c78262489c0aa86f Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 19 Sep 2023 11:40:58 -0700 Subject: [PATCH 31/36] Removed all extra newlines --- .../QL/QLArrayCreateScalarExpression.cs | 1 - .../QL/QLDistinctEnumerableExpression.cs | 1 - .../QL/QLGroupByEnumerableExpression.cs | 1 - .../QL/QLInputEnumerableExpression.cs | 1 - .../QL/QLIsOperatorScalarExpression.cs | 1 - .../CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs | 1 - .../QL/QLLiteralScalarExpression.cs | 1 - .../CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs | 1 - .../QL/QLObjectCreateScalarExpression.cs | 1 - .../QL/QLOrderByEnumerableExpression.cs | 1 - .../QL/QLPropertyRefScalarExpression.cs | 1 - .../QL/QLScalarAsEnumerableExpression.cs | 1 - .../QL/QLSelectManyEnumerableExpression.cs | 1 - .../QL/QLSystemFunctionCallScalarExpression.cs | 1 - .../QL/QLTakeEnumerableExpression.cs | 1 - .../QL/QLTupleCreateScalarExpression.cs | 1 - .../QL/QLUnaryScalarExpression.cs | 1 - .../QL/QLUserDefinedFunctionCallScalarExpression.cs | 1 - .../QL/QLVariableRefScalarExpression.cs | 1 - ...Tests.TestCoordinatorDistributionPlanDeserialization.xml | 6 +++--- 20 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs index 5e66ce967f..65c1faf11a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs @@ -19,5 +19,4 @@ public QLArrayCreateScalarExpression(QLArrayKind arrayKind, IReadOnlyList Items { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs index 0d04d7e43e..865ff6be81 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs @@ -22,5 +22,4 @@ public QLDistinctEnumerableExpression(QLEnumerableExpression sourceExpression, Q public IReadOnlyList Expression { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs index aac8b5ca55..76af649e5f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs @@ -22,5 +22,4 @@ public QLGroupByEnumerableExpression(QLEnumerableExpression sourceExpression, ul public IReadOnlyList Aggregates { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs index e1b9004e8e..b3b99df06f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs @@ -14,5 +14,4 @@ public QLInputEnumerableExpression(string name) public string Name { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs index 78436562c2..3c5cac75a1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs @@ -19,5 +19,4 @@ public QLIsOperatorScalarExpression(QLIsOperatorKind operatorKind, QLScalarExpre public QLScalarExpression Expression { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs index f24af3e60c..2510f042b1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs @@ -22,5 +22,4 @@ public QLLetScalarExpression(QLVariable declaredVariable, QLScalarExpression dec public QLScalarExpression Expression { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs index 7113704554..a12da521cc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs @@ -14,5 +14,4 @@ public QLLiteralScalarExpression(QLLiteral literal) public QLLiteral Literal { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs index cdd4f7b7bf..4656788984 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs @@ -20,5 +20,4 @@ public QLMuxScalarExpression(QLScalarExpression conditionExpression, QLScalarExp public QLScalarExpression RightExpression { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs index 055352795f..316f09c417 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs @@ -19,5 +19,4 @@ public QLObjectCreateScalarExpression(IReadOnlyList properties public QLObjectKind ObjectKind { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs index f5ab5b799d..6ed5352d3f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs @@ -22,5 +22,4 @@ public QLOrderByEnumerableExpression(QLEnumerableExpression sourceExpression, QL public IReadOnlyList Items { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs index 2ea78b775e..be876b3f96 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs @@ -19,5 +19,4 @@ public QLPropertyRefScalarExpression(QLScalarExpression expression, string prope public string PropertyName { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs index e3c822bfdd..86eaa60c25 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs @@ -17,5 +17,4 @@ public QLScalarAsEnumerableExpression(QLScalarExpression expression, QLEnumerati public QLEnumerationKind EnumerationKind { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs index 34baeacab2..43059dbb56 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs @@ -20,5 +20,4 @@ public QLSelectManyEnumerableExpression(QLEnumerableExpression sourceExpression, public QLEnumerableExpression SelectorExpression { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs index bdb3328648..531aabd3c7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs @@ -19,5 +19,4 @@ public QLSystemFunctionCallScalarExpression(QLBuiltinScalarFunctionKind function public IReadOnlyList Arguments { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs index 3743ab1b53..37c76dea6c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs @@ -20,5 +20,4 @@ public QLTakeEnumerableExpression(QLEnumerableExpression sourceExpression, ulong public ulong TakeValue { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs index 4648768381..da86f312c5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs @@ -16,5 +16,4 @@ public QLTupleCreateScalarExpression(IReadOnlyList items) public IReadOnlyList Items { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs index 4f2c53cef6..dd7e1b1f88 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs @@ -17,5 +17,4 @@ public QLUnaryScalarExpression(QLUnaryScalarOperatorKind operatorKind, QLScalarE public QLScalarExpression Expression { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs index 0d6006ce0d..95e9507ab1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs @@ -22,5 +22,4 @@ public QLUserDefinedFunctionCallScalarExpression(QLFunctionIdentifier identifier public bool Builtin { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs index 41ebbdda25..e7ac80232f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs @@ -14,5 +14,4 @@ public QLVariableRefScalarExpression(QLVariable variable) public QLVariable Variable { get; } } - } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml index 5a9238bb91..bb1772e9e5 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml @@ -120,7 +120,7 @@ "RightExpression": { "OperatorKind": 2, "Expression": { - "FunctionKind": 154, + "FunctionKind": 74, "Arguments": [ { "Expression": { @@ -206,7 +206,7 @@ "RightExpression": { "OperatorKind": 2, "Expression": { - "FunctionKind": 154, + "FunctionKind": 74, "Arguments": [ { "Expression": { @@ -308,7 +308,7 @@ "RightExpression": { "OperatorKind": 2, "Expression": { - "FunctionKind": 154, + "FunctionKind": 74, "Arguments": [ { "Expression": { From 4244f8f008f7bbf0bcb8932d6a5091228a17bb44 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Wed, 20 Sep 2023 12:16:30 -0700 Subject: [PATCH 32/36] Added null checks --- .../QL/CoordinatorDistributionPlan.cs | 4 +++- .../QL/QLAggregateEnumerableExpression.cs | 6 ++++-- .../QL/QLArrayCreateScalarExpression.cs | 3 ++- .../QL/QLArrayIndexerScalarExpression.cs | 4 +++- .../Core/CoordinatorDistributionPlan/QL/QLArrayLiteral.cs | 3 ++- .../CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs | 2 +- .../QL/QLBinaryScalarExpression.cs | 6 ++++-- .../QL/QLDistinctEnumerableExpression.cs | 7 ++++--- .../QL/QLFunctionIdentifier.cs | 4 +++- .../QL/QLGroupByEnumerableExpression.cs | 5 +++-- .../QL/QLInputEnumerableExpression.cs | 4 +++- .../QL/QLIsOperatorScalarExpression.cs | 3 ++- .../QL/QLLetScalarExpression.cs | 7 ++++--- .../QL/QLLiteralScalarExpression.cs | 4 +++- .../QL/QLMJavaScriptLiteral.cs | 4 +++- .../CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs | 6 ++++-- .../CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs | 4 +++- .../QL/QLMuxScalarExpression.cs | 8 +++++--- .../QL/QLObjectCreateScalarExpression.cs | 3 ++- .../CoordinatorDistributionPlan/QL/QLObjectLiteral.cs | 3 ++- .../QL/QLObjectLiteralProperty.cs | 6 ++++-- .../CoordinatorDistributionPlan/QL/QLObjectProperty.cs | 6 ++++-- .../QL/QLOrderByEnumerableExpression.cs | 7 ++++--- .../Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs | 4 +++- .../QL/QLPropertyRefScalarExpression.cs | 5 +++-- .../QL/QLScalarAsEnumerableExpression.cs | 4 +++- .../QL/QLSelectEnumerableExpression.cs | 8 +++++--- .../QL/QLSelectManyEnumerableExpression.cs | 8 +++++--- .../CoordinatorDistributionPlan/QL/QLStringLiteral.cs | 4 +++- .../QL/QLSystemFunctionCallScalarExpression.cs | 3 ++- .../QL/QLTakeEnumerableExpression.cs | 4 +++- .../CoordinatorDistributionPlan/QL/QLTupleAggregate.cs | 3 ++- .../QL/QLTupleCreateScalarExpression.cs | 3 ++- .../QL/QLTupleItemRefScalarExpression.cs | 4 +++- .../QL/QLUnaryScalarExpression.cs | 4 +++- .../QL/QLUserDefinedFunctionCallScalarExpression.cs | 5 +++-- .../Core/CoordinatorDistributionPlan/QL/QLVariable.cs | 4 +++- .../QL/QLVariableRefScalarExpression.cs | 4 +++- .../QL/QLWhereEnumerableExpression.cs | 8 +++++--- 39 files changed, 123 insertions(+), 61 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs index a1d68f828d..f5d113f71a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs @@ -4,11 +4,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class CoordinatorDistributionPlan { public CoordinatorDistributionPlan(QLEnumerableExpression clientQL) { - this.ClientQL = clientQL; + this.ClientQL = clientQL ?? throw new ArgumentNullException(nameof(clientQL)); } public QLEnumerableExpression ClientQL { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs index 2bf2bd71ea..b8d3b7963c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs @@ -4,13 +4,15 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLAggregateEnumerableExpression : QLEnumerableExpression { public QLAggregateEnumerableExpression(QLEnumerableExpression sourceExpression, QLAggregate aggregate) : base(QLEnumerableExpressionKind.Aggregate) { - this.SourceExpression = sourceExpression; - this.Aggregate = aggregate; + this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); + this.Aggregate = aggregate ?? throw new ArgumentNullException(nameof(aggregate)); } public QLEnumerableExpression SourceExpression { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs index 65c1faf11a..6d85134b1c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLArrayCreateScalarExpression : QLScalarExpression @@ -12,7 +13,7 @@ public QLArrayCreateScalarExpression(QLArrayKind arrayKind, IReadOnlyList items) : base(QLLiteralKind.Array) { - this.Items = items; + this.Items = items ?? throw new ArgumentNullException(nameof(items)); } public IReadOnlyList Items { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs index 23a593b894..cb254c40a6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs @@ -12,7 +12,7 @@ internal class QLBinaryLiteral : QLLiteral public QLBinaryLiteral(byte[] value) : base(QLLiteralKind.Binary) { - this.Value = value; + this.Value = value ?? throw new ArgumentNullException(nameof(value)); } public byte[] Value { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs index a5b7f7e367..3f3d91d838 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs @@ -4,14 +4,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLBinaryScalarExpression : QLScalarExpression { public QLBinaryScalarExpression(QLBinaryScalarOperatorKind operatorKind, QLScalarExpression leftExpression, QLScalarExpression rightExpression) : base(QLScalarExpressionKind.BinaryOperator) { this.OperatorKind = operatorKind; - this.LeftExpression = leftExpression; - this.RightExpression = rightExpression; + this.LeftExpression = leftExpression ?? throw new ArgumentNullException(nameof(leftExpression)); + this.RightExpression = rightExpression ?? throw new ArgumentNullException(nameof(rightExpression)); } public QLBinaryScalarOperatorKind OperatorKind { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs index 865ff6be81..3a76f4a0e8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLDistinctEnumerableExpression : QLEnumerableExpression @@ -11,9 +12,9 @@ internal class QLDistinctEnumerableExpression : QLEnumerableExpression public QLDistinctEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, IReadOnlyList expression) : base(QLEnumerableExpressionKind.Distinct) { - this.SourceExpression = sourceExpression; - this.DeclaredVariable = declaredVariable; - this.Expression = expression; + this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); + this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } public QLEnumerableExpression SourceExpression { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs index 08420d515f..81e50ae77e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs @@ -4,11 +4,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLFunctionIdentifier { public QLFunctionIdentifier(string name) { - this.Name = name; + this.Name = name ?? throw new ArgumentNullException(nameof(name)); } public string Name { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs index 76af649e5f..05dededf51 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLGroupByEnumerableExpression : QLEnumerableExpression @@ -11,9 +12,9 @@ internal class QLGroupByEnumerableExpression : QLEnumerableExpression public QLGroupByEnumerableExpression(QLEnumerableExpression sourceExpression, ulong keyCount, IReadOnlyList aggregates) : base(QLEnumerableExpressionKind.GroupBy) { - this.SourceExpression = sourceExpression; + this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.KeyCount = keyCount; - this.Aggregates = aggregates; + this.Aggregates = aggregates ?? throw new ArgumentNullException(nameof(aggregates)); } public QLEnumerableExpression SourceExpression { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs index b3b99df06f..6d84fac202 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLInputEnumerableExpression : QLEnumerableExpression { public QLInputEnumerableExpression(string name) : base(QLEnumerableExpressionKind.Input) { - this.Name = name; + this.Name = name ?? throw new ArgumentNullException(nameof(name)); } public string Name { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs index 3c5cac75a1..d4d6582697 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLIsOperatorScalarExpression : QLScalarExpression @@ -12,7 +13,7 @@ public QLIsOperatorScalarExpression(QLIsOperatorKind operatorKind, QLScalarExpre : base(QLScalarExpressionKind.IsOperator) { this.OperatorKind = operatorKind; - this.Expression = expression; + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } public QLIsOperatorKind OperatorKind { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs index 2510f042b1..4f26a239bd 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLLetScalarExpression : QLScalarExpression @@ -11,9 +12,9 @@ internal class QLLetScalarExpression : QLScalarExpression public QLLetScalarExpression(QLVariable declaredVariable, QLScalarExpression declaredVariableExpression, QLScalarExpression expression) : base(QLScalarExpressionKind.Let) { - this.DeclaredVariable = declaredVariable; - this.DeclaredVariableExpression = declaredVariableExpression; - this.Expression = expression; + this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); + this.DeclaredVariableExpression = declaredVariableExpression ?? throw new ArgumentNullException(nameof(declaredVariableExpression)); + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } public QLVariable DeclaredVariable { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs index a12da521cc..4950fcc57b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLLiteralScalarExpression : QLScalarExpression { public QLLiteralScalarExpression(QLLiteral literal) : base(QLScalarExpressionKind.Literal) { - this.Literal = literal; + this.Literal = literal ?? throw new ArgumentNullException(nameof(literal)); } public QLLiteral Literal { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs index 768f9b96bb..c74ed2cdd4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLMJavaScriptLiteral : QLLiteral { public QLMJavaScriptLiteral(string name) : base(QLLiteralKind.MJavaScript) { - this.Name = name; + this.Name = name ?? throw new ArgumentNullException(nameof(name)); } public string Name { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs index 67cb0b5380..df5db602c0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs @@ -4,13 +4,15 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLMRegexLiteral : QLLiteral { public QLMRegexLiteral(string pattern, string options) : base(QLLiteralKind.MRegex) { - this.Pattern = pattern; - this.Options = options; + this.Pattern = pattern ?? throw new ArgumentNullException(nameof(pattern)); + this.Options = options ?? throw new ArgumentNullException(nameof(options)); } public string Pattern { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs index a163eabc33..3a7bba559e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLMSymbolLiteral : QLLiteral { public QLMSymbolLiteral(string value) : base(QLLiteralKind.MSymbol) { - this.Value = value; + this.Value = value ?? throw new ArgumentNullException(nameof(value)); } public string Value { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs index 4656788984..ac7cfe0580 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs @@ -4,14 +4,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLMuxScalarExpression : QLScalarExpression { public QLMuxScalarExpression(QLScalarExpression conditionExpression, QLScalarExpression leftExpression, QLScalarExpression rightExpression) : base(QLScalarExpressionKind.Mux) { - this.ConditionExpression = conditionExpression; - this.LeftExpression = leftExpression; - this.RightExpression = rightExpression; + this.ConditionExpression = conditionExpression ?? throw new ArgumentNullException(nameof(conditionExpression)); + this.LeftExpression = leftExpression ?? throw new ArgumentNullException(nameof(leftExpression)); + this.RightExpression = rightExpression ?? throw new ArgumentNullException(nameof(rightExpression)); } public QLScalarExpression ConditionExpression { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs index 316f09c417..f7269bb1b5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLObjectCreateScalarExpression : QLScalarExpression @@ -11,7 +12,7 @@ internal class QLObjectCreateScalarExpression : QLScalarExpression public QLObjectCreateScalarExpression(IReadOnlyList properties, QLObjectKind objectKind) : base(QLScalarExpressionKind.ObjectCreate) { - this.Properties = properties; + this.Properties = properties ?? throw new ArgumentNullException(nameof(properties)); this.ObjectKind = objectKind; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs index 235449f7bc..0333652e8d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLObjectLiteral : QLLiteral @@ -11,7 +12,7 @@ internal class QLObjectLiteral : QLLiteral public QLObjectLiteral(IReadOnlyList properties) : base(QLLiteralKind.Object) { - this.Properties = properties; + this.Properties = properties ?? throw new ArgumentNullException(nameof(properties)); } public IReadOnlyList Properties { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs index 2af3016704..1aacf3895d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLObjectLiteralProperty { public QLObjectLiteralProperty(string name, QLLiteral literal) { - this.Name = name; - this.Literal = literal; + this.Name = name ?? throw new ArgumentNullException(nameof(name)); + this.Literal = literal ?? throw new ArgumentNullException(nameof(literal)); } public string Name { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs index 43555930fe..208513cca4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLObjectProperty { public QLObjectProperty(string name, QLScalarExpression expression) { - this.Name = name; - this.Expression = expression; + this.Name = name ?? throw new ArgumentNullException(nameof(name)); + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } public string Name { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs index 6ed5352d3f..ff1a2dc3eb 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLOrderByEnumerableExpression : QLEnumerableExpression @@ -11,9 +12,9 @@ internal class QLOrderByEnumerableExpression : QLEnumerableExpression public QLOrderByEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, IReadOnlyList items) : base(QLEnumerableExpressionKind.OrderBy) { - this.SourceExpression = sourceExpression; - this.DeclaredVariable = declaredVariable; - this.Items = items; + this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); + this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); + this.Items = items ?? throw new ArgumentNullException(nameof(items)); } public QLEnumerableExpression SourceExpression { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs index b01a1330f7..8ac66f2138 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs @@ -4,11 +4,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLOrderByItem { public QLOrderByItem(QLScalarExpression expression, QLSortOrder sortOrder) { - this.Expression = expression; + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); this.SortOrder = sortOrder; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs index be876b3f96..365c4f9cf4 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLPropertyRefScalarExpression : QLScalarExpression @@ -11,8 +12,8 @@ internal class QLPropertyRefScalarExpression : QLScalarExpression public QLPropertyRefScalarExpression(QLScalarExpression expression, string propertyName) : base(QLScalarExpressionKind.PropertyRef) { - this.Expression = expression; - this.PropertyName = propertyName; + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); + this.PropertyName = propertyName ?? throw new ArgumentNullException(nameof(propertyName)); } public QLScalarExpression Expression { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs index 86eaa60c25..fe0d0e12be 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLScalarAsEnumerableExpression : QLEnumerableExpression { public QLScalarAsEnumerableExpression(QLScalarExpression expression, QLEnumerationKind enumerationKind) : base(QLEnumerableExpressionKind.ScalarAsEnumerable) { - this.Expression = expression; + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); this.EnumerationKind = enumerationKind; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs index 348c316255..e904851136 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs @@ -4,14 +4,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLSelectEnumerableExpression : QLEnumerableExpression { public QLSelectEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, QLScalarExpression expression) : base(QLEnumerableExpressionKind.Select) { - this.SourceExpression = sourceExpression; - this.DeclaredVariable = declaredVariable; - this.Expression = expression; + this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); + this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } public QLEnumerableExpression SourceExpression { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs index 43059dbb56..247e68a9aa 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs @@ -4,14 +4,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLSelectManyEnumerableExpression : QLEnumerableExpression { public QLSelectManyEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, QLEnumerableExpression selectorExpression) : base(QLEnumerableExpressionKind.SelectMany) { - this.SourceExpression = sourceExpression; - this.DeclaredVariable = declaredVariable; - this.SelectorExpression = selectorExpression; + this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); + this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); + this.SelectorExpression = selectorExpression ?? throw new ArgumentNullException(nameof(selectorExpression)); } public QLEnumerableExpression SourceExpression { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs index fb679296e8..60e8b7fb49 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLStringLiteral : QLLiteral { public QLStringLiteral(string value) : base(QLLiteralKind.String) { - this.Value = value; + this.Value = value ?? throw new ArgumentNullException(nameof(value)); } public string Value { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs index 531aabd3c7..599a3bab49 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLSystemFunctionCallScalarExpression : QLScalarExpression @@ -12,7 +13,7 @@ public QLSystemFunctionCallScalarExpression(QLBuiltinScalarFunctionKind function : base(QLScalarExpressionKind.SystemFunctionCall) { this.FunctionKind = functionKind; - this.Arguments = arguments; + this.Arguments = arguments ?? throw new ArgumentNullException(nameof(arguments)); } public QLBuiltinScalarFunctionKind FunctionKind { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs index 37c76dea6c..a71d3c8492 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLTakeEnumerableExpression : QLEnumerableExpression { public QLTakeEnumerableExpression(QLEnumerableExpression sourceExpression, ulong skipValue, ulong takeValue) : base(QLEnumerableExpressionKind.Take) { - this.SourceExpression = sourceExpression; + this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.SkipValue = skipValue; this.TakeValue = takeValue; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs index 1481fd9384..3709821218 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLTupleAggregate : QLAggregate @@ -11,7 +12,7 @@ internal class QLTupleAggregate : QLAggregate public QLTupleAggregate(IReadOnlyList items) : base(QLAggregateKind.Tuple) { - this.Items = items; + this.Items = items ?? throw new ArgumentNullException(nameof(items)); } public IReadOnlyList Items { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs index da86f312c5..dc9303095a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLTupleCreateScalarExpression : QLScalarExpression @@ -11,7 +12,7 @@ internal class QLTupleCreateScalarExpression : QLScalarExpression public QLTupleCreateScalarExpression(IReadOnlyList items) : base(QLScalarExpressionKind.TupleCreate) { - this.Items = items; + this.Items = items ?? throw new ArgumentNullException(nameof(items)); } public IReadOnlyList Items { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs index 0cd4c713b5..fc81f78997 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLTupleItemRefScalarExpression : QLScalarExpression { public QLTupleItemRefScalarExpression(QLScalarExpression expression, ulong index) : base(QLScalarExpressionKind.TupleItemRef) { - this.Expression = expression; + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); this.Index = index; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs index dd7e1b1f88..b0ad46aa9e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs @@ -4,13 +4,15 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLUnaryScalarExpression : QLScalarExpression { public QLUnaryScalarExpression(QLUnaryScalarOperatorKind operatorKind, QLScalarExpression expression) : base(QLScalarExpressionKind.UnaryOperator) { this.OperatorKind = operatorKind; - this.Expression = expression; + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } public QLUnaryScalarOperatorKind OperatorKind { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs index 95e9507ab1..4cd257fb07 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs @@ -4,6 +4,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; using System.Collections.Generic; internal class QLUserDefinedFunctionCallScalarExpression : QLScalarExpression @@ -11,8 +12,8 @@ internal class QLUserDefinedFunctionCallScalarExpression : QLScalarExpression public QLUserDefinedFunctionCallScalarExpression(QLFunctionIdentifier identifier, IReadOnlyList arguments, bool builtin) : base(QLScalarExpressionKind.UserDefinedFunctionCall) { - this.Identifier = identifier; - this.Arguments = arguments; + this.Identifier = identifier ?? throw new ArgumentNullException(nameof(identifier)); + this.Arguments = arguments ?? throw new ArgumentNullException(nameof(arguments)); this.Builtin = builtin; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs index 1d1c1bd7d0..364a43ae06 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs @@ -4,11 +4,13 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLVariable { public QLVariable(string name, long uniqueId) { - this.Name = name; + this.Name = name ?? throw new ArgumentNullException(nameof(name)); this.UniqueId = uniqueId; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs index e7ac80232f..fe42eb27f1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs @@ -4,12 +4,14 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLVariableRefScalarExpression : QLScalarExpression { public QLVariableRefScalarExpression(QLVariable variable) : base(QLScalarExpressionKind.VariableRef) { - this.Variable = variable; + this.Variable = variable ?? throw new ArgumentNullException(nameof(variable)); } public QLVariable Variable { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs index e0941b58c2..ba08e0a538 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs @@ -4,14 +4,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL { + using System; + internal class QLWhereEnumerableExpression : QLEnumerableExpression { public QLWhereEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, QLScalarExpression expression) : base(QLEnumerableExpressionKind.Where) { - this.SourceExpression = sourceExpression; - this.DeclaredVariable = declaredVariable; - this.Expression = expression; + this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); + this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); + this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } public QLEnumerableExpression SourceExpression { get; } From 79870caf62c8e9f7021674254d97b3fa8e3bd096 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Thu, 21 Sep 2023 13:22:59 -0700 Subject: [PATCH 33/36] Updated the name CoordinatorDistributionPlan to ClientDistributionPlan --- .../ClientDistributionPlanDeserializer.cs} | 14 +-- .../QL/ClientDistributionPlan.cs} | 6 +- .../QL/QLAggregate.cs | 2 +- .../QL/QLAggregateEnumerableExpression.cs | 2 +- .../QL/QLAggregateKind.cs | 2 +- .../QL/QLAggregateOperatorKind.cs | 2 +- .../QL/QLArrayCreateScalarExpression.cs | 2 +- .../QL/QLArrayIndexerScalarExpression.cs | 2 +- .../QL/QLArrayKind.cs | 2 +- .../QL/QLArrayLiteral.cs | 2 +- .../QL/QLBinaryLiteral.cs | 2 +- .../QL/QLBinaryScalarExpression.cs | 2 +- .../QL/QLBinaryScalarOperatorKind.cs | 2 +- .../QL/QLBooleanLiteral.cs | 2 +- .../QL/QLBuiltinAggregate.cs | 2 +- .../QL/QLBuiltinScalarFunctionKind.cs | 2 +- .../QL/QLCGuidLiteral.cs | 2 +- .../QL/QLCNumberLiteral.cs | 2 +- .../QL/QLDistinctEnumerableExpression.cs | 2 +- .../QL/QLEnumerableExpression.cs | 2 +- .../QL/QLEnumerableExpressionKind.cs | 2 +- .../QL/QLEnumerationKind.cs | 2 +- .../QL/QLFunctionIdentifier.cs | 2 +- .../QL/QLGroupByEnumerableExpression.cs | 2 +- .../QL/QLInputEnumerableExpression.cs | 2 +- .../QL/QLIsOperatorKind.cs | 2 +- .../QL/QLIsOperatorScalarExpression.cs | 2 +- .../QL/QLLetScalarExpression.cs | 2 +- .../QL/QLLiteral.cs | 2 +- .../QL/QLLiteralKind.cs | 2 +- .../QL/QLLiteralScalarExpression.cs | 2 +- .../QL/QLMDateTimeLiteral.cs | 2 +- .../QL/QLMJavaScriptLiteral.cs | 2 +- .../QL/QLMNumberLiteral.cs | 2 +- .../QL/QLMRegexLiteral.cs | 2 +- .../QL/QLMSingletonLiteral.cs | 2 +- .../QL/QLMSymbolLiteral.cs | 2 +- .../QL/QLMuxScalarExpression.cs | 2 +- .../QL/QLNullLiteral.cs | 2 +- .../QL/QLNumberLiteral.cs | 2 +- .../QL/QLObjectCreateScalarExpression.cs | 2 +- .../QL/QLObjectKind.cs | 2 +- .../QL/QLObjectLiteral.cs | 2 +- .../QL/QLObjectLiteralProperty.cs | 2 +- .../QL/QLObjectProperty.cs | 2 +- .../QL/QLOrderByEnumerableExpression.cs | 2 +- .../QL/QLOrderByItem.cs | 2 +- .../QL/QLPropertyRefScalarExpression.cs | 2 +- .../QL/QLScalarAsEnumerableExpression.cs | 2 +- .../QL/QLScalarExpression.cs | 2 +- .../QL/QLScalarExpressionKind.cs | 2 +- .../QL/QLSelectEnumerableExpression.cs | 2 +- .../QL/QLSelectManyEnumerableExpression.cs | 2 +- .../QL/QLSortOrder.cs | 2 +- .../QL/QLStringLiteral.cs | 2 +- .../QLSystemFunctionCallScalarExpression.cs | 2 +- .../QL/QLTakeEnumerableExpression.cs | 2 +- .../QL/QLTupleAggregate.cs | 2 +- .../QL/QLTupleCreateScalarExpression.cs | 2 +- .../QL/QLTupleItemRefScalarExpression.cs | 2 +- .../QL/QLUnaryScalarExpression.cs | 2 +- .../QL/QLUnaryScalarOperatorKind.cs | 2 +- .../QL/QLUndefinedLiteral.cs | 2 +- ...UserDefinedFunctionCallScalarExpression.cs | 2 +- .../QL/QLVariable.cs | 2 +- .../QL/QLVariableRefScalarExpression.cs | 2 +- .../QL/QLWhereEnumerableExpression.cs | 2 +- ...ClientDistributionPlanDeserialization.xml} | 24 ++--- .../ClientDistributionPlanBaselineTests.cs | 100 +++++++++++++++++ ...oordinatorDistributionPlanBaselineTests.cs | 101 ------------------ 70 files changed, 187 insertions(+), 188 deletions(-) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs => ClientDistributionPlan/ClientDistributionPlanDeserializer.cs} (98%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs => ClientDistributionPlan/QL/ClientDistributionPlan.cs} (66%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLAggregate.cs (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLAggregateEnumerableExpression.cs (91%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLAggregateKind.cs (78%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLAggregateOperatorKind.cs (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLArrayCreateScalarExpression.cs (91%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLArrayIndexerScalarExpression.cs (90%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLArrayKind.cs (81%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLArrayLiteral.cs (88%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLBinaryLiteral.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLBinaryScalarExpression.cs (92%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLBinaryScalarOperatorKind.cs (89%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLBooleanLiteral.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLBuiltinAggregate.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLBuiltinScalarFunctionKind.cs (97%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLCGuidLiteral.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLCNumberLiteral.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLDistinctEnumerableExpression.cs (93%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLEnumerableExpression.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLEnumerableExpressionKind.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLEnumerationKind.cs (81%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLFunctionIdentifier.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLGroupByEnumerableExpression.cs (92%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLInputEnumerableExpression.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLIsOperatorKind.cs (77%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLIsOperatorScalarExpression.cs (91%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLLetScalarExpression.cs (93%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLLiteral.cs (83%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLLiteralKind.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLLiteralScalarExpression.cs (88%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLMDateTimeLiteral.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLMJavaScriptLiteral.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLMNumberLiteral.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLMRegexLiteral.cs (89%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLMSingletonLiteral.cs (88%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLMSymbolLiteral.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLMuxScalarExpression.cs (93%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLNullLiteral.cs (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLNumberLiteral.cs (86%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLObjectCreateScalarExpression.cs (91%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLObjectKind.cs (78%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLObjectLiteral.cs (89%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLObjectLiteralProperty.cs (89%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLObjectProperty.cs (89%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLOrderByEnumerableExpression.cs (93%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLOrderByItem.cs (89%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLPropertyRefScalarExpression.cs (91%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLScalarAsEnumerableExpression.cs (91%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLScalarExpression.cs (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLScalarExpressionKind.cs (88%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLSelectEnumerableExpression.cs (93%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLSelectManyEnumerableExpression.cs (93%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLSortOrder.cs (78%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLStringLiteral.cs (86%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLSystemFunctionCallScalarExpression.cs (91%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLTakeEnumerableExpression.cs (91%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLTupleAggregate.cs (88%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLTupleCreateScalarExpression.cs (89%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLTupleItemRefScalarExpression.cs (90%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLUnaryScalarExpression.cs (90%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLUnaryScalarOperatorKind.cs (80%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLUndefinedLiteral.cs (85%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLUserDefinedFunctionCallScalarExpression.cs (92%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLVariable.cs (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLVariableRefScalarExpression.cs (88%) rename Microsoft.Azure.Cosmos/src/Query/Core/{CoordinatorDistributionPlan => ClientDistributionPlan}/QL/QLWhereEnumerableExpression.cs (93%) rename Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/{CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml => ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml} (69%) create mode 100644 Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/ClientDistributionPlanBaselineTests.cs delete mode 100644 Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs similarity index 98% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs index 87b987bb84..7d4ff68d67 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/CoordinatorDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan { using System; using System.Collections.Generic; @@ -10,7 +10,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan using Microsoft.Azure.Cosmos.CosmosElements; using QL; - internal static class CoordinatorDistributionPlanDeserializer + internal static class ClientDistributionPlanDeserializer { private static class Constants { @@ -21,7 +21,7 @@ private static class Constants public const string Builtin = "Builtin"; public const string ClientQL = "clientQL"; public const string ConditionExpression = "ConditionExpression"; - public const string CoordinatorDistributionPlan = "coordinatorDistributionPlan"; + public const string ClientDistributionPlan = "clientDistributionPlan"; public const string DeclaredVariable = "DeclaredVariable"; public const string DeclaredVariableExpression = "DeclaredVariableExpression"; public const string Delegate = "Delegate"; @@ -67,14 +67,14 @@ private static class Constants public const string Where = "Where"; } - public static CoordinatorDistributionPlan DeserializeCoordinatorDistributionPlan(string jsonString) + public static ClientDistributionPlan DeserializeClientDistributionPlan(string jsonString) { CosmosObject cosmosObject = CosmosObject.Parse(jsonString); - CosmosObject coordinatorDistributionPlanElement = GetValue(cosmosObject, Constants.CoordinatorDistributionPlan); - CosmosObject clientQLElement = GetValue(coordinatorDistributionPlanElement, Constants.ClientQL); + CosmosObject clientDistributionPlanElement = GetValue(cosmosObject, Constants.ClientDistributionPlan); + CosmosObject clientQLElement = GetValue(clientDistributionPlanElement, Constants.ClientQL); QLEnumerableExpression expression = DeserializeQLEnumerableExpression(clientQLElement); - return new CoordinatorDistributionPlan(expression); + return new ClientDistributionPlan(expression); } #region Enumerable Expressions diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/ClientDistributionPlan.cs similarity index 66% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/ClientDistributionPlan.cs index f5d113f71a..1f3aabcb7e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/CoordinatorDistributionPlan.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/ClientDistributionPlan.cs @@ -2,13 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; - internal class CoordinatorDistributionPlan + internal class ClientDistributionPlan { - public CoordinatorDistributionPlan(QLEnumerableExpression clientQL) + public ClientDistributionPlan(QLEnumerableExpression clientQL) { this.ClientQL = clientQL ?? throw new ArgumentNullException(nameof(clientQL)); } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregate.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregate.cs index c73e924865..9d28a6b5ed 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregate.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal abstract class QLAggregate { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateEnumerableExpression.cs similarity index 91% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateEnumerableExpression.cs index b8d3b7963c..2e7a1b2ee2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateKind.cs similarity index 78% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateKind.cs index e1d156240e..f5558a7ee5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLAggregateKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs index a64c9e23f7..edc9f6b6e5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLAggregateOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLAggregateOperatorKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs similarity index 91% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs index 6d85134b1c..a02945d37a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayIndexerScalarExpression.cs similarity index 90% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayIndexerScalarExpression.cs index 70a4b9f139..239ba13821 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayIndexerScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayIndexerScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayKind.cs similarity index 81% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayKind.cs index 0dd59532ed..acfc2f286b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLArrayKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayLiteral.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayLiteral.cs index 9629b09384..6733be88fe 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLArrayLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryLiteral.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryLiteral.cs index cb254c40a6..5b649cafd6 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarExpression.cs similarity index 92% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarExpression.cs index 3f3d91d838..d51e24dc90 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarOperatorKind.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarOperatorKind.cs index 9e9780fbf8..78bfe0aa4f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBinaryScalarOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarOperatorKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLBinaryScalarOperatorKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBooleanLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBooleanLiteral.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBooleanLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBooleanLiteral.cs index cf3a5d93dd..cf647fa883 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBooleanLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBooleanLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal class QLBooleanLiteral : QLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinAggregate.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinAggregate.cs index 1a5b0bf9c5..cc62f8c3d5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinAggregate.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal class QLBuiltinAggregate : QLAggregate { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs similarity index 97% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs index 2d0296c4ce..e63e2fc235 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLBuiltinScalarFunctionKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCGuidLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCGuidLiteral.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCGuidLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCGuidLiteral.cs index 9545575d76..03ec3316a2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCGuidLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCGuidLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal class QLCGuidLiteral : QLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCNumberLiteral.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCNumberLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCNumberLiteral.cs index aa129b3fae..91a96f75c3 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLCNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCNumberLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal class QLCNumberLiteral : QLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLDistinctEnumerableExpression.cs similarity index 93% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLDistinctEnumerableExpression.cs index 3a76f4a0e8..d93437fd55 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLDistinctEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLDistinctEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpression.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpression.cs index 0fbdedd57f..5461a0052e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal abstract class QLEnumerableExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpressionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs index 950b83630f..12ce7e8105 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerableExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLEnumerableExpressionKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerationKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerationKind.cs similarity index 81% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerationKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerationKind.cs index fb23ddd0ce..eada610bee 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLEnumerationKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerationKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLEnumerationKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLFunctionIdentifier.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLFunctionIdentifier.cs index 81e50ae77e..d822a206a8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLFunctionIdentifier.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLFunctionIdentifier.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLGroupByEnumerableExpression.cs similarity index 92% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLGroupByEnumerableExpression.cs index 05dededf51..2f2c43d5e8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLGroupByEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLInputEnumerableExpression.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLInputEnumerableExpression.cs index 6d84fac202..90199c348a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLInputEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLInputEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorKind.cs similarity index 77% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorKind.cs index f90fb7b84b..d2a0b77e77 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLIsOperatorKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorScalarExpression.cs similarity index 91% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorScalarExpression.cs index d4d6582697..9107d9348c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLIsOperatorScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs similarity index 93% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs index 4f26a239bd..3f97b1302b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLetScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteral.cs similarity index 83% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteral.cs index f04a6e886d..ca1ff6a68f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal abstract class QLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs index 1c5b7acf1d..85e9256d6d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLLiteralKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralScalarExpression.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralScalarExpression.cs index 4950fcc57b..4d8724943a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLLiteralScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMDateTimeLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMDateTimeLiteral.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMDateTimeLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMDateTimeLiteral.cs index a326370571..b3136da025 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMDateTimeLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMDateTimeLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal class QLMDateTimeLiteral : QLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMJavaScriptLiteral.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMJavaScriptLiteral.cs index c74ed2cdd4..c1061dc8ab 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMJavaScriptLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMJavaScriptLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMNumberLiteral.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMNumberLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMNumberLiteral.cs index c0d3911009..3ef0969f73 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMNumberLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal class QLMNumberLiteral : QLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMRegexLiteral.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMRegexLiteral.cs index df5db602c0..ce4219f930 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMRegexLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMRegexLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSingletonLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSingletonLiteral.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSingletonLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSingletonLiteral.cs index ac6c792151..d3e543983c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSingletonLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSingletonLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal class QLMSingletonLiteral : QLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSymbolLiteral.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSymbolLiteral.cs index 3a7bba559e..34610c80b2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMSymbolLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSymbolLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMuxScalarExpression.cs similarity index 93% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMuxScalarExpression.cs index ac7cfe0580..5111fd64cf 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLMuxScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMuxScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNullLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNullLiteral.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNullLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNullLiteral.cs index 171bdf994a..af21c7b483 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNullLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNullLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal class QLNullLiteral : QLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNumberLiteral.cs similarity index 86% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNumberLiteral.cs index d29d55b893..6c5ddec82a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNumberLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs similarity index 91% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs index f7269bb1b5..f24f16c9ec 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectKind.cs similarity index 78% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectKind.cs index 543b481b86..61b2ccefb1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLObjectKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteral.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteral.cs index 0333652e8d..28e0f11641 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteralProperty.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteralProperty.cs index 1aacf3895d..6bbb6f858d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectLiteralProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteralProperty.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectProperty.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectProperty.cs index 208513cca4..ad61a933d9 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLObjectProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectProperty.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByEnumerableExpression.cs similarity index 93% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByEnumerableExpression.cs index ff1a2dc3eb..62d06e898e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByItem.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByItem.cs index 8ac66f2138..867ebe3277 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLOrderByItem.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByItem.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLPropertyRefScalarExpression.cs similarity index 91% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLPropertyRefScalarExpression.cs index 365c4f9cf4..af0ae002d0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLPropertyRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLPropertyRefScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarAsEnumerableExpression.cs similarity index 91% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarAsEnumerableExpression.cs index fe0d0e12be..ac036fc2d1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarAsEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarAsEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpression.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpression.cs index efd998a53d..12f461ab10 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal abstract class QLScalarExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpressionKind.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpressionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpressionKind.cs index ab939ab1f9..b06f2983a5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLScalarExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpressionKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLScalarExpressionKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectEnumerableExpression.cs similarity index 93% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectEnumerableExpression.cs index e904851136..6e7279d862 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectManyEnumerableExpression.cs similarity index 93% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectManyEnumerableExpression.cs index 247e68a9aa..8088a1e006 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSelectManyEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectManyEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSortOrder.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSortOrder.cs similarity index 78% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSortOrder.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSortOrder.cs index c9aa9af8c7..d16fec19a8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSortOrder.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSortOrder.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLSortOrder { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLStringLiteral.cs similarity index 86% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLStringLiteral.cs index 60e8b7fb49..1261d3f29f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLStringLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLStringLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs similarity index 91% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs index 599a3bab49..a4521d04dc 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTakeEnumerableExpression.cs similarity index 91% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTakeEnumerableExpression.cs index a71d3c8492..d41b8fdac5 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTakeEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTakeEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleAggregate.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleAggregate.cs index 3709821218..78c437e98d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleAggregate.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleCreateScalarExpression.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleCreateScalarExpression.cs index dc9303095a..e0d8c3fd76 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleCreateScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleItemRefScalarExpression.cs similarity index 90% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleItemRefScalarExpression.cs index fc81f78997..752ba4a046 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLTupleItemRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleItemRefScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarExpression.cs similarity index 90% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarExpression.cs index b0ad46aa9e..40a885fb1d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarOperatorKind.cs similarity index 80% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarOperatorKind.cs index 1d1d14c5a0..3c87772719 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUnaryScalarOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarOperatorKind.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal enum QLUnaryScalarOperatorKind { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUndefinedLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUndefinedLiteral.cs similarity index 85% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUndefinedLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUndefinedLiteral.cs index c7bf84e805..255120f28a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUndefinedLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUndefinedLiteral.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { internal class QLUndefinedLiteral : QLLiteral { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs similarity index 92% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs index 4cd257fb07..e3401e2f76 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; using System.Collections.Generic; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariable.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariable.cs index 364a43ae06..1b6afcb5ba 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariable.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariable.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariableRefScalarExpression.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariableRefScalarExpression.cs index fe42eb27f1..ec73507f04 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLVariableRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariableRefScalarExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLWhereEnumerableExpression.cs similarity index 93% rename from Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLWhereEnumerableExpression.cs index ba08e0a538..535779f48d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/CoordinatorDistributionPlan/QL/QLWhereEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLWhereEnumerableExpression.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml similarity index 69% rename from Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml rename to Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml index bb1772e9e5..afa298ae19 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/CoordinatorDistributionPlanBaselineTests.TestCoordinatorDistributionPlanDeserialization.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml @@ -2,24 +2,24 @@ Input Expression - {"coordinatorDistributionPlan": {"clientQL": {"Kind": "Input","Name": "root"}}} + {"clientDistributionPlan": {"clientQL": {"Kind": "Input","Name": "root"}}} - { + { "ClientQL": { "Name": "root", "Kind": 4 } -} +} Aggregate and ObjectCreate Expressions - {"coordinatorDistributionPlan": {"clientQL": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a","Expression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6}}}]},"SourceExpression": {"Kind": "Aggregate","Aggregate": {"Kind": "Builtin","OperatorKind": "Sum"},"SourceExpression": {"Kind": "Input","Name": "root"}}}}} + {"clientDistributionPlan": {"clientQL": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a","Expression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6}}}]},"SourceExpression": {"Kind": "Aggregate","Aggregate": {"Kind": "Builtin","OperatorKind": "Sum"},"SourceExpression": {"Kind": "Input","Name": "root"}}}}} - { + { "ClientQL": { "SourceExpression": { "SourceExpression": { @@ -54,16 +54,16 @@ }, "Kind": 7 } -} +} Select, Aggregate and BinaryOperator Expressions - {"coordinatorDistributionPlan": {"clientQL": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 10 }, "Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [ {"Name": "F1","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "FieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "FieldSum", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 1 }},{ "Name": "FieldAvg", "Expression": {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "Equal", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }, "RightExpression": {"Kind": "Literal","Literal": { "Kind": "Number", "Value": 0} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Undefined" }},"RightExpression": { "Kind": "BinaryOperator", "OperatorKind": "Divide", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 0 }, "RightExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }}}}]}}, {"Name": "F2","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "OtherFieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "OtherFieldMax", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 3 }} ]} }] }, "SourceExpression": {"Kind": "GroupBy","KeyCount": 1,"Aggregates": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Tuple","Items": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Builtin","OperatorKind": "Sum" }] }, {"Kind": "Builtin","OperatorKind": "Max" }],"SourceExpression": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 16 }, "Expression": {"Kind": "TupleCreate","Items": [ {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 0 }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} }, {"Kind": "TupleCreate","Items": [ {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 2 }, "Index": 0} }, {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 1 }] }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16}},"Index": 3}, "Index": 0}}]}, "SourceExpression": {"Kind": "Input","Name": "root"}}}}}} + {"clientDistributionPlan": {"clientQL": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 10 }, "Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [ {"Name": "F1","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "FieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "FieldSum", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 1 }},{ "Name": "FieldAvg", "Expression": {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "Equal", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }, "RightExpression": {"Kind": "Literal","Literal": { "Kind": "Number", "Value": 0} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Undefined" }},"RightExpression": { "Kind": "BinaryOperator", "OperatorKind": "Divide", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 0 }, "RightExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }}}}]}}, {"Name": "F2","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "OtherFieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "OtherFieldMax", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 3 }} ]} }] }, "SourceExpression": {"Kind": "GroupBy","KeyCount": 1,"Aggregates": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Tuple","Items": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Builtin","OperatorKind": "Sum" }] }, {"Kind": "Builtin","OperatorKind": "Max" }],"SourceExpression": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 16 }, "Expression": {"Kind": "TupleCreate","Items": [ {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 0 }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} }, {"Kind": "TupleCreate","Items": [ {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 2 }, "Index": 0} }, {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 1 }] }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16}},"Index": 3}, "Index": 0}}]}, "SourceExpression": {"Kind": "Input","Name": "root"}}}}}} - { + { "ClientQL": { "SourceExpression": { "SourceExpression": { @@ -545,16 +545,16 @@ }, "Kind": 7 } -} +} Select, Sum and VariableRef Expressions - {"coordinatorDistributionPlan": {"clientQL": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a_plus_five","Expression": {"Kind": "BinaryOperator","OperatorKind": "Add","LeftExpression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6 }}, "RightExpression": { "Kind": "Literal", "Literal": { "Kind": "Number", "Value": 5 }}}}]}, "SourceExpression": { "Kind": "Aggregate", "Aggregate": { "Kind": "Builtin", "OperatorKind": "Sum" }, "SourceExpression": { "Kind": "Input", "Name": "root" }}}}} + {"clientDistributionPlan": {"clientQL": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a_plus_five","Expression": {"Kind": "BinaryOperator","OperatorKind": "Add","LeftExpression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6 }}, "RightExpression": { "Kind": "Literal", "Literal": { "Kind": "Number", "Value": 5 }}}}]}, "SourceExpression": { "Kind": "Aggregate", "Aggregate": { "Kind": "Builtin", "OperatorKind": "Sum" }, "SourceExpression": { "Kind": "Input", "Name": "root" }}}}} - { + { "ClientQL": { "SourceExpression": { "SourceExpression": { @@ -600,7 +600,7 @@ }, "Kind": 7 } -} +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/ClientDistributionPlanBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/ClientDistributionPlanBaselineTests.cs new file mode 100644 index 0000000000..0307920504 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/ClientDistributionPlanBaselineTests.cs @@ -0,0 +1,100 @@ +namespace Microsoft.Azure.Cosmos.Tests.Query +{ + using System.Collections.Generic; + using System.Xml; + using Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan; + using Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL; + using Microsoft.Azure.Cosmos.Test.BaselineTest; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + [TestClass] + public class ClientDistributionPlanBaselineTests : BaselineTests + { + [TestMethod] + [Owner("akotalwar")] + public void TestClientDistributionPlanDeserialization() + { + List testVariations = new List + { + CreateInput( + description: @"Input Expression", + clientPlanJson: "{\"clientDistributionPlan\": {\"clientQL\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}"), + + CreateInput( + description: @"Aggregate and ObjectCreate Expressions", + clientPlanJson: "{\"clientDistributionPlan\": {\"clientQL\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a\",\"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6}}}]},\"SourceExpression\": {\"Kind\": \"Aggregate\",\"Aggregate\": {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\"},\"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}"), + + CreateInput( + description: @"Select, Aggregate and BinaryOperator Expressions", + clientPlanJson: "{\"clientDistributionPlan\": {\"clientQL\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 10 }, \"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [ {\"Name\": \"F1\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"FieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"FieldSum\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 1 }},{ \"Name\": \"FieldAvg\", \"Expression\": {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Equal\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }, \"RightExpression\": {\"Kind\": \"Literal\",\"Literal\": { \"Kind\": \"Number\", \"Value\": 0} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Undefined\" }},\"RightExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Divide\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 0 }, \"RightExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }}}}]}}, {\"Name\": \"F2\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"OtherFieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"OtherFieldMax\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 3 }} ]} }] }, \"SourceExpression\": {\"Kind\": \"GroupBy\",\"KeyCount\": 1,\"Aggregates\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Tuple\",\"Items\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }] }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Max\" }],\"SourceExpression\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 16 }, \"Expression\": {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 0 }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} }, {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 2 }, \"Index\": 0} }, {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 1 }] }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16}},\"Index\": 3}, \"Index\": 0}}]}, \"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}}"), + + CreateInput( + description: @"Select, Sum and VariableRef Expressions", + clientPlanJson: "{\"clientDistributionPlan\": {\"clientQL\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a_plus_five\",\"Expression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"Add\",\"LeftExpression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6 }}, \"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": { \"Kind\": \"Number\", \"Value\": 5 }}}}]}, \"SourceExpression\": { \"Kind\": \"Aggregate\", \"Aggregate\": { \"Kind\": \"Builtin\", \"OperatorKind\": \"Sum\" }, \"SourceExpression\": { \"Kind\": \"Input\", \"Name\": \"root\" }}}}}"), + }; + + this.ExecuteTestSuite(testVariations); + } + + + private static ClientDistributionPlanTestInput CreateInput( + string description, + string clientPlanJson) + { + return new ClientDistributionPlanTestInput(description, clientPlanJson); + } + + public override ClientDistributionPlanTestOutput ExecuteTest(ClientDistributionPlanTestInput input) + { + JsonSerializerSettings settings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented + }; + + ClientDistributionPlan distributionPlan = ClientDistributionPlanDeserializer.DeserializeClientDistributionPlan(input.ClientPlanJson); + string serializedDistributionPlan = JsonConvert.SerializeObject(distributionPlan, settings); + + return new ClientDistributionPlanTestOutput(serializedDistributionPlan); + } + + public sealed class ClientDistributionPlanTestOutput : BaselineTestOutput + { + public ClientDistributionPlanTestOutput(string serializedclientPlanJson) + { + this.SerializedclientPlanJson = serializedclientPlanJson; + } + + public string SerializedclientPlanJson { get; } + + public override void SerializeAsXml(XmlWriter xmlWriter) + { + JObject jObject = JObject.Parse(this.SerializedclientPlanJson); + string jsonString = jObject.ToString(); + xmlWriter.WriteStartElement("SerializedClientPlanJson"); + xmlWriter.WriteString(jsonString); + xmlWriter.WriteEndElement(); + } + } + + public sealed class ClientDistributionPlanTestInput : BaselineTestInput + { + internal string ClientPlanJson { get; set; } + + internal ClientDistributionPlanTestInput( + string description, + string clientPlanJson) + : base(description) + { + this.ClientPlanJson = clientPlanJson; + } + + public override void SerializeAsXml(XmlWriter xmlWriter) + { + xmlWriter.WriteElementString("Description", this.Description); + xmlWriter.WriteElementString("ClientDistributionPlanJson", this.ClientPlanJson); + } + } + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs deleted file mode 100644 index f845a77334..0000000000 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/CoordinatorDistributionPlanBaselineTests.cs +++ /dev/null @@ -1,101 +0,0 @@ -namespace Microsoft.Azure.Cosmos.Tests.Query -{ - using System.Collections.Generic; - using System.Xml; - using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan; - using Microsoft.Azure.Cosmos.Query.Core.CoordinatorDistributionPlan.QL; - using Microsoft.Azure.Cosmos.Test.BaselineTest; - using Microsoft.Azure.Documents; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using Newtonsoft.Json; - using Newtonsoft.Json.Linq; - - [TestClass] - public class CoordinatorDistributionPlanBaselineTests : BaselineTests - { - [TestMethod] - [Owner("akotalwar")] - public void TestCoordinatorDistributionPlanDeserialization() - { - List testVariations = new List - { - CreateInput( - description: @"Input Expression", - coordinatorPlanJson: "{\"coordinatorDistributionPlan\": {\"clientQL\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}"), - - CreateInput( - description: @"Aggregate and ObjectCreate Expressions", - coordinatorPlanJson: "{\"coordinatorDistributionPlan\": {\"clientQL\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a\",\"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6}}}]},\"SourceExpression\": {\"Kind\": \"Aggregate\",\"Aggregate\": {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\"},\"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}"), - - CreateInput( - description: @"Select, Aggregate and BinaryOperator Expressions", - coordinatorPlanJson: "{\"coordinatorDistributionPlan\": {\"clientQL\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 10 }, \"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [ {\"Name\": \"F1\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"FieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"FieldSum\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 1 }},{ \"Name\": \"FieldAvg\", \"Expression\": {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Equal\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }, \"RightExpression\": {\"Kind\": \"Literal\",\"Literal\": { \"Kind\": \"Number\", \"Value\": 0} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Undefined\" }},\"RightExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Divide\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 0 }, \"RightExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }}}}]}}, {\"Name\": \"F2\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"OtherFieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"OtherFieldMax\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 3 }} ]} }] }, \"SourceExpression\": {\"Kind\": \"GroupBy\",\"KeyCount\": 1,\"Aggregates\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Tuple\",\"Items\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }] }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Max\" }],\"SourceExpression\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 16 }, \"Expression\": {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 0 }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} }, {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 2 }, \"Index\": 0} }, {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 1 }] }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16}},\"Index\": 3}, \"Index\": 0}}]}, \"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}}"), - - CreateInput( - description: @"Select, Sum and VariableRef Expressions", - coordinatorPlanJson: "{\"coordinatorDistributionPlan\": {\"clientQL\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a_plus_five\",\"Expression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"Add\",\"LeftExpression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6 }}, \"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": { \"Kind\": \"Number\", \"Value\": 5 }}}}]}, \"SourceExpression\": { \"Kind\": \"Aggregate\", \"Aggregate\": { \"Kind\": \"Builtin\", \"OperatorKind\": \"Sum\" }, \"SourceExpression\": { \"Kind\": \"Input\", \"Name\": \"root\" }}}}}"), - }; - - this.ExecuteTestSuite(testVariations); - } - - - private static CoordinatorDistributionPlanTestInput CreateInput( - string description, - string coordinatorPlanJson) - { - return new CoordinatorDistributionPlanTestInput(description, coordinatorPlanJson); - } - - public override CoordinatorDistributionPlanTestOutput ExecuteTest(CoordinatorDistributionPlanTestInput input) - { - JsonSerializerSettings settings = new JsonSerializerSettings - { - Formatting = Newtonsoft.Json.Formatting.Indented - }; - - CoordinatorDistributionPlan distributionPlan = CoordinatorDistributionPlanDeserializer.DeserializeCoordinatorDistributionPlan(input.CoordinatorPlanJson); - string serializedDistributionPlan = JsonConvert.SerializeObject(distributionPlan, settings); - - return new CoordinatorDistributionPlanTestOutput(serializedDistributionPlan); - } - - public sealed class CoordinatorDistributionPlanTestOutput : BaselineTestOutput - { - public CoordinatorDistributionPlanTestOutput(string serializedCoordinatorPlanJson) - { - this.SerializedCoordinatorPlanJson = serializedCoordinatorPlanJson; - } - - public string SerializedCoordinatorPlanJson { get; } - - public override void SerializeAsXml(XmlWriter xmlWriter) - { - JObject jObject = JObject.Parse(this.SerializedCoordinatorPlanJson); - string jsonString = jObject.ToString(); - xmlWriter.WriteStartElement("SerializedCoordinatorPlanJson"); - xmlWriter.WriteString(jsonString); - xmlWriter.WriteEndElement(); - } - } - - public sealed class CoordinatorDistributionPlanTestInput : BaselineTestInput - { - internal string CoordinatorPlanJson { get; set; } - - internal CoordinatorDistributionPlanTestInput( - string description, - string coordinatorPlanJson) - : base(description) - { - this.CoordinatorPlanJson = coordinatorPlanJson; - } - - public override void SerializeAsXml(XmlWriter xmlWriter) - { - xmlWriter.WriteElementString("Description", this.Description); - xmlWriter.WriteElementString("CoordinatorDistributionPlanJson", this.CoordinatorPlanJson); - } - } - } -} From 394dbf01db90bd0b93a33fe96701ad03d13ae83a Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Thu, 21 Sep 2023 15:20:15 -0700 Subject: [PATCH 34/36] Removed all support for Cassandra, Mongo and Binary Literal --- .../ClientDistributionPlanDeserializer.cs | 36 +------------ .../QL/QLAggregateOperatorKind.cs | 3 -- .../QL/QLArrayCreateScalarExpression.cs | 8 +-- .../ClientDistributionPlan/QL/QLArrayKind.cs | 16 ------ .../QL/QLBinaryLiteral.cs | 20 ------- .../QL/QLBuiltinScalarFunctionKind.cs | 19 ------- .../QL/QLCGuidLiteral.cs | 17 ------ .../QL/QLCNumberLiteral.cs | 17 ------ .../QL/QLEnumerableExpressionKind.cs | 1 - .../QL/QLLetScalarExpression.cs | 1 - .../QL/QLLiteralKind.cs | 11 ---- .../QL/QLMDateTimeLiteral.cs | 17 ------ .../QL/QLMJavaScriptLiteral.cs | 19 ------- .../QL/QLMNumberLiteral.cs | 17 ------ .../QL/QLMRegexLiteral.cs | 22 -------- .../QL/QLMSingletonLiteral.cs | 24 --------- .../QL/QLMSymbolLiteral.cs | 19 ------- .../QL/QLObjectCreateScalarExpression.cs | 8 +-- .../ClientDistributionPlan/QL/QLObjectKind.cs | 12 ----- ...tClientDistributionPlanDeserialization.xml | 54 +++++++++---------- 20 files changed, 39 insertions(+), 302 deletions(-) delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayKind.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCGuidLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCNumberLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMDateTimeLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMJavaScriptLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMNumberLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMRegexLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSingletonLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSymbolLiteral.cs delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectKind.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs index 7d4ff68d67..097764b9de 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs @@ -24,7 +24,6 @@ private static class Constants public const string ClientDistributionPlan = "clientDistributionPlan"; public const string DeclaredVariable = "DeclaredVariable"; public const string DeclaredVariableExpression = "DeclaredVariableExpression"; - public const string Delegate = "Delegate"; public const string Distinct = "Distinct"; public const string EnumerationKind = "EnumerationKind"; public const string Expression = "Expression"; @@ -230,9 +229,8 @@ private static QLScalarExpression DeserializeScalarExpression(CosmosObject cosmo private static QLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(CosmosObject cosmosObject) { - QLArrayKind arrayKind = GetEnumValue(GetValue(cosmosObject, Constants.ArrayKind).Value); IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); - return new QLArrayCreateScalarExpression(arrayKind, items); + return new QLArrayCreateScalarExpression(items); } private static QLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(CosmosObject cosmosObject) @@ -281,9 +279,8 @@ private static QLMuxScalarExpression DeserializeMuxScalarExpression(CosmosObject private static QLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(CosmosObject cosmosObject) { - QLObjectKind objectKind = GetEnumValue(GetValue(cosmosObject, Constants.ObjectKind).Value); IReadOnlyList properties = DeserializeObjectProperties(GetValue(cosmosObject, Constants.Properties)); - return new QLObjectCreateScalarExpression(properties, objectKind); + return new QLObjectCreateScalarExpression(properties); } private static QLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(CosmosObject cosmosObject) @@ -397,28 +394,8 @@ private static QLLiteral DeserializeLiteral(CosmosObject cosmosObject) { case QLLiteralKind.Array: return new QLArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); - case QLLiteralKind.Binary: - return new QLBinaryLiteral(DeserializeBinaryLiteral(GetValue(cosmosObject, Constants.Value))); case QLLiteralKind.Boolean: return new QLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); - case QLLiteralKind.CGuid: - return new QLCGuidLiteral(GetValue(cosmosObject, Constants.Value).Value); - case QLLiteralKind.CNumber: - return new QLCNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case QLLiteralKind.MDateTime: - return new QLMDateTimeLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case QLLiteralKind.MJavaScript: - return new QLMJavaScriptLiteral(GetValue(cosmosObject, Constants.Name).Value); - case QLLiteralKind.MNumber: - return new QLMNumberLiteral(Number64.ToLong(GetValue(cosmosObject, Constants.Value).Value)); - case QLLiteralKind.MRegex: - string pattern = GetValue(cosmosObject, Constants.Pattern).Value; - string options = GetValue(cosmosObject, Constants.Options).Value; - return new QLMRegexLiteral(pattern, options); - case QLLiteralKind.MSingleton: - return new QLMSingletonLiteral(GetEnumValue(GetValue(cosmosObject, Constants.SingletonKind).Value)); - case QLLiteralKind.MSymbol: - return new QLMSymbolLiteral(GetValue(cosmosObject, Constants.Value).Value); case QLLiteralKind.Null: return QLNullLiteral.Singleton; case QLLiteralKind.Number: @@ -446,15 +423,6 @@ private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosm return literals; } - private static byte[] DeserializeBinaryLiteral(CosmosObject cosmosObject) - { - ReadOnlyMemory bytes = GetValue(cosmosObject, Constants.Kind).Value; - byte[] byteCollection = new byte[bytes.Length]; - bytes.CopyTo(byteCollection.AsMemory(0)); - - return byteCollection; - } - private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) { List objectLiterals = new List(cosmosArray.Count); diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs index edc9f6b6e5..fa1dd3f294 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs @@ -9,10 +9,7 @@ internal enum QLAggregateOperatorKind All, Any, Array, - CMax, - CMin, Count, - CSum, First, Last, Max, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs index a02945d37a..f117be480b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs @@ -9,14 +9,16 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL internal class QLArrayCreateScalarExpression : QLScalarExpression { - public QLArrayCreateScalarExpression(QLArrayKind arrayKind, IReadOnlyList items) + private const string Array = "Array"; + + public QLArrayCreateScalarExpression(IReadOnlyList items) : base(QLScalarExpressionKind.ArrayCreate) { - this.ArrayKind = arrayKind; + this.ArrayKind = Array; this.Items = items ?? throw new ArgumentNullException(nameof(items)); } - public QLArrayKind ArrayKind { get; } + public string ArrayKind { get; } public IReadOnlyList Items { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayKind.cs deleted file mode 100644 index acfc2f286b..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayKind.cs +++ /dev/null @@ -1,16 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - internal enum QLArrayKind - { - Array, - CList, - CMap, - CSet, - CTuple, - MArray - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryLiteral.cs deleted file mode 100644 index 5b649cafd6..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryLiteral.cs +++ /dev/null @@ -1,20 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - using System; - using System.Collections.Generic; - - internal class QLBinaryLiteral : QLLiteral - { - public QLBinaryLiteral(byte[] value) - : base(QLLiteralKind.Binary) - { - this.Value = value ?? throw new ArgumentNullException(nameof(value)); - } - - public byte[] Value { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs index e63e2fc235..faea256477 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs @@ -19,25 +19,6 @@ internal enum QLBuiltinScalarFunctionKind Atan, Atn2, Avg, - C_Binary, - C_Float32, - C_Float64, - C_Guid, - C_Int16, - C_Int32, - C_Int64, - C_Int8, - C_List, - C_ListContains, - C_Map, - C_MapContains, - C_MapContainsKey, - C_MapContainsValue, - C_Set, - C_SetContains, - C_Tuple, - C_Udt, - C_UInt32, Ceiling, Choose, Concat, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCGuidLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCGuidLiteral.cs deleted file mode 100644 index 03ec3316a2..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCGuidLiteral.cs +++ /dev/null @@ -1,17 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - internal class QLCGuidLiteral : QLLiteral - { - public QLCGuidLiteral(System.Guid value) - : base(QLLiteralKind.CGuid) - { - this.Value = value; - } - - public System.Guid Value { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCNumberLiteral.cs deleted file mode 100644 index 91a96f75c3..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLCNumberLiteral.cs +++ /dev/null @@ -1,17 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - internal class QLCNumberLiteral : QLLiteral - { - public QLCNumberLiteral(long value) - : base(QLLiteralKind.CNumber) - { - this.Value = value; - } - - public long Value { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs index 12ce7e8105..1d3537806b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs @@ -9,7 +9,6 @@ internal enum QLEnumerableExpressionKind Aggregate, Distinct, GroupBy, - Flatten, Input, OrderBy, ScalarAsEnumerable, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs index 3f97b1302b..6a12b7ec96 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs @@ -5,7 +5,6 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL { using System; - using System.Collections.Generic; internal class QLLetScalarExpression : QLScalarExpression { diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs index 85e9256d6d..f3b8416e7c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs @@ -8,18 +8,7 @@ internal enum QLLiteralKind { Undefined, Array, - Binary, Boolean, - CGuid, - CNumber, - MDateTime, - MJavaScript, - MNumber, - MObjectId, - MRegex, - MSingleton, - MSymbol, - MTimestamp, Null, Number, Object, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMDateTimeLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMDateTimeLiteral.cs deleted file mode 100644 index b3136da025..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMDateTimeLiteral.cs +++ /dev/null @@ -1,17 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - internal class QLMDateTimeLiteral : QLLiteral - { - public QLMDateTimeLiteral(long value) - : base(QLLiteralKind.MDateTime) - { - this.Value = value; - } - - public long Value { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMJavaScriptLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMJavaScriptLiteral.cs deleted file mode 100644 index c1061dc8ab..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMJavaScriptLiteral.cs +++ /dev/null @@ -1,19 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - using System; - - internal class QLMJavaScriptLiteral : QLLiteral - { - public QLMJavaScriptLiteral(string name) - : base(QLLiteralKind.MJavaScript) - { - this.Name = name ?? throw new ArgumentNullException(nameof(name)); - } - - public string Name { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMNumberLiteral.cs deleted file mode 100644 index 3ef0969f73..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMNumberLiteral.cs +++ /dev/null @@ -1,17 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - internal class QLMNumberLiteral : QLLiteral - { - public QLMNumberLiteral(long value) - : base(QLLiteralKind.MNumber) - { - this.Value = value; - } - - public long Value { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMRegexLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMRegexLiteral.cs deleted file mode 100644 index ce4219f930..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMRegexLiteral.cs +++ /dev/null @@ -1,22 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - using System; - - internal class QLMRegexLiteral : QLLiteral - { - public QLMRegexLiteral(string pattern, string options) - : base(QLLiteralKind.MRegex) - { - this.Pattern = pattern ?? throw new ArgumentNullException(nameof(pattern)); - this.Options = options ?? throw new ArgumentNullException(nameof(options)); - } - - public string Pattern { get; } - - public string Options { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSingletonLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSingletonLiteral.cs deleted file mode 100644 index d3e543983c..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSingletonLiteral.cs +++ /dev/null @@ -1,24 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - internal class QLMSingletonLiteral : QLLiteral - { - public QLMSingletonLiteral(Kind singletonKind) - : base(QLLiteralKind.MSingleton) - { - this.SingletonKind = singletonKind; - } - - public new enum Kind - { - MaxKey, - MinKey, - Undefined - } - - public Kind SingletonKind { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSymbolLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSymbolLiteral.cs deleted file mode 100644 index 34610c80b2..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMSymbolLiteral.cs +++ /dev/null @@ -1,19 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - using System; - - internal class QLMSymbolLiteral : QLLiteral - { - public QLMSymbolLiteral(string value) - : base(QLLiteralKind.MSymbol) - { - this.Value = value ?? throw new ArgumentNullException(nameof(value)); - } - - public string Value { get; } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs index f24f16c9ec..5b81113bc2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs @@ -9,15 +9,17 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL internal class QLObjectCreateScalarExpression : QLScalarExpression { - public QLObjectCreateScalarExpression(IReadOnlyList properties, QLObjectKind objectKind) + private const string Object = "Object"; + + public QLObjectCreateScalarExpression(IReadOnlyList properties) : base(QLScalarExpressionKind.ObjectCreate) { this.Properties = properties ?? throw new ArgumentNullException(nameof(properties)); - this.ObjectKind = objectKind; + this.ObjectKind = Object; } public IReadOnlyList Properties { get; } - public QLObjectKind ObjectKind { get; } + public string ObjectKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectKind.cs deleted file mode 100644 index 61b2ccefb1..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectKind.cs +++ /dev/null @@ -1,12 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - internal enum QLObjectKind - { - CUdt, - Object - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml index afa298ae19..836410c22e 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml @@ -8,7 +8,7 @@ { "ClientQL": { "Name": "root", - "Kind": 4 + "Kind": 3 } } @@ -24,10 +24,10 @@ "SourceExpression": { "SourceExpression": { "Name": "root", - "Kind": 4 + "Kind": 3 }, "Aggregate": { - "OperatorKind": 11, + "OperatorKind": 8, "Kind": 0 }, "Kind": 0 @@ -49,10 +49,10 @@ } } ], - "ObjectKind": 1, + "ObjectKind": "Object", "Kind": 7 }, - "Kind": 7 + "Kind": 6 } } @@ -69,7 +69,7 @@ "SourceExpression": { "SourceExpression": { "Name": "root", - "Kind": 4 + "Kind": 3 }, "DeclaredVariable": { "Name": "v0", @@ -111,7 +111,7 @@ "RightExpression": { "Literal": { "Value": 0, - "Kind": 15 + "Kind": 4 }, "Kind": 5 }, @@ -120,7 +120,7 @@ "RightExpression": { "OperatorKind": 2, "Expression": { - "FunctionKind": 74, + "FunctionKind": 55, "Arguments": [ { "Expression": { @@ -197,7 +197,7 @@ "RightExpression": { "Literal": { "Value": 0, - "Kind": 15 + "Kind": 4 }, "Kind": 5 }, @@ -206,7 +206,7 @@ "RightExpression": { "OperatorKind": 2, "Expression": { - "FunctionKind": 74, + "FunctionKind": 55, "Arguments": [ { "Expression": { @@ -299,7 +299,7 @@ "RightExpression": { "Literal": { "Value": 0, - "Kind": 15 + "Kind": 4 }, "Kind": 5 }, @@ -308,7 +308,7 @@ "RightExpression": { "OperatorKind": 2, "Expression": { - "FunctionKind": 74, + "FunctionKind": 55, "Arguments": [ { "Expression": { @@ -359,29 +359,29 @@ ], "Kind": 10 }, - "Kind": 7 + "Kind": 6 }, "KeyCount": 1, "Aggregates": [ { - "OperatorKind": 11, + "OperatorKind": 8, "Kind": 0 }, { "Items": [ { - "OperatorKind": 11, + "OperatorKind": 8, "Kind": 0 }, { - "OperatorKind": 11, + "OperatorKind": 8, "Kind": 0 } ], "Kind": 1 }, { - "OperatorKind": 9, + "OperatorKind": 6, "Kind": 0 } ], @@ -448,7 +448,7 @@ "RightExpression": { "Literal": { "Value": 0, - "Kind": 15 + "Kind": 4 }, "Kind": 5 }, @@ -498,7 +498,7 @@ } } ], - "ObjectKind": 1, + "ObjectKind": "Object", "Kind": 7 } }, @@ -535,15 +535,15 @@ } } ], - "ObjectKind": 1, + "ObjectKind": "Object", "Kind": 7 } } ], - "ObjectKind": 1, + "ObjectKind": "Object", "Kind": 7 }, - "Kind": 7 + "Kind": 6 } } @@ -559,10 +559,10 @@ "SourceExpression": { "SourceExpression": { "Name": "root", - "Kind": 4 + "Kind": 3 }, "Aggregate": { - "OperatorKind": 11, + "OperatorKind": 8, "Kind": 0 }, "Kind": 0 @@ -587,7 +587,7 @@ "RightExpression": { "Literal": { "Value": 5, - "Kind": 15 + "Kind": 4 }, "Kind": 5 }, @@ -595,10 +595,10 @@ } } ], - "ObjectKind": 1, + "ObjectKind": "Object", "Kind": 7 }, - "Kind": 7 + "Kind": 6 } } From f082ef62549d39ae04cc2ee9b916bbdb8f9f1fe5 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 25 Sep 2023 13:30:50 -0700 Subject: [PATCH 35/36] Updaed ClientQL to Cql --- .../ClientDistributionPlanDeserializer.cs | 343 +++++++++--------- .../{QL => Cql}/ClientDistributionPlan.cs | 8 +- .../QLAggregate.cs => Cql/CqlAggregate.cs} | 8 +- .../CqlAggregateEnumerableExpression.cs} | 12 +- .../CqlAggregateKind.cs} | 4 +- .../CqlAggregateOperatorKind.cs} | 4 +- .../CqlArrayCreateScalarExpression.cs} | 10 +- .../CqlArrayIndexerScalarExpression.cs} | 10 +- .../CqlArrayLiteral.cs} | 10 +- .../CqlBinaryScalarExpression.cs} | 14 +- .../CqlBinaryScalarOperatorKind.cs} | 4 +- .../CqlBooleanLiteral.cs} | 8 +- .../CqlBuiltinAggregate.cs} | 10 +- .../CqlBuiltinScalarFunctionKind.cs} | 4 +- .../CqlDistinctEnumerableExpression.cs} | 14 +- .../CqlEnumerableExpression.cs} | 8 +- .../CqlEnumerableExpressionKind.cs} | 4 +- .../CqlEnumerationKind.cs} | 4 +- .../CqlFunctionIdentifier.cs} | 6 +- .../CqlGroupByEnumerableExpression.cs} | 12 +- .../CqlInputEnumerableExpression.cs} | 8 +- .../CqlIsOperatorKind.cs} | 4 +- .../CqlIsOperatorScalarExpression.cs} | 12 +- .../CqlLetScalarExpression.cs} | 14 +- .../{QL/QLLiteral.cs => Cql/CqlLiteral.cs} | 8 +- .../CqlLiteralKind.cs} | 4 +- .../CqlLiteralScalarExpression.cs} | 10 +- .../CqlMuxScalarExpression.cs} | 14 +- .../CqlNullLiteral.cs} | 10 +- .../CqlNumberLiteral.cs} | 8 +- .../CqlObjectCreateScalarExpression.cs} | 10 +- .../CqlObjectLiteral.cs} | 10 +- .../CqlObjectLiteralProperty.cs} | 8 +- .../CqlObjectProperty.cs} | 8 +- .../CqlOrderByEnumerableExpression.cs} | 14 +- .../CqlOrderByItem.cs} | 10 +- .../CqlPropertyRefScalarExpression.cs} | 10 +- .../CqlScalarAsEnumerableExpression.cs} | 12 +- .../CqlScalarExpression.cs} | 8 +- .../CqlScalarExpressionKind.cs} | 4 +- .../CqlSelectEnumerableExpression.cs} | 14 +- .../CqlSelectManyEnumerableExpression.cs} | 14 +- .../QLSortOrder.cs => Cql/CqlSortOrder.cs} | 4 +- .../CqlStringLiteral.cs} | 8 +- .../CqlSystemFunctionCallScalarExpression.cs} | 12 +- .../CqlTakeEnumerableExpression.cs} | 10 +- .../CqlTupleAggregate.cs} | 10 +- .../CqlTupleCreateScalarExpression.cs} | 10 +- .../CqlTupleItemRefScalarExpression.cs} | 10 +- .../CqlUnaryScalarExpression.cs} | 12 +- .../CqlUnaryScalarOperatorKind.cs} | 4 +- .../Cql/CqlUndefinedLiteral.cs | 16 + ...serDefinedFunctionCallScalarExpression.cs} | 12 +- .../{QL/QLVariable.cs => Cql/CqlVariable.cs} | 6 +- .../CqlVariableRefScalarExpression.cs} | 10 +- .../CqlWhereEnumerableExpression.cs} | 14 +- .../QL/QLUndefinedLiteral.cs | 16 - ...tClientDistributionPlanDeserialization.xml | 16 +- .../ClientDistributionPlanBaselineTests.cs | 10 +- 59 files changed, 445 insertions(+), 446 deletions(-) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL => Cql}/ClientDistributionPlan.cs (61%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLAggregate.cs => Cql/CqlAggregate.cs} (68%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLAggregateEnumerableExpression.cs => Cql/CqlAggregateEnumerableExpression.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLAggregateKind.cs => Cql/CqlAggregateKind.cs} (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLAggregateOperatorKind.cs => Cql/CqlAggregateOperatorKind.cs} (88%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLArrayCreateScalarExpression.cs => Cql/CqlArrayCreateScalarExpression.cs} (66%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLTupleItemRefScalarExpression.cs => Cql/CqlArrayIndexerScalarExpression.cs} (62%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLArrayLiteral.cs => Cql/CqlArrayLiteral.cs} (66%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLBinaryScalarExpression.cs => Cql/CqlBinaryScalarExpression.cs} (55%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLBinaryScalarOperatorKind.cs => Cql/CqlBinaryScalarOperatorKind.cs} (92%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLBooleanLiteral.cs => Cql/CqlBooleanLiteral.cs} (71%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLBuiltinAggregate.cs => Cql/CqlBuiltinAggregate.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLBuiltinScalarFunctionKind.cs => Cql/CqlBuiltinScalarFunctionKind.cs} (97%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLDistinctEnumerableExpression.cs => Cql/CqlDistinctEnumerableExpression.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLEnumerableExpression.cs => Cql/CqlEnumerableExpression.cs} (62%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLEnumerableExpressionKind.cs => Cql/CqlEnumerableExpressionKind.cs} (89%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLEnumerationKind.cs => Cql/CqlEnumerationKind.cs} (88%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLFunctionIdentifier.cs => Cql/CqlFunctionIdentifier.cs} (81%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLGroupByEnumerableExpression.cs => Cql/CqlGroupByEnumerableExpression.cs} (61%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLInputEnumerableExpression.cs => Cql/CqlInputEnumerableExpression.cs} (68%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLIsOperatorKind.cs => Cql/CqlIsOperatorKind.cs} (87%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLIsOperatorScalarExpression.cs => Cql/CqlIsOperatorScalarExpression.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLLetScalarExpression.cs => Cql/CqlLetScalarExpression.cs} (60%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLLiteral.cs => Cql/CqlLiteral.cs} (69%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLLiteralKind.cs => Cql/CqlLiteralKind.cs} (90%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLLiteralScalarExpression.cs => Cql/CqlLiteralScalarExpression.cs} (63%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLMuxScalarExpression.cs => Cql/CqlMuxScalarExpression.cs} (59%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLNullLiteral.cs => Cql/CqlNullLiteral.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLNumberLiteral.cs => Cql/CqlNumberLiteral.cs} (73%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLObjectCreateScalarExpression.cs => Cql/CqlObjectCreateScalarExpression.cs} (66%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLObjectLiteral.cs => Cql/CqlObjectLiteral.cs} (63%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLObjectLiteralProperty.cs => Cql/CqlObjectLiteralProperty.cs} (75%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLObjectProperty.cs => Cql/CqlObjectProperty.cs} (75%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLOrderByEnumerableExpression.cs => Cql/CqlOrderByEnumerableExpression.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLOrderByItem.cs => Cql/CqlOrderByItem.cs} (66%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLPropertyRefScalarExpression.cs => Cql/CqlPropertyRefScalarExpression.cs} (67%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLScalarAsEnumerableExpression.cs => Cql/CqlScalarAsEnumerableExpression.cs} (54%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLScalarExpression.cs => Cql/CqlScalarExpression.cs} (64%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLScalarExpressionKind.cs => Cql/CqlScalarExpressionKind.cs} (92%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLSelectEnumerableExpression.cs => Cql/CqlSelectEnumerableExpression.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLSelectManyEnumerableExpression.cs => Cql/CqlSelectManyEnumerableExpression.cs} (57%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLSortOrder.cs => Cql/CqlSortOrder.cs} (89%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLStringLiteral.cs => Cql/CqlStringLiteral.cs} (74%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLSystemFunctionCallScalarExpression.cs => Cql/CqlSystemFunctionCallScalarExpression.cs} (53%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLTakeEnumerableExpression.cs => Cql/CqlTakeEnumerableExpression.cs} (65%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLTupleAggregate.cs => Cql/CqlTupleAggregate.cs} (65%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLTupleCreateScalarExpression.cs => Cql/CqlTupleCreateScalarExpression.cs} (59%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLArrayIndexerScalarExpression.cs => Cql/CqlTupleItemRefScalarExpression.cs} (62%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLUnaryScalarExpression.cs => Cql/CqlUnaryScalarExpression.cs} (55%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLUnaryScalarOperatorKind.cs => Cql/CqlUnaryScalarOperatorKind.cs} (86%) create mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUndefinedLiteral.cs rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLUserDefinedFunctionCallScalarExpression.cs => Cql/CqlUserDefinedFunctionCallScalarExpression.cs} (58%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLVariable.cs => Cql/CqlVariable.cs} (84%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLVariableRefScalarExpression.cs => Cql/CqlVariableRefScalarExpression.cs} (61%) rename Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/{QL/QLWhereEnumerableExpression.cs => Cql/CqlWhereEnumerableExpression.cs} (58%) delete mode 100644 Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUndefinedLiteral.cs diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs index 097764b9de..df19b88b3d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/ClientDistributionPlanDeserializer.cs @@ -7,8 +7,8 @@ namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan using System; using System.Collections.Generic; using System.Reflection; + using Cql; using Microsoft.Azure.Cosmos.CosmosElements; - using QL; internal static class ClientDistributionPlanDeserializer { @@ -19,7 +19,7 @@ private static class Constants public const string Aggregate = "Aggregate"; public const string Aggregates = "Aggregates"; public const string Builtin = "Builtin"; - public const string ClientQL = "clientQL"; + public const string Cql = "Cql"; public const string ConditionExpression = "ConditionExpression"; public const string ClientDistributionPlan = "clientDistributionPlan"; public const string DeclaredVariable = "DeclaredVariable"; @@ -46,7 +46,6 @@ private static class Constants public const string Pattern = "Pattern"; public const string Properties = "Properties"; public const string PropertyName = "PropertyName"; - public const string QL = "QL"; public const string RightExpression = "RightExpression"; public const string ScalarAsEnumerable = "ScalarAsEnumerable"; public const string Select = "Select"; @@ -70,15 +69,15 @@ public static ClientDistributionPlan DeserializeClientDistributionPlan(string js { CosmosObject cosmosObject = CosmosObject.Parse(jsonString); CosmosObject clientDistributionPlanElement = GetValue(cosmosObject, Constants.ClientDistributionPlan); - CosmosObject clientQLElement = GetValue(clientDistributionPlanElement, Constants.ClientQL); - QLEnumerableExpression expression = DeserializeQLEnumerableExpression(clientQLElement); + CosmosObject cqlElement = GetValue(clientDistributionPlanElement, Constants.Cql); + CqlEnumerableExpression expression = DeserializeCqlEnumerableExpression(cqlElement); return new ClientDistributionPlan(expression); } #region Enumerable Expressions - private static QLEnumerableExpression DeserializeQLEnumerableExpression(CosmosObject cosmosObject) + private static CqlEnumerableExpression DeserializeCqlEnumerableExpression(CosmosObject cosmosObject) { CosmosString kindProperty = GetValue(cosmosObject, Constants.Kind); switch (kindProperty.Value) @@ -104,241 +103,241 @@ private static QLEnumerableExpression DeserializeQLEnumerableExpression(CosmosOb case Constants.Where: return DeserializeWhereEnumerableExpression(cosmosObject); default: - throw new NotSupportedException($"Invalid QLExpression kind: {kindProperty.Value}"); + throw new NotSupportedException($"Invalid CqlExpression kind: {kindProperty.Value}"); } } - private static QLAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(CosmosObject cosmosObject) + private static CqlAggregateEnumerableExpression DeserializeAggregateEnumerableExpression(CosmosObject cosmosObject) { - QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - QLAggregate aggregate = DeserializeAggregate(GetValue(cosmosObject, Constants.Aggregate)); - return new QLAggregateEnumerableExpression(sourceExpression, aggregate); + CqlEnumerableExpression sourceExpression = DeserializeCqlEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + CqlAggregate aggregate = DeserializeAggregate(GetValue(cosmosObject, Constants.Aggregate)); + return new CqlAggregateEnumerableExpression(sourceExpression, aggregate); } - private static QLDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(CosmosObject cosmosObject) + private static CqlDistinctEnumerableExpression DeserializeDistinctEnumerableExpression(CosmosObject cosmosObject) { - QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - IReadOnlyList expressions = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Expression)); - return new QLDistinctEnumerableExpression(sourceExpression, declaredVariable, expressions); + CqlEnumerableExpression sourceExpression = DeserializeCqlEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + CqlVariable declaredVariable = DeserializeCqlVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + IReadOnlyList expressions = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Expression)); + return new CqlDistinctEnumerableExpression(sourceExpression, declaredVariable, expressions); } - private static QLGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(CosmosObject cosmosObject) + private static CqlGroupByEnumerableExpression DeserializeGroupByEnumerableExpression(CosmosObject cosmosObject) { - QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + CqlEnumerableExpression sourceExpression = DeserializeCqlEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); long keyCount = Number64.ToLong(GetValue(cosmosObject, Constants.KeyCount).Value); - IReadOnlyList aggregates = DeserializeAggregateArray(GetValue(cosmosObject, Constants.Aggregates)); - return new QLGroupByEnumerableExpression(sourceExpression, Convert.ToUInt64(keyCount), aggregates); + IReadOnlyList aggregates = DeserializeAggregateArray(GetValue(cosmosObject, Constants.Aggregates)); + return new CqlGroupByEnumerableExpression(sourceExpression, Convert.ToUInt64(keyCount), aggregates); } - private static QLInputEnumerableExpression DeserializeInputEnumerableExpression(CosmosObject cosmosObject) + private static CqlInputEnumerableExpression DeserializeInputEnumerableExpression(CosmosObject cosmosObject) { - return new QLInputEnumerableExpression(GetValue(cosmosObject, Constants.Name).Value); + return new CqlInputEnumerableExpression(GetValue(cosmosObject, Constants.Name).Value); } - private static QLOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(CosmosObject cosmosObject) + private static CqlOrderByEnumerableExpression DeserializeOrderByEnumerableExpression(CosmosObject cosmosObject) { - QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - IReadOnlyList orderByItems = DeserializeOrderByItemArray(GetValue(cosmosObject, Constants.Items)); - return new QLOrderByEnumerableExpression(sourceExpression, declaredVariable, orderByItems); + CqlEnumerableExpression sourceExpression = DeserializeCqlEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + CqlVariable declaredVariable = DeserializeCqlVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + IReadOnlyList orderByItems = DeserializeOrderByItemArray(GetValue(cosmosObject, Constants.Items)); + return new CqlOrderByEnumerableExpression(sourceExpression, declaredVariable, orderByItems); } - private static QLScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(CosmosObject cosmosObject) + private static CqlScalarAsEnumerableExpression DeserializeScalarAsEnumerableExpression(CosmosObject cosmosObject) { - QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - QLEnumerationKind enumerationKind = GetEnumValue(GetValue(cosmosObject, Constants.EnumerationKind).Value); - return new QLScalarAsEnumerableExpression(expression, enumerationKind); + CqlScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + CqlEnumerationKind enumerationKind = GetEnumValue(GetValue(cosmosObject, Constants.EnumerationKind).Value); + return new CqlScalarAsEnumerableExpression(expression, enumerationKind); } - private static QLSelectEnumerableExpression DeserializeSelectEnumerableExpression(CosmosObject cosmosObject) + private static CqlSelectEnumerableExpression DeserializeSelectEnumerableExpression(CosmosObject cosmosObject) { - QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new QLSelectEnumerableExpression(sourceExpression, declaredVariable, expression); + CqlEnumerableExpression sourceExpression = DeserializeCqlEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + CqlVariable declaredVariable = DeserializeCqlVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + CqlScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new CqlSelectEnumerableExpression(sourceExpression, declaredVariable, expression); } - private static QLSelectManyEnumerableExpression DeserializeSelectManyEnumerableExpression(CosmosObject cosmosObject) + private static CqlSelectManyEnumerableExpression DeserializeSelectManyEnumerableExpression(CosmosObject cosmosObject) { - QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - QLEnumerableExpression selectorExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SelectorExpression)); - return new QLSelectManyEnumerableExpression(sourceExpression, declaredVariable, selectorExpression); + CqlEnumerableExpression sourceExpression = DeserializeCqlEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + CqlVariable declaredVariable = DeserializeCqlVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + CqlEnumerableExpression selectorExpression = DeserializeCqlEnumerableExpression(GetValue(cosmosObject, Constants.SelectorExpression)); + return new CqlSelectManyEnumerableExpression(sourceExpression, declaredVariable, selectorExpression); } - private static QLTakeEnumerableExpression DeserializeTakeEnumerableExpression(CosmosObject cosmosObject) + private static CqlTakeEnumerableExpression DeserializeTakeEnumerableExpression(CosmosObject cosmosObject) { - QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + CqlEnumerableExpression sourceExpression = DeserializeCqlEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); long skipValue = Number64.ToLong(GetValue(cosmosObject, Constants.SkipValue).Value); long takeExpression = Number64.ToLong(GetValue(cosmosObject, Constants.TakeValue).Value); - return new QLTakeEnumerableExpression(sourceExpression, Convert.ToUInt64(skipValue), Convert.ToUInt64(takeExpression)); + return new CqlTakeEnumerableExpression(sourceExpression, Convert.ToUInt64(skipValue), Convert.ToUInt64(takeExpression)); } - private static QLWhereEnumerableExpression DeserializeWhereEnumerableExpression(CosmosObject cosmosObject) + private static CqlWhereEnumerableExpression DeserializeWhereEnumerableExpression(CosmosObject cosmosObject) { - QLEnumerableExpression sourceExpression = DeserializeQLEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); - QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new QLWhereEnumerableExpression(sourceExpression, declaredVariable, expression); + CqlEnumerableExpression sourceExpression = DeserializeCqlEnumerableExpression(GetValue(cosmosObject, Constants.SourceExpression)); + CqlVariable declaredVariable = DeserializeCqlVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + CqlScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new CqlWhereEnumerableExpression(sourceExpression, declaredVariable, expression); } #endregion #region Scalar Expressions - private static QLScalarExpression DeserializeScalarExpression(CosmosObject cosmosObject) + private static CqlScalarExpression DeserializeScalarExpression(CosmosObject cosmosObject) { - QLScalarExpressionKind scalarExpressionKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); + CqlScalarExpressionKind scalarExpressionKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); switch (scalarExpressionKind) { - case QLScalarExpressionKind.ArrayCreate: + case CqlScalarExpressionKind.ArrayCreate: return DeserializeArrayCreateScalarExpression(cosmosObject); - case QLScalarExpressionKind.ArrayIndexer: + case CqlScalarExpressionKind.ArrayIndexer: return DeserializeArrayIndexerScalarExpression(cosmosObject); - case QLScalarExpressionKind.BinaryOperator: + case CqlScalarExpressionKind.BinaryOperator: return DeserializeBinaryOperatorScalarExpression(cosmosObject); - case QLScalarExpressionKind.IsOperator: + case CqlScalarExpressionKind.IsOperator: return DeserializeIsOperatorScalarExpression(cosmosObject); - case QLScalarExpressionKind.Let: + case CqlScalarExpressionKind.Let: return DeserializeLetScalarExpression(cosmosObject); - case QLScalarExpressionKind.Literal: + case CqlScalarExpressionKind.Literal: return DeserializeLiteralScalarExpression(cosmosObject); - case QLScalarExpressionKind.Mux: + case CqlScalarExpressionKind.Mux: return DeserializeMuxScalarExpression(cosmosObject); - case QLScalarExpressionKind.ObjectCreate: + case CqlScalarExpressionKind.ObjectCreate: return DeserializeObjectCreateScalarExpression(cosmosObject); - case QLScalarExpressionKind.PropertyRef: + case CqlScalarExpressionKind.PropertyRef: return DeserializePropertyRefScalarExpression(cosmosObject); - case QLScalarExpressionKind.SystemFunctionCall: + case CqlScalarExpressionKind.SystemFunctionCall: return DeserializeSystemFunctionCallScalarExpression(cosmosObject); - case QLScalarExpressionKind.TupleCreate: + case CqlScalarExpressionKind.TupleCreate: return DeserializeTupleCreateScalarExpression(cosmosObject); - case QLScalarExpressionKind.TupleItemRef: + case CqlScalarExpressionKind.TupleItemRef: return DeserializeTupleItemRefScalarExpression(cosmosObject); - case QLScalarExpressionKind.UnaryOperator: + case CqlScalarExpressionKind.UnaryOperator: return DeserializeUnaryScalarExpression(cosmosObject); - case QLScalarExpressionKind.UserDefinedFunctionCall: + case CqlScalarExpressionKind.UserDefinedFunctionCall: return DeserializeUserDefinedFunctionCallScalarExpression(cosmosObject); - case QLScalarExpressionKind.VariableRef: + case CqlScalarExpressionKind.VariableRef: return DeserializeVariableRefScalarExpression(cosmosObject); default: - throw new NotSupportedException($"Invalid QLExpression kind: {scalarExpressionKind}"); + throw new NotSupportedException($"Invalid CqlExpression kind: {scalarExpressionKind}"); } } - private static QLArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(CosmosObject cosmosObject) + private static CqlArrayCreateScalarExpression DeserializeArrayCreateScalarExpression(CosmosObject cosmosObject) { - IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); - return new QLArrayCreateScalarExpression(items); + IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); + return new CqlArrayCreateScalarExpression(items); } - private static QLArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(CosmosObject cosmosObject) + private static CqlArrayIndexerScalarExpression DeserializeArrayIndexerScalarExpression(CosmosObject cosmosObject) { - QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + CqlScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); long index = Number64.ToLong(GetValue(cosmosObject, Constants.Index).Value); - return new QLArrayIndexerScalarExpression(expression, Convert.ToUInt64(index)); + return new CqlArrayIndexerScalarExpression(expression, Convert.ToUInt64(index)); } - private static QLBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(CosmosObject cosmosObject) + private static CqlBinaryScalarExpression DeserializeBinaryOperatorScalarExpression(CosmosObject cosmosObject) { - QLBinaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - QLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); - QLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); - return new QLBinaryScalarExpression(operatorKind, leftExpression, rightExpression); + CqlBinaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + CqlScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); + CqlScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); + return new CqlBinaryScalarExpression(operatorKind, leftExpression, rightExpression); } - private static QLIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(CosmosObject cosmosObject) + private static CqlIsOperatorScalarExpression DeserializeIsOperatorScalarExpression(CosmosObject cosmosObject) { - QLIsOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new QLIsOperatorScalarExpression(operatorKind, expression); + CqlIsOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + CqlScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new CqlIsOperatorScalarExpression(operatorKind, expression); } - private static QLLetScalarExpression DeserializeLetScalarExpression(CosmosObject cosmosObject) + private static CqlLetScalarExpression DeserializeLetScalarExpression(CosmosObject cosmosObject) { - QLVariable declaredVariable = DeserializeQLVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); - QLScalarExpression declaredVariableExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.DeclaredVariableExpression)); - QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new QLLetScalarExpression(declaredVariable, declaredVariableExpression, expression); + CqlVariable declaredVariable = DeserializeCqlVariable(GetValue(cosmosObject, Constants.DeclaredVariable)); + CqlScalarExpression declaredVariableExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.DeclaredVariableExpression)); + CqlScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new CqlLetScalarExpression(declaredVariable, declaredVariableExpression, expression); } - private static QLLiteralScalarExpression DeserializeLiteralScalarExpression(CosmosObject cosmosObject) + private static CqlLiteralScalarExpression DeserializeLiteralScalarExpression(CosmosObject cosmosObject) { CosmosObject literalObject = GetValue(cosmosObject, Constants.Literal); - return new QLLiteralScalarExpression(DeserializeLiteral(literalObject)); + return new CqlLiteralScalarExpression(DeserializeLiteral(literalObject)); } - private static QLMuxScalarExpression DeserializeMuxScalarExpression(CosmosObject cosmosObject) + private static CqlMuxScalarExpression DeserializeMuxScalarExpression(CosmosObject cosmosObject) { - QLScalarExpression conditionExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.ConditionExpression)); - QLScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); - QLScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); - return new QLMuxScalarExpression(conditionExpression, leftExpression, rightExpression); + CqlScalarExpression conditionExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.ConditionExpression)); + CqlScalarExpression leftExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.LeftExpression)); + CqlScalarExpression rightExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.RightExpression)); + return new CqlMuxScalarExpression(conditionExpression, leftExpression, rightExpression); } - private static QLObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(CosmosObject cosmosObject) + private static CqlObjectCreateScalarExpression DeserializeObjectCreateScalarExpression(CosmosObject cosmosObject) { - IReadOnlyList properties = DeserializeObjectProperties(GetValue(cosmosObject, Constants.Properties)); - return new QLObjectCreateScalarExpression(properties); + IReadOnlyList properties = DeserializeObjectProperties(GetValue(cosmosObject, Constants.Properties)); + return new CqlObjectCreateScalarExpression(properties); } - private static QLPropertyRefScalarExpression DeserializePropertyRefScalarExpression(CosmosObject cosmosObject) + private static CqlPropertyRefScalarExpression DeserializePropertyRefScalarExpression(CosmosObject cosmosObject) { - QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + CqlScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); string propertyName = GetValue(cosmosObject, Constants.PropertyName).Value; - return new QLPropertyRefScalarExpression(expression, propertyName); + return new CqlPropertyRefScalarExpression(expression, propertyName); } - private static QLSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(CosmosObject cosmosObject) + private static CqlSystemFunctionCallScalarExpression DeserializeSystemFunctionCallScalarExpression(CosmosObject cosmosObject) { - QLBuiltinScalarFunctionKind functionKind = GetEnumValue(GetValue(cosmosObject, Constants.FunctionKind).Value); - IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); - return new QLSystemFunctionCallScalarExpression(functionKind, arguments); + CqlBuiltinScalarFunctionKind functionKind = GetEnumValue(GetValue(cosmosObject, Constants.FunctionKind).Value); + IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); + return new CqlSystemFunctionCallScalarExpression(functionKind, arguments); } - private static QLTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(CosmosObject cosmosObject) + private static CqlTupleCreateScalarExpression DeserializeTupleCreateScalarExpression(CosmosObject cosmosObject) { - IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); - return new QLTupleCreateScalarExpression(items); + IReadOnlyList items = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Items)); + return new CqlTupleCreateScalarExpression(items); } - private static QLTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(CosmosObject cosmosObject) + private static CqlTupleItemRefScalarExpression DeserializeTupleItemRefScalarExpression(CosmosObject cosmosObject) { - QLScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + CqlScalarExpression expression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); long index = Number64.ToLong(GetValue(cosmosObject, Constants.Index).Value); - return new QLTupleItemRefScalarExpression(expression, Convert.ToUInt64(index)); + return new CqlTupleItemRefScalarExpression(expression, Convert.ToUInt64(index)); } - private static QLUnaryScalarExpression DeserializeUnaryScalarExpression(CosmosObject cosmosObject) + private static CqlUnaryScalarExpression DeserializeUnaryScalarExpression(CosmosObject cosmosObject) { - QLUnaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - QLScalarExpression scalarExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); - return new QLUnaryScalarExpression(operatorKind, scalarExpression); + CqlUnaryScalarOperatorKind operatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + CqlScalarExpression scalarExpression = DeserializeScalarExpression(GetValue(cosmosObject, Constants.Expression)); + return new CqlUnaryScalarExpression(operatorKind, scalarExpression); } - private static QLUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(CosmosObject cosmosObject) + private static CqlUserDefinedFunctionCallScalarExpression DeserializeUserDefinedFunctionCallScalarExpression(CosmosObject cosmosObject) { string identifierString = GetValue(cosmosObject, Constants.Identifier).Value; - QLFunctionIdentifier functionIdentifier = new QLFunctionIdentifier(identifierString); - IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); + CqlFunctionIdentifier functionIdentifier = new CqlFunctionIdentifier(identifierString); + IReadOnlyList arguments = DeserializeScalarExpressionArray(GetValue(cosmosObject, Constants.Arguments)); bool builtin = GetValue(cosmosObject, Constants.Builtin).Value; - return new QLUserDefinedFunctionCallScalarExpression(functionIdentifier, arguments, builtin); + return new CqlUserDefinedFunctionCallScalarExpression(functionIdentifier, arguments, builtin); } - private static QLVariableRefScalarExpression DeserializeVariableRefScalarExpression(CosmosObject cosmosObject) + private static CqlVariableRefScalarExpression DeserializeVariableRefScalarExpression(CosmosObject cosmosObject) { - QLVariable variable = DeserializeQLVariable(GetValue(cosmosObject, Constants.Variable)); - return new QLVariableRefScalarExpression(variable); + CqlVariable variable = DeserializeCqlVariable(GetValue(cosmosObject, Constants.Variable)); + return new CqlVariableRefScalarExpression(variable); } #endregion #region Aggregate - private static IReadOnlyList DeserializeAggregateArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeAggregateArray(CosmosArray cosmosArray) { - List aggregates = new List(cosmosArray.Count); + List aggregates = new List(cosmosArray.Count); foreach (CosmosElement aggregateElement in cosmosArray) { CosmosObject aggregateObject = CastToCosmosObject(aggregateElement); @@ -348,72 +347,72 @@ private static IReadOnlyList DeserializeAggregateArray(CosmosArray return aggregates; } - private static QLAggregate DeserializeAggregate(CosmosObject cosmosObject) + private static CqlAggregate DeserializeAggregate(CosmosObject cosmosObject) { - QLAggregateKind aggregateKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); + CqlAggregateKind aggregateKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); switch (aggregateKind) { - case QLAggregateKind.Builtin: + case CqlAggregateKind.Builtin: return DeserializeBuiltInAggregateExpression(cosmosObject); - case QLAggregateKind.Tuple: + case CqlAggregateKind.Tuple: return DeserializeTupleAggregateExpression(cosmosObject); default: - throw new NotSupportedException($"Invalid QLExpression kind: {aggregateKind}"); + throw new NotSupportedException($"Invalid CqlExpression kind: {aggregateKind}"); } } - private static QLBuiltinAggregate DeserializeBuiltInAggregateExpression(CosmosObject cosmosObject) + private static CqlBuiltinAggregate DeserializeBuiltInAggregateExpression(CosmosObject cosmosObject) { - QLAggregateOperatorKind aggregateOperatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); - return new QLBuiltinAggregate(aggregateOperatorKind); + CqlAggregateOperatorKind aggregateOperatorKind = GetEnumValue(GetValue(cosmosObject, Constants.OperatorKind).Value); + return new CqlBuiltinAggregate(aggregateOperatorKind); } - private static QLTupleAggregate DeserializeTupleAggregateExpression(CosmosObject cosmosObject) + private static CqlTupleAggregate DeserializeTupleAggregateExpression(CosmosObject cosmosObject) { CosmosArray tupleArray = GetValue(cosmosObject, Constants.Items); - List aggregates = new List(tupleArray.Count); + List aggregates = new List(tupleArray.Count); foreach (CosmosElement tupleElement in tupleArray) { CosmosObject tupleObject = CastToCosmosObject(tupleElement); - QLAggregate aggregate = DeserializeAggregate(tupleObject); + CqlAggregate aggregate = DeserializeAggregate(tupleObject); aggregates.Add(aggregate); } - return new QLTupleAggregate(aggregates); + return new CqlTupleAggregate(aggregates); } #endregion #region Literal - private static QLLiteral DeserializeLiteral(CosmosObject cosmosObject) + private static CqlLiteral DeserializeLiteral(CosmosObject cosmosObject) { - QLLiteralKind literalKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); + CqlLiteralKind literalKind = GetEnumValue(GetValue(cosmosObject, Constants.Kind).Value); switch (literalKind) { - case QLLiteralKind.Array: - return new QLArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); - case QLLiteralKind.Boolean: - return new QLBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); - case QLLiteralKind.Null: - return QLNullLiteral.Singleton; - case QLLiteralKind.Number: - return new QLNumberLiteral(GetValue(cosmosObject, Constants.Value).Value); - case QLLiteralKind.Object: - return new QLObjectLiteral(DeserializeObjectLiteralArray(GetValue(cosmosObject, Constants.Properties))); - case QLLiteralKind.String: - return new QLStringLiteral(GetValue(cosmosObject, Constants.Value).Value); - case QLLiteralKind.Undefined: - return QLUndefinedLiteral.Singleton; + case CqlLiteralKind.Array: + return new CqlArrayLiteral(DeserializeLiteralArray(GetValue(cosmosObject, Constants.Items))); + case CqlLiteralKind.Boolean: + return new CqlBooleanLiteral(GetValue(cosmosObject, Constants.Value).Value); + case CqlLiteralKind.Null: + return CqlNullLiteral.Singleton; + case CqlLiteralKind.Number: + return new CqlNumberLiteral(GetValue(cosmosObject, Constants.Value).Value); + case CqlLiteralKind.Object: + return new CqlObjectLiteral(DeserializeObjectLiteralArray(GetValue(cosmosObject, Constants.Properties))); + case CqlLiteralKind.String: + return new CqlStringLiteral(GetValue(cosmosObject, Constants.Value).Value); + case CqlLiteralKind.Undefined: + return CqlUndefinedLiteral.Singleton; default: - throw new NotSupportedException($"Invalid QLExpression kind: {literalKind}"); + throw new NotSupportedException($"Invalid CqlExpression kind: {literalKind}"); } } - private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosmosArray) { - List literals = new List(cosmosArray.Count); + List literals = new List(cosmosArray.Count); foreach (CosmosElement literalElement in cosmosArray) { CosmosObject literalObject = CastToCosmosObject(literalElement); @@ -423,15 +422,15 @@ private static IReadOnlyList DeserializeLiteralArray(CosmosArray cosm return literals; } - private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeObjectLiteralArray(CosmosArray cosmosArray) { - List objectLiterals = new List(cosmosArray.Count); + List objectLiterals = new List(cosmosArray.Count); foreach (CosmosElement objectLiteralElement in cosmosArray) { CosmosObject propertyObject = CastToCosmosObject(objectLiteralElement); string name = GetValue(propertyObject, Constants.Name).Value; - QLLiteral literal = DeserializeLiteral(propertyObject); - QLObjectLiteralProperty objectLiteralProperty = new QLObjectLiteralProperty(name, literal); + CqlLiteral literal = DeserializeLiteral(propertyObject); + CqlObjectLiteralProperty objectLiteralProperty = new CqlObjectLiteralProperty(name, literal); objectLiterals.Add(objectLiteralProperty); } @@ -442,50 +441,50 @@ private static IReadOnlyList DeserializeObjectLiteralAr #region Helper Functions - private static QLVariable DeserializeQLVariable(CosmosObject cosmosObject) + private static CqlVariable DeserializeCqlVariable(CosmosObject cosmosObject) { string name = GetValue(cosmosObject, Constants.Name).Value; long uniqueId = Number64.ToLong(GetValue(cosmosObject, Constants.UniqueId).Value); - return new QLVariable(name, uniqueId); + return new CqlVariable(name, uniqueId); } - private static IReadOnlyList DeserializeObjectProperties(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeObjectProperties(CosmosArray cosmosArray) { - List properties = new List(cosmosArray.Count); + List properties = new List(cosmosArray.Count); foreach (CosmosElement propertyElement in cosmosArray) { CosmosObject propertyObject = CastToCosmosObject(propertyElement); string objectPropertyName = GetValue(propertyObject, Constants.Name).Value; - QLScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); - properties.Add(new QLObjectProperty(objectPropertyName, expression)); + CqlScalarExpression expression = DeserializeScalarExpression(GetValue(propertyObject, Constants.Expression)); + properties.Add(new CqlObjectProperty(objectPropertyName, expression)); } return properties; } - private static IReadOnlyList DeserializeScalarExpressionArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeScalarExpressionArray(CosmosArray cosmosArray) { - List expressions = new List(cosmosArray.Count); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement itemElement in cosmosArray) { CosmosObject itemObject = CastToCosmosObject(itemElement); - QLScalarExpression expression = DeserializeScalarExpression(itemObject); + CqlScalarExpression expression = DeserializeScalarExpression(itemObject); expressions.Add(expression); } return expressions; } - private static IReadOnlyList DeserializeOrderByItemArray(CosmosArray cosmosArray) + private static IReadOnlyList DeserializeOrderByItemArray(CosmosArray cosmosArray) { - List expressions = new List(cosmosArray.Count); + List expressions = new List(cosmosArray.Count); foreach (CosmosElement itemElement in cosmosArray) { CosmosObject itemObject = CastToCosmosObject(itemElement); - QLSortOrder sortOrder = GetEnumValue(GetValue(itemObject, Constants.SortOrder).Value); - QLScalarExpression scalarExpression = DeserializeScalarExpression(itemObject); - expressions.Add(new QLOrderByItem(scalarExpression, sortOrder)); + CqlSortOrder sortOrder = GetEnumValue(GetValue(itemObject, Constants.SortOrder).Value); + CqlScalarExpression scalarExpression = DeserializeScalarExpression(itemObject); + expressions.Add(new CqlOrderByItem(scalarExpression, sortOrder)); } return expressions; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/ClientDistributionPlan.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/ClientDistributionPlan.cs similarity index 61% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/ClientDistributionPlan.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/ClientDistributionPlan.cs index 1f3aabcb7e..51da84c03e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/ClientDistributionPlan.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/ClientDistributionPlan.cs @@ -2,17 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; internal class ClientDistributionPlan { - public ClientDistributionPlan(QLEnumerableExpression clientQL) + public ClientDistributionPlan(CqlEnumerableExpression cql) { - this.ClientQL = clientQL ?? throw new ArgumentNullException(nameof(clientQL)); + this.Cql = cql ?? throw new ArgumentNullException(nameof(cql)); } - public QLEnumerableExpression ClientQL { get; } + public CqlEnumerableExpression Cql { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregate.cs similarity index 68% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregate.cs index 9d28a6b5ed..3df9af326f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregate.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal abstract class QLAggregate + internal abstract class CqlAggregate { - protected QLAggregate(QLAggregateKind kind) + protected CqlAggregate(CqlAggregateKind kind) { this.Kind = kind; } - public QLAggregateKind Kind { get; } + public CqlAggregateKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregateEnumerableExpression.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregateEnumerableExpression.cs index 2e7a1b2ee2..eb4a09a966 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregateEnumerableExpression.cs @@ -2,21 +2,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLAggregateEnumerableExpression : QLEnumerableExpression + internal class CqlAggregateEnumerableExpression : CqlEnumerableExpression { - public QLAggregateEnumerableExpression(QLEnumerableExpression sourceExpression, QLAggregate aggregate) - : base(QLEnumerableExpressionKind.Aggregate) + public CqlAggregateEnumerableExpression(CqlEnumerableExpression sourceExpression, CqlAggregate aggregate) + : base(CqlEnumerableExpressionKind.Aggregate) { this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.Aggregate = aggregate ?? throw new ArgumentNullException(nameof(aggregate)); } - public QLEnumerableExpression SourceExpression { get; } + public CqlEnumerableExpression SourceExpression { get; } - public QLAggregate Aggregate { get; } + public CqlAggregate Aggregate { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregateKind.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregateKind.cs index f5558a7ee5..c25ae41bb8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregateKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLAggregateKind + internal enum CqlAggregateKind { Builtin, Tuple, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregateOperatorKind.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregateOperatorKind.cs index fa1dd3f294..57c1955b74 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLAggregateOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlAggregateOperatorKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLAggregateOperatorKind + internal enum CqlAggregateOperatorKind { All, Any, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlArrayCreateScalarExpression.cs similarity index 66% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlArrayCreateScalarExpression.cs index f117be480b..84b829179c 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlArrayCreateScalarExpression.cs @@ -2,17 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLArrayCreateScalarExpression : QLScalarExpression + internal class CqlArrayCreateScalarExpression : CqlScalarExpression { private const string Array = "Array"; - public QLArrayCreateScalarExpression(IReadOnlyList items) - : base(QLScalarExpressionKind.ArrayCreate) + public CqlArrayCreateScalarExpression(IReadOnlyList items) + : base(CqlScalarExpressionKind.ArrayCreate) { this.ArrayKind = Array; this.Items = items ?? throw new ArgumentNullException(nameof(items)); @@ -20,6 +20,6 @@ public QLArrayCreateScalarExpression(IReadOnlyList items) public string ArrayKind { get; } - public IReadOnlyList Items { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleItemRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlArrayIndexerScalarExpression.cs similarity index 62% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleItemRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlArrayIndexerScalarExpression.cs index 752ba4a046..65d280a02e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleItemRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlArrayIndexerScalarExpression.cs @@ -2,20 +2,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLTupleItemRefScalarExpression : QLScalarExpression + internal class CqlArrayIndexerScalarExpression : CqlScalarExpression { - public QLTupleItemRefScalarExpression(QLScalarExpression expression, ulong index) - : base(QLScalarExpressionKind.TupleItemRef) + public CqlArrayIndexerScalarExpression(CqlScalarExpression expression, ulong index) + : base(CqlScalarExpressionKind.ArrayIndexer) { this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); this.Index = index; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } public ulong Index { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlArrayLiteral.cs similarity index 66% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlArrayLiteral.cs index 6733be88fe..a50036123d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlArrayLiteral.cs @@ -2,19 +2,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLArrayLiteral : QLLiteral + internal class CqlArrayLiteral : CqlLiteral { - public QLArrayLiteral(IReadOnlyList items) - : base(QLLiteralKind.Array) + public CqlArrayLiteral(IReadOnlyList items) + : base(CqlLiteralKind.Array) { this.Items = items ?? throw new ArgumentNullException(nameof(items)); } - public IReadOnlyList Items { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBinaryScalarExpression.cs similarity index 55% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBinaryScalarExpression.cs index d51e24dc90..9f3a382fd0 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBinaryScalarExpression.cs @@ -2,24 +2,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLBinaryScalarExpression : QLScalarExpression + internal class CqlBinaryScalarExpression : CqlScalarExpression { - public QLBinaryScalarExpression(QLBinaryScalarOperatorKind operatorKind, QLScalarExpression leftExpression, QLScalarExpression rightExpression) - : base(QLScalarExpressionKind.BinaryOperator) + public CqlBinaryScalarExpression(CqlBinaryScalarOperatorKind operatorKind, CqlScalarExpression leftExpression, CqlScalarExpression rightExpression) + : base(CqlScalarExpressionKind.BinaryOperator) { this.OperatorKind = operatorKind; this.LeftExpression = leftExpression ?? throw new ArgumentNullException(nameof(leftExpression)); this.RightExpression = rightExpression ?? throw new ArgumentNullException(nameof(rightExpression)); } - public QLBinaryScalarOperatorKind OperatorKind { get; } + public CqlBinaryScalarOperatorKind OperatorKind { get; } - public QLScalarExpression LeftExpression { get; } + public CqlScalarExpression LeftExpression { get; } - public QLScalarExpression RightExpression { get; } + public CqlScalarExpression RightExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBinaryScalarOperatorKind.cs similarity index 92% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBinaryScalarOperatorKind.cs index 78bfe0aa4f..c41a740994 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBinaryScalarOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBinaryScalarOperatorKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLBinaryScalarOperatorKind + internal enum CqlBinaryScalarOperatorKind { Add, And, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBooleanLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBooleanLiteral.cs similarity index 71% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBooleanLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBooleanLiteral.cs index cf647fa883..06f06b4e64 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBooleanLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBooleanLiteral.cs @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal class QLBooleanLiteral : QLLiteral + internal class CqlBooleanLiteral : CqlLiteral { - public QLBooleanLiteral(bool value) - : base(QLLiteralKind.Boolean) + public CqlBooleanLiteral(bool value) + : base(CqlLiteralKind.Boolean) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBuiltinAggregate.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBuiltinAggregate.cs index cc62f8c3d5..8dcebf5bb8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBuiltinAggregate.cs @@ -2,16 +2,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal class QLBuiltinAggregate : QLAggregate + internal class CqlBuiltinAggregate : CqlAggregate { - public QLBuiltinAggregate(QLAggregateOperatorKind operatorKind) - : base(QLAggregateKind.Builtin) + public CqlBuiltinAggregate(CqlAggregateOperatorKind operatorKind) + : base(CqlAggregateKind.Builtin) { this.OperatorKind = operatorKind; } - public QLAggregateOperatorKind OperatorKind { get; } + public CqlAggregateOperatorKind OperatorKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBuiltinScalarFunctionKind.cs similarity index 97% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBuiltinScalarFunctionKind.cs index faea256477..ae59e55cf1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLBuiltinScalarFunctionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlBuiltinScalarFunctionKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLBuiltinScalarFunctionKind + internal enum CqlBuiltinScalarFunctionKind { Abs, Acos, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLDistinctEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlDistinctEnumerableExpression.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLDistinctEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlDistinctEnumerableExpression.cs index d93437fd55..8fa7515235 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLDistinctEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlDistinctEnumerableExpression.cs @@ -2,25 +2,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLDistinctEnumerableExpression : QLEnumerableExpression + internal class CqlDistinctEnumerableExpression : CqlEnumerableExpression { - public QLDistinctEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, IReadOnlyList expression) - : base(QLEnumerableExpressionKind.Distinct) + public CqlDistinctEnumerableExpression(CqlEnumerableExpression sourceExpression, CqlVariable declaredVariable, IReadOnlyList expression) + : base(CqlEnumerableExpressionKind.Distinct) { this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } - public QLEnumerableExpression SourceExpression { get; } + public CqlEnumerableExpression SourceExpression { get; } - public QLVariable DeclaredVariable { get; } + public CqlVariable DeclaredVariable { get; } - public IReadOnlyList Expression { get; } + public IReadOnlyList Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlEnumerableExpression.cs similarity index 62% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlEnumerableExpression.cs index 5461a0052e..7b30bdc629 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlEnumerableExpression.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal abstract class QLEnumerableExpression + internal abstract class CqlEnumerableExpression { - protected QLEnumerableExpression(QLEnumerableExpressionKind kind) + protected CqlEnumerableExpression(CqlEnumerableExpressionKind kind) { this.Kind = kind; } - public QLEnumerableExpressionKind Kind { get; } + public CqlEnumerableExpressionKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlEnumerableExpressionKind.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlEnumerableExpressionKind.cs index 1d3537806b..11b135895d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerableExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlEnumerableExpressionKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLEnumerableExpressionKind + internal enum CqlEnumerableExpressionKind { Aggregate, Distinct, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerationKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlEnumerationKind.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerationKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlEnumerationKind.cs index eada610bee..60d96d2703 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLEnumerationKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlEnumerationKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLEnumerationKind + internal enum CqlEnumerationKind { ArrayItems, PropertyValues, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLFunctionIdentifier.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlFunctionIdentifier.cs similarity index 81% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLFunctionIdentifier.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlFunctionIdentifier.cs index d822a206a8..16a717bdfe 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLFunctionIdentifier.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlFunctionIdentifier.cs @@ -2,13 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLFunctionIdentifier + internal class CqlFunctionIdentifier { - public QLFunctionIdentifier(string name) + public CqlFunctionIdentifier(string name) { this.Name = name ?? throw new ArgumentNullException(nameof(name)); } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLGroupByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlGroupByEnumerableExpression.cs similarity index 61% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLGroupByEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlGroupByEnumerableExpression.cs index 2f2c43d5e8..b3efe8cb5d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLGroupByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlGroupByEnumerableExpression.cs @@ -2,25 +2,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLGroupByEnumerableExpression : QLEnumerableExpression + internal class CqlGroupByEnumerableExpression : CqlEnumerableExpression { - public QLGroupByEnumerableExpression(QLEnumerableExpression sourceExpression, ulong keyCount, IReadOnlyList aggregates) - : base(QLEnumerableExpressionKind.GroupBy) + public CqlGroupByEnumerableExpression(CqlEnumerableExpression sourceExpression, ulong keyCount, IReadOnlyList aggregates) + : base(CqlEnumerableExpressionKind.GroupBy) { this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.KeyCount = keyCount; this.Aggregates = aggregates ?? throw new ArgumentNullException(nameof(aggregates)); } - public QLEnumerableExpression SourceExpression { get; } + public CqlEnumerableExpression SourceExpression { get; } public ulong KeyCount { get; } - public IReadOnlyList Aggregates { get; } + public IReadOnlyList Aggregates { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLInputEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlInputEnumerableExpression.cs similarity index 68% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLInputEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlInputEnumerableExpression.cs index 90199c348a..a9a1ba8d6f 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLInputEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlInputEnumerableExpression.cs @@ -2,14 +2,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLInputEnumerableExpression : QLEnumerableExpression + internal class CqlInputEnumerableExpression : CqlEnumerableExpression { - public QLInputEnumerableExpression(string name) - : base(QLEnumerableExpressionKind.Input) + public CqlInputEnumerableExpression(string name) + : base(CqlEnumerableExpressionKind.Input) { this.Name = name ?? throw new ArgumentNullException(nameof(name)); } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlIsOperatorKind.cs similarity index 87% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlIsOperatorKind.cs index d2a0b77e77..84a8e17601 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlIsOperatorKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLIsOperatorKind + internal enum CqlIsOperatorKind { Defined, } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlIsOperatorScalarExpression.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlIsOperatorScalarExpression.cs index 9107d9348c..c1aa03907d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLIsOperatorScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlIsOperatorScalarExpression.cs @@ -2,22 +2,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLIsOperatorScalarExpression : QLScalarExpression + internal class CqlIsOperatorScalarExpression : CqlScalarExpression { - public QLIsOperatorScalarExpression(QLIsOperatorKind operatorKind, QLScalarExpression expression) - : base(QLScalarExpressionKind.IsOperator) + public CqlIsOperatorScalarExpression(CqlIsOperatorKind operatorKind, CqlScalarExpression expression) + : base(CqlScalarExpressionKind.IsOperator) { this.OperatorKind = operatorKind; this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } - public QLIsOperatorKind OperatorKind { get; } + public CqlIsOperatorKind OperatorKind { get; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLetScalarExpression.cs similarity index 60% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLetScalarExpression.cs index 6a12b7ec96..329e2f36cd 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLetScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLetScalarExpression.cs @@ -2,24 +2,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLLetScalarExpression : QLScalarExpression + internal class CqlLetScalarExpression : CqlScalarExpression { - public QLLetScalarExpression(QLVariable declaredVariable, QLScalarExpression declaredVariableExpression, QLScalarExpression expression) - : base(QLScalarExpressionKind.Let) + public CqlLetScalarExpression(CqlVariable declaredVariable, CqlScalarExpression declaredVariableExpression, CqlScalarExpression expression) + : base(CqlScalarExpressionKind.Let) { this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); this.DeclaredVariableExpression = declaredVariableExpression ?? throw new ArgumentNullException(nameof(declaredVariableExpression)); this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } - public QLVariable DeclaredVariable { get; } + public CqlVariable DeclaredVariable { get; } - public QLScalarExpression DeclaredVariableExpression { get; } + public CqlScalarExpression DeclaredVariableExpression { get; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLiteral.cs similarity index 69% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLiteral.cs index ca1ff6a68f..d5b17b06ac 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLiteral.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal abstract class QLLiteral + internal abstract class CqlLiteral { - protected QLLiteral(QLLiteralKind kind) + protected CqlLiteral(CqlLiteralKind kind) { this.Kind = kind; } - public QLLiteralKind Kind { get; } + public CqlLiteralKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLiteralKind.cs similarity index 90% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLiteralKind.cs index f3b8416e7c..e03b18a28a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLiteralKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLLiteralKind + internal enum CqlLiteralKind { Undefined, Array, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLiteralScalarExpression.cs similarity index 63% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLiteralScalarExpression.cs index 4d8724943a..ebc82d9048 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLLiteralScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlLiteralScalarExpression.cs @@ -2,18 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLLiteralScalarExpression : QLScalarExpression + internal class CqlLiteralScalarExpression : CqlScalarExpression { - public QLLiteralScalarExpression(QLLiteral literal) - : base(QLScalarExpressionKind.Literal) + public CqlLiteralScalarExpression(CqlLiteral literal) + : base(CqlScalarExpressionKind.Literal) { this.Literal = literal ?? throw new ArgumentNullException(nameof(literal)); } - public QLLiteral Literal { get; } + public CqlLiteral Literal { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMuxScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlMuxScalarExpression.cs similarity index 59% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMuxScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlMuxScalarExpression.cs index 5111fd64cf..0ebb3cab53 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLMuxScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlMuxScalarExpression.cs @@ -2,24 +2,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLMuxScalarExpression : QLScalarExpression + internal class CqlMuxScalarExpression : CqlScalarExpression { - public QLMuxScalarExpression(QLScalarExpression conditionExpression, QLScalarExpression leftExpression, QLScalarExpression rightExpression) - : base(QLScalarExpressionKind.Mux) + public CqlMuxScalarExpression(CqlScalarExpression conditionExpression, CqlScalarExpression leftExpression, CqlScalarExpression rightExpression) + : base(CqlScalarExpressionKind.Mux) { this.ConditionExpression = conditionExpression ?? throw new ArgumentNullException(nameof(conditionExpression)); this.LeftExpression = leftExpression ?? throw new ArgumentNullException(nameof(leftExpression)); this.RightExpression = rightExpression ?? throw new ArgumentNullException(nameof(rightExpression)); } - public QLScalarExpression ConditionExpression { get; } + public CqlScalarExpression ConditionExpression { get; } - public QLScalarExpression LeftExpression { get; } + public CqlScalarExpression LeftExpression { get; } - public QLScalarExpression RightExpression { get; } + public CqlScalarExpression RightExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNullLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlNullLiteral.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNullLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlNullLiteral.cs index af21c7b483..53696840b1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNullLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlNullLiteral.cs @@ -2,14 +2,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal class QLNullLiteral : QLLiteral + internal class CqlNullLiteral : CqlLiteral { - public static readonly QLNullLiteral Singleton = new QLNullLiteral(); + public static readonly CqlNullLiteral Singleton = new CqlNullLiteral(); - private QLNullLiteral() - : base(QLLiteralKind.Null) + private CqlNullLiteral() + : base(CqlLiteralKind.Null) { } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNumberLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlNumberLiteral.cs similarity index 73% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNumberLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlNumberLiteral.cs index 6c5ddec82a..28769462d7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLNumberLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlNumberLiteral.cs @@ -2,14 +2,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System.Collections.Generic; - internal class QLNumberLiteral : QLLiteral + internal class CqlNumberLiteral : CqlLiteral { - public QLNumberLiteral(Number64 value) - : base(QLLiteralKind.Number) + public CqlNumberLiteral(Number64 value) + : base(CqlLiteralKind.Number) { this.Value = value; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectCreateScalarExpression.cs similarity index 66% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectCreateScalarExpression.cs index 5b81113bc2..1bcd44e106 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectCreateScalarExpression.cs @@ -2,23 +2,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLObjectCreateScalarExpression : QLScalarExpression + internal class CqlObjectCreateScalarExpression : CqlScalarExpression { private const string Object = "Object"; - public QLObjectCreateScalarExpression(IReadOnlyList properties) - : base(QLScalarExpressionKind.ObjectCreate) + public CqlObjectCreateScalarExpression(IReadOnlyList properties) + : base(CqlScalarExpressionKind.ObjectCreate) { this.Properties = properties ?? throw new ArgumentNullException(nameof(properties)); this.ObjectKind = Object; } - public IReadOnlyList Properties { get; } + public IReadOnlyList Properties { get; } public string ObjectKind { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectLiteral.cs similarity index 63% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectLiteral.cs index 28e0f11641..e5ba8ff343 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectLiteral.cs @@ -2,19 +2,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLObjectLiteral : QLLiteral + internal class CqlObjectLiteral : CqlLiteral { - public QLObjectLiteral(IReadOnlyList properties) - : base(QLLiteralKind.Object) + public CqlObjectLiteral(IReadOnlyList properties) + : base(CqlLiteralKind.Object) { this.Properties = properties ?? throw new ArgumentNullException(nameof(properties)); } - public IReadOnlyList Properties { get; } + public IReadOnlyList Properties { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteralProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectLiteralProperty.cs similarity index 75% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteralProperty.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectLiteralProperty.cs index 6bbb6f858d..4a063d4449 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectLiteralProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectLiteralProperty.cs @@ -2,13 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLObjectLiteralProperty + internal class CqlObjectLiteralProperty { - public QLObjectLiteralProperty(string name, QLLiteral literal) + public CqlObjectLiteralProperty(string name, CqlLiteral literal) { this.Name = name ?? throw new ArgumentNullException(nameof(name)); this.Literal = literal ?? throw new ArgumentNullException(nameof(literal)); @@ -16,6 +16,6 @@ public QLObjectLiteralProperty(string name, QLLiteral literal) public string Name { get; } - public QLLiteral Literal { get; } + public CqlLiteral Literal { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectProperty.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectProperty.cs similarity index 75% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectProperty.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectProperty.cs index ad61a933d9..7b97de1620 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLObjectProperty.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlObjectProperty.cs @@ -2,13 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLObjectProperty + internal class CqlObjectProperty { - public QLObjectProperty(string name, QLScalarExpression expression) + public CqlObjectProperty(string name, CqlScalarExpression expression) { this.Name = name ?? throw new ArgumentNullException(nameof(name)); this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); @@ -16,6 +16,6 @@ public QLObjectProperty(string name, QLScalarExpression expression) public string Name { get; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlOrderByEnumerableExpression.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlOrderByEnumerableExpression.cs index 62d06e898e..b4b9603841 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlOrderByEnumerableExpression.cs @@ -2,25 +2,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLOrderByEnumerableExpression : QLEnumerableExpression + internal class CqlOrderByEnumerableExpression : CqlEnumerableExpression { - public QLOrderByEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, IReadOnlyList items) - : base(QLEnumerableExpressionKind.OrderBy) + public CqlOrderByEnumerableExpression(CqlEnumerableExpression sourceExpression, CqlVariable declaredVariable, IReadOnlyList items) + : base(CqlEnumerableExpressionKind.OrderBy) { this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); this.Items = items ?? throw new ArgumentNullException(nameof(items)); } - public QLEnumerableExpression SourceExpression { get; } + public CqlEnumerableExpression SourceExpression { get; } - public QLVariable DeclaredVariable { get; } + public CqlVariable DeclaredVariable { get; } - public IReadOnlyList Items { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByItem.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlOrderByItem.cs similarity index 66% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByItem.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlOrderByItem.cs index 867ebe3277..8fb4a73810 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLOrderByItem.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlOrderByItem.cs @@ -2,20 +2,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLOrderByItem + internal class CqlOrderByItem { - public QLOrderByItem(QLScalarExpression expression, QLSortOrder sortOrder) + public CqlOrderByItem(CqlScalarExpression expression, CqlSortOrder sortOrder) { this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); this.SortOrder = sortOrder; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } - public QLSortOrder SortOrder { get; } + public CqlSortOrder SortOrder { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLPropertyRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlPropertyRefScalarExpression.cs similarity index 67% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLPropertyRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlPropertyRefScalarExpression.cs index af0ae002d0..e93a31fe3e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLPropertyRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlPropertyRefScalarExpression.cs @@ -2,21 +2,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLPropertyRefScalarExpression : QLScalarExpression + internal class CqlPropertyRefScalarExpression : CqlScalarExpression { - public QLPropertyRefScalarExpression(QLScalarExpression expression, string propertyName) - : base(QLScalarExpressionKind.PropertyRef) + public CqlPropertyRefScalarExpression(CqlScalarExpression expression, string propertyName) + : base(CqlScalarExpressionKind.PropertyRef) { this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); this.PropertyName = propertyName ?? throw new ArgumentNullException(nameof(propertyName)); } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } public string PropertyName { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarAsEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlScalarAsEnumerableExpression.cs similarity index 54% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarAsEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlScalarAsEnumerableExpression.cs index ac036fc2d1..0d69d8b424 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarAsEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlScalarAsEnumerableExpression.cs @@ -2,21 +2,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLScalarAsEnumerableExpression : QLEnumerableExpression + internal class CqlScalarAsEnumerableExpression : CqlEnumerableExpression { - public QLScalarAsEnumerableExpression(QLScalarExpression expression, QLEnumerationKind enumerationKind) - : base(QLEnumerableExpressionKind.ScalarAsEnumerable) + public CqlScalarAsEnumerableExpression(CqlScalarExpression expression, CqlEnumerationKind enumerationKind) + : base(CqlEnumerableExpressionKind.ScalarAsEnumerable) { this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); this.EnumerationKind = enumerationKind; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } - public QLEnumerationKind EnumerationKind { get; } + public CqlEnumerationKind EnumerationKind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlScalarExpression.cs similarity index 64% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlScalarExpression.cs index 12f461ab10..659bdc5f58 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlScalarExpression.cs @@ -2,15 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal abstract class QLScalarExpression + internal abstract class CqlScalarExpression { - protected QLScalarExpression(QLScalarExpressionKind kind) + protected CqlScalarExpression(CqlScalarExpressionKind kind) { this.Kind = kind; } - public QLScalarExpressionKind Kind { get; } + public CqlScalarExpressionKind Kind { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpressionKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlScalarExpressionKind.cs similarity index 92% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpressionKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlScalarExpressionKind.cs index b06f2983a5..fede841576 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLScalarExpressionKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlScalarExpressionKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLScalarExpressionKind + internal enum CqlScalarExpressionKind { ArrayCreate, ArrayIndexer, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSelectEnumerableExpression.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSelectEnumerableExpression.cs index 6e7279d862..0d052e980b 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSelectEnumerableExpression.cs @@ -2,24 +2,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLSelectEnumerableExpression : QLEnumerableExpression + internal class CqlSelectEnumerableExpression : CqlEnumerableExpression { - public QLSelectEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, QLScalarExpression expression) - : base(QLEnumerableExpressionKind.Select) + public CqlSelectEnumerableExpression(CqlEnumerableExpression sourceExpression, CqlVariable declaredVariable, CqlScalarExpression expression) + : base(CqlEnumerableExpressionKind.Select) { this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } - public QLEnumerableExpression SourceExpression { get; } + public CqlEnumerableExpression SourceExpression { get; } - public QLVariable DeclaredVariable { get; } + public CqlVariable DeclaredVariable { get; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectManyEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSelectManyEnumerableExpression.cs similarity index 57% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectManyEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSelectManyEnumerableExpression.cs index 8088a1e006..e34d4ba874 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSelectManyEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSelectManyEnumerableExpression.cs @@ -2,24 +2,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLSelectManyEnumerableExpression : QLEnumerableExpression + internal class CqlSelectManyEnumerableExpression : CqlEnumerableExpression { - public QLSelectManyEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, QLEnumerableExpression selectorExpression) - : base(QLEnumerableExpressionKind.SelectMany) + public CqlSelectManyEnumerableExpression(CqlEnumerableExpression sourceExpression, CqlVariable declaredVariable, CqlEnumerableExpression selectorExpression) + : base(CqlEnumerableExpressionKind.SelectMany) { this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); this.SelectorExpression = selectorExpression ?? throw new ArgumentNullException(nameof(selectorExpression)); } - public QLEnumerableExpression SourceExpression { get; } + public CqlEnumerableExpression SourceExpression { get; } - public QLVariable DeclaredVariable { get; } + public CqlVariable DeclaredVariable { get; } - public QLEnumerableExpression SelectorExpression { get; } + public CqlEnumerableExpression SelectorExpression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSortOrder.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSortOrder.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSortOrder.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSortOrder.cs index d16fec19a8..efd5aaeb42 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSortOrder.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSortOrder.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLSortOrder + internal enum CqlSortOrder { Ascending, Descending diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLStringLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlStringLiteral.cs similarity index 74% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLStringLiteral.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlStringLiteral.cs index 1261d3f29f..a20947b0dd 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLStringLiteral.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlStringLiteral.cs @@ -2,14 +2,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLStringLiteral : QLLiteral + internal class CqlStringLiteral : CqlLiteral { - public QLStringLiteral(string value) - : base(QLLiteralKind.String) + public CqlStringLiteral(string value) + : base(CqlLiteralKind.String) { this.Value = value ?? throw new ArgumentNullException(nameof(value)); } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSystemFunctionCallScalarExpression.cs similarity index 53% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSystemFunctionCallScalarExpression.cs index a4521d04dc..d42ee09f15 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLSystemFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlSystemFunctionCallScalarExpression.cs @@ -2,22 +2,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLSystemFunctionCallScalarExpression : QLScalarExpression + internal class CqlSystemFunctionCallScalarExpression : CqlScalarExpression { - public QLSystemFunctionCallScalarExpression(QLBuiltinScalarFunctionKind functionKind, IReadOnlyList arguments) - : base(QLScalarExpressionKind.SystemFunctionCall) + public CqlSystemFunctionCallScalarExpression(CqlBuiltinScalarFunctionKind functionKind, IReadOnlyList arguments) + : base(CqlScalarExpressionKind.SystemFunctionCall) { this.FunctionKind = functionKind; this.Arguments = arguments ?? throw new ArgumentNullException(nameof(arguments)); } - public QLBuiltinScalarFunctionKind FunctionKind { get; } + public CqlBuiltinScalarFunctionKind FunctionKind { get; } - public IReadOnlyList Arguments { get; } + public IReadOnlyList Arguments { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTakeEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTakeEnumerableExpression.cs similarity index 65% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTakeEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTakeEnumerableExpression.cs index d41b8fdac5..0391db64fd 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTakeEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTakeEnumerableExpression.cs @@ -2,21 +2,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLTakeEnumerableExpression : QLEnumerableExpression + internal class CqlTakeEnumerableExpression : CqlEnumerableExpression { - public QLTakeEnumerableExpression(QLEnumerableExpression sourceExpression, ulong skipValue, ulong takeValue) - : base(QLEnumerableExpressionKind.Take) + public CqlTakeEnumerableExpression(CqlEnumerableExpression sourceExpression, ulong skipValue, ulong takeValue) + : base(CqlEnumerableExpressionKind.Take) { this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.SkipValue = skipValue; this.TakeValue = takeValue; } - public QLEnumerableExpression SourceExpression { get; } + public CqlEnumerableExpression SourceExpression { get; } public ulong SkipValue { get; } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleAggregate.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTupleAggregate.cs similarity index 65% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleAggregate.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTupleAggregate.cs index 78c437e98d..6f553c1ec8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleAggregate.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTupleAggregate.cs @@ -2,19 +2,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLTupleAggregate : QLAggregate + internal class CqlTupleAggregate : CqlAggregate { - public QLTupleAggregate(IReadOnlyList items) - : base(QLAggregateKind.Tuple) + public CqlTupleAggregate(IReadOnlyList items) + : base(CqlAggregateKind.Tuple) { this.Items = items ?? throw new ArgumentNullException(nameof(items)); } - public IReadOnlyList Items { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleCreateScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTupleCreateScalarExpression.cs similarity index 59% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleCreateScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTupleCreateScalarExpression.cs index e0d8c3fd76..0c30e79d33 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLTupleCreateScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTupleCreateScalarExpression.cs @@ -2,19 +2,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLTupleCreateScalarExpression : QLScalarExpression + internal class CqlTupleCreateScalarExpression : CqlScalarExpression { - public QLTupleCreateScalarExpression(IReadOnlyList items) - : base(QLScalarExpressionKind.TupleCreate) + public CqlTupleCreateScalarExpression(IReadOnlyList items) + : base(CqlScalarExpressionKind.TupleCreate) { this.Items = items ?? throw new ArgumentNullException(nameof(items)); } - public IReadOnlyList Items { get; } + public IReadOnlyList Items { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayIndexerScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTupleItemRefScalarExpression.cs similarity index 62% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayIndexerScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTupleItemRefScalarExpression.cs index 239ba13821..bc011cecf7 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLArrayIndexerScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlTupleItemRefScalarExpression.cs @@ -2,20 +2,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLArrayIndexerScalarExpression : QLScalarExpression + internal class CqlTupleItemRefScalarExpression : CqlScalarExpression { - public QLArrayIndexerScalarExpression(QLScalarExpression expression, ulong index) - : base(QLScalarExpressionKind.ArrayIndexer) + public CqlTupleItemRefScalarExpression(CqlScalarExpression expression, ulong index) + : base(CqlScalarExpressionKind.TupleItemRef) { this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); this.Index = index; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } public ulong Index { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUnaryScalarExpression.cs similarity index 55% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUnaryScalarExpression.cs index 40a885fb1d..8131ea618d 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUnaryScalarExpression.cs @@ -2,21 +2,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLUnaryScalarExpression : QLScalarExpression + internal class CqlUnaryScalarExpression : CqlScalarExpression { - public QLUnaryScalarExpression(QLUnaryScalarOperatorKind operatorKind, QLScalarExpression expression) - : base(QLScalarExpressionKind.UnaryOperator) + public CqlUnaryScalarExpression(CqlUnaryScalarOperatorKind operatorKind, CqlScalarExpression expression) + : base(CqlScalarExpressionKind.UnaryOperator) { this.OperatorKind = operatorKind; this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } - public QLUnaryScalarOperatorKind OperatorKind { get; } + public CqlUnaryScalarOperatorKind OperatorKind { get; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarOperatorKind.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUnaryScalarOperatorKind.cs similarity index 86% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarOperatorKind.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUnaryScalarOperatorKind.cs index 3c87772719..30c0cedc54 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUnaryScalarOperatorKind.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUnaryScalarOperatorKind.cs @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { - internal enum QLUnaryScalarOperatorKind + internal enum CqlUnaryScalarOperatorKind { BitwiseNot, Minus, diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUndefinedLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUndefinedLiteral.cs new file mode 100644 index 0000000000..ecc8d556b2 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUndefinedLiteral.cs @@ -0,0 +1,16 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql +{ + internal class CqlUndefinedLiteral : CqlLiteral + { + public static readonly CqlUndefinedLiteral Singleton = new CqlUndefinedLiteral(); + + private CqlUndefinedLiteral() + : base(CqlLiteralKind.Undefined) + { + } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUserDefinedFunctionCallScalarExpression.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUserDefinedFunctionCallScalarExpression.cs index e3401e2f76..fda301a6a1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUserDefinedFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlUserDefinedFunctionCallScalarExpression.cs @@ -2,24 +2,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; using System.Collections.Generic; - internal class QLUserDefinedFunctionCallScalarExpression : QLScalarExpression + internal class CqlUserDefinedFunctionCallScalarExpression : CqlScalarExpression { - public QLUserDefinedFunctionCallScalarExpression(QLFunctionIdentifier identifier, IReadOnlyList arguments, bool builtin) - : base(QLScalarExpressionKind.UserDefinedFunctionCall) + public CqlUserDefinedFunctionCallScalarExpression(CqlFunctionIdentifier identifier, IReadOnlyList arguments, bool builtin) + : base(CqlScalarExpressionKind.UserDefinedFunctionCall) { this.Identifier = identifier ?? throw new ArgumentNullException(nameof(identifier)); this.Arguments = arguments ?? throw new ArgumentNullException(nameof(arguments)); this.Builtin = builtin; } - public QLFunctionIdentifier Identifier { get; } + public CqlFunctionIdentifier Identifier { get; } - public IReadOnlyList Arguments { get; } + public IReadOnlyList Arguments { get; } public bool Builtin { get; } } diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariable.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlVariable.cs similarity index 84% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariable.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlVariable.cs index 1b6afcb5ba..73cbac8324 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariable.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlVariable.cs @@ -2,13 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLVariable + internal class CqlVariable { - public QLVariable(string name, long uniqueId) + public CqlVariable(string name, long uniqueId) { this.Name = name ?? throw new ArgumentNullException(nameof(name)); this.UniqueId = uniqueId; diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariableRefScalarExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlVariableRefScalarExpression.cs similarity index 61% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariableRefScalarExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlVariableRefScalarExpression.cs index ec73507f04..a909fb39a1 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLVariableRefScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlVariableRefScalarExpression.cs @@ -2,18 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLVariableRefScalarExpression : QLScalarExpression + internal class CqlVariableRefScalarExpression : CqlScalarExpression { - public QLVariableRefScalarExpression(QLVariable variable) - : base(QLScalarExpressionKind.VariableRef) + public CqlVariableRefScalarExpression(CqlVariable variable) + : base(CqlScalarExpressionKind.VariableRef) { this.Variable = variable ?? throw new ArgumentNullException(nameof(variable)); } - public QLVariable Variable { get; } + public CqlVariable Variable { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLWhereEnumerableExpression.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlWhereEnumerableExpression.cs similarity index 58% rename from Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLWhereEnumerableExpression.cs rename to Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlWhereEnumerableExpression.cs index 535779f48d..3f6db64aa2 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLWhereEnumerableExpression.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/Cql/CqlWhereEnumerableExpression.cs @@ -2,24 +2,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL +namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql { using System; - internal class QLWhereEnumerableExpression : QLEnumerableExpression + internal class CqlWhereEnumerableExpression : CqlEnumerableExpression { - public QLWhereEnumerableExpression(QLEnumerableExpression sourceExpression, QLVariable declaredVariable, QLScalarExpression expression) - : base(QLEnumerableExpressionKind.Where) + public CqlWhereEnumerableExpression(CqlEnumerableExpression sourceExpression, CqlVariable declaredVariable, CqlScalarExpression expression) + : base(CqlEnumerableExpressionKind.Where) { this.SourceExpression = sourceExpression ?? throw new ArgumentNullException(nameof(sourceExpression)); this.DeclaredVariable = declaredVariable ?? throw new ArgumentNullException(nameof(declaredVariable)); this.Expression = expression ?? throw new ArgumentNullException(nameof(expression)); } - public QLEnumerableExpression SourceExpression { get; } + public CqlEnumerableExpression SourceExpression { get; } - public QLVariable DeclaredVariable { get; } + public CqlVariable DeclaredVariable { get; } - public QLScalarExpression Expression { get; } + public CqlScalarExpression Expression { get; } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUndefinedLiteral.cs b/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUndefinedLiteral.cs deleted file mode 100644 index 255120f28a..0000000000 --- a/Microsoft.Azure.Cosmos/src/Query/Core/ClientDistributionPlan/QL/QLUndefinedLiteral.cs +++ /dev/null @@ -1,16 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL -{ - internal class QLUndefinedLiteral : QLLiteral - { - public static readonly QLUndefinedLiteral Singleton = new QLUndefinedLiteral(); - - private QLUndefinedLiteral() - : base(QLLiteralKind.Undefined) - { - } - } -} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml index 836410c22e..c59b58aef1 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/ClientDistributionPlanBaselineTests.TestClientDistributionPlanDeserialization.xml @@ -2,11 +2,11 @@ Input Expression - {"clientDistributionPlan": {"clientQL": {"Kind": "Input","Name": "root"}}} + {"clientDistributionPlan": {"Cql": {"Kind": "Input","Name": "root"}}} { - "ClientQL": { + "Cql": { "Name": "root", "Kind": 3 } @@ -16,11 +16,11 @@ Aggregate and ObjectCreate Expressions - {"clientDistributionPlan": {"clientQL": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a","Expression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6}}}]},"SourceExpression": {"Kind": "Aggregate","Aggregate": {"Kind": "Builtin","OperatorKind": "Sum"},"SourceExpression": {"Kind": "Input","Name": "root"}}}}} + {"clientDistributionPlan": {"Cql": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a","Expression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6}}}]},"SourceExpression": {"Kind": "Aggregate","Aggregate": {"Kind": "Builtin","OperatorKind": "Sum"},"SourceExpression": {"Kind": "Input","Name": "root"}}}}} { - "ClientQL": { + "Cql": { "SourceExpression": { "SourceExpression": { "Name": "root", @@ -60,11 +60,11 @@ Select, Aggregate and BinaryOperator Expressions - {"clientDistributionPlan": {"clientQL": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 10 }, "Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [ {"Name": "F1","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "FieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "FieldSum", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 1 }},{ "Name": "FieldAvg", "Expression": {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "Equal", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }, "RightExpression": {"Kind": "Literal","Literal": { "Kind": "Number", "Value": 0} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Undefined" }},"RightExpression": { "Kind": "BinaryOperator", "OperatorKind": "Divide", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 0 }, "RightExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }}}}]}}, {"Name": "F2","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "OtherFieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "OtherFieldMax", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 3 }} ]} }] }, "SourceExpression": {"Kind": "GroupBy","KeyCount": 1,"Aggregates": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Tuple","Items": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Builtin","OperatorKind": "Sum" }] }, {"Kind": "Builtin","OperatorKind": "Max" }],"SourceExpression": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 16 }, "Expression": {"Kind": "TupleCreate","Items": [ {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 0 }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} }, {"Kind": "TupleCreate","Items": [ {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 2 }, "Index": 0} }, {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 1 }] }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16}},"Index": 3}, "Index": 0}}]}, "SourceExpression": {"Kind": "Input","Name": "root"}}}}}} + {"clientDistributionPlan": {"Cql": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 10 }, "Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [ {"Name": "F1","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "FieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "FieldSum", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 1 }},{ "Name": "FieldAvg", "Expression": {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "Equal", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }, "RightExpression": {"Kind": "Literal","Literal": { "Kind": "Number", "Value": 0} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Undefined" }},"RightExpression": { "Kind": "BinaryOperator", "OperatorKind": "Divide", "LeftExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 0 }, "RightExpression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 10} }, "Index": 2},"Index": 1 }}}}]}}, {"Name": "F2","Expression": { "Kind": "ObjectCreate", "ObjectKind": "Object", "Properties": [{ "Name": "OtherFieldA", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 0 }},{ "Name": "OtherFieldMax", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 10 }},"Index": 3 }} ]} }] }, "SourceExpression": {"Kind": "GroupBy","KeyCount": 1,"Aggregates": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Tuple","Items": [ {"Kind": "Builtin","OperatorKind": "Sum" }, {"Kind": "Builtin","OperatorKind": "Sum" }] }, {"Kind": "Builtin","OperatorKind": "Max" }],"SourceExpression": { "Kind": "Select", "DeclaredVariable": {"Name": "v0","UniqueId": 16 }, "Expression": {"Kind": "TupleCreate","Items": [ {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 0 }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 1 }, "Index": 0} }, {"Kind": "TupleCreate","Items": [ {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 0 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 2 }, "Index": 0} }, {"Kind": "TupleItemRef","Expression": { "Kind": "TupleItemRef", "Expression": {"Kind": "VariableRef","Variable": { "Name": "v0", "UniqueId": 16} }, "Index": 2},"Index": 1 }] }, {"Kind": "Mux","ConditionExpression": { "Kind": "BinaryOperator", "OperatorKind": "And", "LeftExpression": {"Kind": "BinaryOperator","OperatorKind": "NotEqual","LeftExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 1},"RightExpression": { "Kind": "Literal", "Literal": {"Kind": "Number","Value": 0 }} }, "RightExpression": {"Kind": "UnaryOperator","OperatorKind": "Not","Expression": { "Kind": "SystemFunctionCall", "FunctionKind": "Is_Defined", "Arguments": [{ "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16 }},"Index": 3 }, "Index": 0} ]} }},"LeftExpression": { "Kind": "Literal", "Literal": {"Kind": "Array","Items": [] }},"RightExpression": { "Kind": "TupleItemRef", "Expression": {"Kind": "TupleItemRef","Expression": { "Kind": "VariableRef", "Variable": {"Name": "v0","UniqueId": 16}},"Index": 3}, "Index": 0}}]}, "SourceExpression": {"Kind": "Input","Name": "root"}}}}}} { - "ClientQL": { + "Cql": { "SourceExpression": { "SourceExpression": { "SourceExpression": { @@ -551,11 +551,11 @@ Select, Sum and VariableRef Expressions - {"clientDistributionPlan": {"clientQL": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a_plus_five","Expression": {"Kind": "BinaryOperator","OperatorKind": "Add","LeftExpression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6 }}, "RightExpression": { "Kind": "Literal", "Literal": { "Kind": "Number", "Value": 5 }}}}]}, "SourceExpression": { "Kind": "Aggregate", "Aggregate": { "Kind": "Builtin", "OperatorKind": "Sum" }, "SourceExpression": { "Kind": "Input", "Name": "root" }}}}} + {"clientDistributionPlan": {"Cql": {"Kind": "Select","DeclaredVariable": {"Name": "v0","UniqueId": 6},"Expression": {"Kind": "ObjectCreate","ObjectKind": "Object","Properties": [{"Name": "count_a_plus_five","Expression": {"Kind": "BinaryOperator","OperatorKind": "Add","LeftExpression": {"Kind": "VariableRef","Variable": {"Name": "v0","UniqueId": 6 }}, "RightExpression": { "Kind": "Literal", "Literal": { "Kind": "Number", "Value": 5 }}}}]}, "SourceExpression": { "Kind": "Aggregate", "Aggregate": { "Kind": "Builtin", "OperatorKind": "Sum" }, "SourceExpression": { "Kind": "Input", "Name": "root" }}}}} { - "ClientQL": { + "Cql": { "SourceExpression": { "SourceExpression": { "Name": "root", diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/ClientDistributionPlanBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/ClientDistributionPlanBaselineTests.cs index 0307920504..845f71d25e 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/ClientDistributionPlanBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/ClientDistributionPlanBaselineTests.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Xml; using Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan; - using Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.QL; + using Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql; using Microsoft.Azure.Cosmos.Test.BaselineTest; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; @@ -20,19 +20,19 @@ public void TestClientDistributionPlanDeserialization() { CreateInput( description: @"Input Expression", - clientPlanJson: "{\"clientDistributionPlan\": {\"clientQL\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}"), + clientPlanJson: "{\"clientDistributionPlan\": {\"Cql\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}"), CreateInput( description: @"Aggregate and ObjectCreate Expressions", - clientPlanJson: "{\"clientDistributionPlan\": {\"clientQL\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a\",\"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6}}}]},\"SourceExpression\": {\"Kind\": \"Aggregate\",\"Aggregate\": {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\"},\"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}"), + clientPlanJson: "{\"clientDistributionPlan\": {\"Cql\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a\",\"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6}}}]},\"SourceExpression\": {\"Kind\": \"Aggregate\",\"Aggregate\": {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\"},\"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}"), CreateInput( description: @"Select, Aggregate and BinaryOperator Expressions", - clientPlanJson: "{\"clientDistributionPlan\": {\"clientQL\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 10 }, \"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [ {\"Name\": \"F1\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"FieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"FieldSum\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 1 }},{ \"Name\": \"FieldAvg\", \"Expression\": {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Equal\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }, \"RightExpression\": {\"Kind\": \"Literal\",\"Literal\": { \"Kind\": \"Number\", \"Value\": 0} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Undefined\" }},\"RightExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Divide\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 0 }, \"RightExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }}}}]}}, {\"Name\": \"F2\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"OtherFieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"OtherFieldMax\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 3 }} ]} }] }, \"SourceExpression\": {\"Kind\": \"GroupBy\",\"KeyCount\": 1,\"Aggregates\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Tuple\",\"Items\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }] }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Max\" }],\"SourceExpression\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 16 }, \"Expression\": {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 0 }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} }, {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 2 }, \"Index\": 0} }, {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 1 }] }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16}},\"Index\": 3}, \"Index\": 0}}]}, \"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}}"), + clientPlanJson: "{\"clientDistributionPlan\": {\"Cql\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 10 }, \"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [ {\"Name\": \"F1\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"FieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"FieldSum\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 1 }},{ \"Name\": \"FieldAvg\", \"Expression\": {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Equal\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }, \"RightExpression\": {\"Kind\": \"Literal\",\"Literal\": { \"Kind\": \"Number\", \"Value\": 0} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Undefined\" }},\"RightExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"Divide\", \"LeftExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 0 }, \"RightExpression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 10} }, \"Index\": 2},\"Index\": 1 }}}}]}}, {\"Name\": \"F2\",\"Expression\": { \"Kind\": \"ObjectCreate\", \"ObjectKind\": \"Object\", \"Properties\": [{ \"Name\": \"OtherFieldA\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 0 }},{ \"Name\": \"OtherFieldMax\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 10 }},\"Index\": 3 }} ]} }] }, \"SourceExpression\": {\"Kind\": \"GroupBy\",\"KeyCount\": 1,\"Aggregates\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Tuple\",\"Items\": [ {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Sum\" }] }, {\"Kind\": \"Builtin\",\"OperatorKind\": \"Max\" }],\"SourceExpression\": { \"Kind\": \"Select\", \"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 16 }, \"Expression\": {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 0 }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 1 }, \"Index\": 0} }, {\"Kind\": \"TupleCreate\",\"Items\": [ {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 0 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 2 }, \"Index\": 0} }, {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"VariableRef\",\"Variable\": { \"Name\": \"v0\", \"UniqueId\": 16} }, \"Index\": 2},\"Index\": 1 }] }, {\"Kind\": \"Mux\",\"ConditionExpression\": { \"Kind\": \"BinaryOperator\", \"OperatorKind\": \"And\", \"LeftExpression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"NotEqual\",\"LeftExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 1},\"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Number\",\"Value\": 0 }} }, \"RightExpression\": {\"Kind\": \"UnaryOperator\",\"OperatorKind\": \"Not\",\"Expression\": { \"Kind\": \"SystemFunctionCall\", \"FunctionKind\": \"Is_Defined\", \"Arguments\": [{ \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16 }},\"Index\": 3 }, \"Index\": 0} ]} }},\"LeftExpression\": { \"Kind\": \"Literal\", \"Literal\": {\"Kind\": \"Array\",\"Items\": [] }},\"RightExpression\": { \"Kind\": \"TupleItemRef\", \"Expression\": {\"Kind\": \"TupleItemRef\",\"Expression\": { \"Kind\": \"VariableRef\", \"Variable\": {\"Name\": \"v0\",\"UniqueId\": 16}},\"Index\": 3}, \"Index\": 0}}]}, \"SourceExpression\": {\"Kind\": \"Input\",\"Name\": \"root\"}}}}}}"), CreateInput( description: @"Select, Sum and VariableRef Expressions", - clientPlanJson: "{\"clientDistributionPlan\": {\"clientQL\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a_plus_five\",\"Expression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"Add\",\"LeftExpression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6 }}, \"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": { \"Kind\": \"Number\", \"Value\": 5 }}}}]}, \"SourceExpression\": { \"Kind\": \"Aggregate\", \"Aggregate\": { \"Kind\": \"Builtin\", \"OperatorKind\": \"Sum\" }, \"SourceExpression\": { \"Kind\": \"Input\", \"Name\": \"root\" }}}}}"), + clientPlanJson: "{\"clientDistributionPlan\": {\"Cql\": {\"Kind\": \"Select\",\"DeclaredVariable\": {\"Name\": \"v0\",\"UniqueId\": 6},\"Expression\": {\"Kind\": \"ObjectCreate\",\"ObjectKind\": \"Object\",\"Properties\": [{\"Name\": \"count_a_plus_five\",\"Expression\": {\"Kind\": \"BinaryOperator\",\"OperatorKind\": \"Add\",\"LeftExpression\": {\"Kind\": \"VariableRef\",\"Variable\": {\"Name\": \"v0\",\"UniqueId\": 6 }}, \"RightExpression\": { \"Kind\": \"Literal\", \"Literal\": { \"Kind\": \"Number\", \"Value\": 5 }}}}]}, \"SourceExpression\": { \"Kind\": \"Aggregate\", \"Aggregate\": { \"Kind\": \"Builtin\", \"OperatorKind\": \"Sum\" }, \"SourceExpression\": { \"Kind\": \"Input\", \"Name\": \"root\" }}}}}"), }; this.ExecuteTestSuite(testVariations); From dd6035c2bc48a30aeb68c42443e0945d1a286155 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Mon, 25 Sep 2023 17:45:40 -0700 Subject: [PATCH 36/36] Updated baseline test class property. --- .../Microsoft.Azure.Cosmos.Tests.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Microsoft.Azure.Cosmos.Tests.csproj b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Microsoft.Azure.Cosmos.Tests.csproj index 88450d8984..6f1657f37c 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Microsoft.Azure.Cosmos.Tests.csproj +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Microsoft.Azure.Cosmos.Tests.csproj @@ -79,6 +79,9 @@ + + PreserveNewest + PreserveNewest