Skip to content

Commit 4c82ee6

Browse files
leminh98Minh Le
andauthored
[Internal] Query: Adds missing function names SqlIdentifier for SQL DOM (#5262)
# Pull Request Template ## Description This PR adds missing constants for function names in SqlIdentifier class. ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [] New feature (non-breaking change which adds functionality) - [] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [] This change requires a documentation update ## Closing issues To automatically close an issue: closes #IssueNumber --------- Co-authored-by: Minh Le <leminh@microsoft.com>
1 parent 523d8d8 commit 4c82ee6

3 files changed

Lines changed: 970 additions & 59 deletions

File tree

Microsoft.Azure.Cosmos/src/SqlObjects/SqlFunctionCallScalarExpression.cs

Lines changed: 87 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,24 @@ public static class Names
249249
public const string InternalStDistance = "_ST_DISTANCE";
250250
public const string InternalStIntersects = "_ST_INTERSECTS";
251251
public const string InternalStWithin = "_ST_WITHIN";
252-
public const string InternalTryArrayContains = "_TRY_ARRAY_CONTAINS";
252+
public const string InternalTryArrayContains = "_TRY_ARRAY_CONTAINS";
253+
253254
public const string Abs = "ABS";
254255
public const string Acos = "ACOS";
255256
public const string All = "ALL";
256257
public const string Any = "ANY";
257-
public const string Array = "ARRAY";
258+
public const string Array = "ARRAY";
259+
public const string ArrayAvg = "ARRAY_AVG";
258260
public const string ArrayConcat = "ARRAY_CONCAT";
259-
public const string ArrayContains = "ARRAY_CONTAINS";
260-
public const string ArrayLength = "ARRAY_LENGTH";
261-
public const string ArraySlice = "ARRAY_SLICE";
261+
public const string ArrayContains = "ARRAY_CONTAINS";
262+
public const string ArrayContainsAll = "ARRAY_CONTAINS_ALL";
263+
public const string ArrayContainsAny = "ARRAY_CONTAINS_ANY";
264+
public const string ArrayLength = "ARRAY_LENGTH";
265+
public const string ArrayMax = "ARRAY_MAX";
266+
public const string ArrayMedian = "ARRAY_MEDIAN";
267+
public const string ArrayMin = "ARRAY_MIN";
268+
public const string ArraySlice = "ARRAY_SLICE";
269+
public const string ArraySum = "ARRAY_SUM";
262270
public const string Asin = "ASIN";
263271
public const string Atan = "ATAN";
264272
public const string Atn2 = "ATN2";
@@ -282,18 +290,26 @@ public static class Names
282290
public const string Tuple = "C_TUPLE";
283291
public const string Udt = "C_UDT";
284292
public const string UInt32 = "C_UINT32";
285-
public const string Ceiling = "CEILING";
293+
public const string Ceiling = "CEILING";
294+
public const string Choose = "CHOOSE";
286295
public const string Concat = "CONCAT";
287-
public const string Contains = "CONTAINS";
296+
public const string Contains = "CONTAINS";
297+
public const string ContainsAllCi = "ContainsAllCi";
298+
public const string ContainsAllCs = "ContainsAllCs";
299+
public const string ContainsAnyCi = "ContainsAnyCi";
300+
public const string ContainsAnyCs = "ContainsAnyCs";
288301
public const string Cos = "COS";
289302
public const string Cot = "COT";
290303
public const string Count = "COUNT";
291-
public const string DateTimeAdd = "DateTimeAdd";
292-
public const string DateTimeDiff = "DateTimeDiff";
304+
public const string DateTimeAdd = "DateTimeAdd";
305+
public const string DateTimeBin = "DateTimeBin";
306+
public const string DateTimeDiff = "DateTimeDiff";
307+
public const string DateTimeFormat = "DateTimeFormat";
293308
public const string DateTimeFromParts = "DateTimeFromParts";
294309
public const string DateTimePart = "DateTimePart";
295310
public const string DateTimeToTicks = "DateTimeToTicks";
296-
public const string DateTimeToTimestamp = "DateTimeToTimestamp";
311+
public const string DateTimeToTimestamp = "DateTimeToTimestamp";
312+
public const string Day = "DAY";
297313
public const string Degrees = "DEGREES";
298314
public const string Documentid = "DOCUMENTID";
299315
public const string Endswith = "ENDSWITH";
@@ -305,7 +321,8 @@ public static class Names
305321
public const string FullTextScore = "FullTextScore";
306322
public const string GetCurrentDateTime = "GetCurrentDateTime";
307323
public const string GetCurrentTicks = "GetCurrentTicks";
308-
public const string GetCurrentTimestamp = "GetCurrentTimestamp";
324+
public const string GetCurrentTimestamp = "GetCurrentTimestamp";
325+
public const string Iif = "IIF";
309326
public const string IndexOf = "INDEX_OF";
310327
public const string IntAdd = "IntAdd";
311328
public const string IntBitwiseAnd = "IntBitwiseAnd";
@@ -319,15 +336,17 @@ public static class Names
319336
public const string IntMul = "IntMul";
320337
public const string IntSub = "IntSub";
321338
public const string IsArray = "IS_ARRAY";
322-
public const string IsBool = "IS_BOOL";
339+
public const string IsBool = "IS_BOOL";
340+
public const string IsDateTime = "IS_DATETIME";
323341
public const string IsDefined = "IS_DEFINED";
324342
public const string IsFiniteNumber = "IS_FINITE_NUMBER";
325343
public const string IsInteger = "IS_INTEGER";
326344
public const string IsNull = "IS_NULL";
327345
public const string IsNumber = "IS_NUMBER";
328346
public const string IsObject = "IS_OBJECT";
329347
public const string IsPrimitive = "IS_PRIMITIVE";
330-
public const string IsString = "IS_STRING";
348+
public const string IsString = "IS_STRING";
349+
public const string LastIndexOf = "LastIndexOf";
331350
public const string Left = "LEFT";
332351
public const string Length = "LENGTH";
333352
public const string Like = "LIKE";
@@ -336,7 +355,8 @@ public static class Names
336355
public const string Lower = "LOWER";
337356
public const string Ltrim = "LTRIM";
338357
public const string Max = "MAX";
339-
public const string Min = "MIN";
358+
public const string Min = "MIN";
359+
public const string Month = "MONTH";
340360
public const string ObjectToArray = "ObjectToArray";
341361
public const string Pi = "PI";
342362
public const string Power = "POWER";
@@ -349,7 +369,11 @@ public static class Names
349369
public const string Right = "RIGHT";
350370
public const string Round = "ROUND";
351371
public const string RRF = "RRF";
352-
public const string Rtrim = "RTRIM";
372+
public const string Rtrim = "RTRIM";
373+
public const string SetDifference = "SetDifference";
374+
public const string SetEqual = "SetEqual";
375+
public const string SetIntersect = "SetIntersect";
376+
public const string SetUnion = "SetUnion";
353377
public const string Sign = "SIGN";
354378
public const string Sin = "SIN";
355379
public const string Sqrt = "SQRT";
@@ -360,7 +384,9 @@ public static class Names
360384
public const string StIsvalid = "ST_ISVALID";
361385
public const string StIsvaliddetailed = "ST_ISVALIDDETAILED";
362386
public const string StWithin = "ST_WITHIN";
363-
public const string StringEquals = "StringEquals";
387+
public const string StringEquals = "StringEquals";
388+
public const string StringJoin = "StringJoin";
389+
public const string StringSplit = "StringSplit";
364390
public const string StringToArray = "StringToArray";
365391
public const string StringToBoolean = "StringToBoolean";
366392
public const string StringToNull = "StringToNull";
@@ -377,7 +403,8 @@ public static class Names
377403
public const string Trim = "TRIM";
378404
public const string Trunc = "TRUNC";
379405
public const string Upper = "UPPER";
380-
public const string VectorDistance = "VectorDistance";
406+
public const string VectorDistance = "VectorDistance";
407+
public const string Year = "YEAR";
381408
}
382409

383410
public static class Identifiers
@@ -403,11 +430,18 @@ public static class Identifiers
403430
public static readonly SqlIdentifier Acos = SqlIdentifier.Create(Names.Acos);
404431
public static readonly SqlIdentifier All = SqlIdentifier.Create(Names.All);
405432
public static readonly SqlIdentifier Any = SqlIdentifier.Create(Names.Any);
406-
public static readonly SqlIdentifier Array = SqlIdentifier.Create(Names.Array);
433+
public static readonly SqlIdentifier Array = SqlIdentifier.Create(Names.Array);
434+
public static readonly SqlIdentifier ArrayAvg = SqlIdentifier.Create(Names.ArrayAvg);
407435
public static readonly SqlIdentifier ArrayConcat = SqlIdentifier.Create(Names.ArrayConcat);
408-
public static readonly SqlIdentifier ArrayContains = SqlIdentifier.Create(Names.ArrayContains);
409-
public static readonly SqlIdentifier ArrayLength = SqlIdentifier.Create(Names.ArrayLength);
410-
public static readonly SqlIdentifier ArraySlice = SqlIdentifier.Create(Names.ArraySlice);
436+
public static readonly SqlIdentifier ArrayContains = SqlIdentifier.Create(Names.ArrayContains);
437+
public static readonly SqlIdentifier ArrayContainsAll = SqlIdentifier.Create(Names.ArrayContainsAll);
438+
public static readonly SqlIdentifier ArrayContainsAny = SqlIdentifier.Create(Names.ArrayContainsAny);
439+
public static readonly SqlIdentifier ArrayLength = SqlIdentifier.Create(Names.ArrayLength);
440+
public static readonly SqlIdentifier ArrayMax = SqlIdentifier.Create(Names.ArrayMax);
441+
public static readonly SqlIdentifier ArrayMedian = SqlIdentifier.Create(Names.ArrayMedian);
442+
public static readonly SqlIdentifier ArrayMin = SqlIdentifier.Create(Names.ArrayMin);
443+
public static readonly SqlIdentifier ArraySlice = SqlIdentifier.Create(Names.ArraySlice);
444+
public static readonly SqlIdentifier ArraySum = SqlIdentifier.Create(Names.ArraySum);
411445
public static readonly SqlIdentifier Asin = SqlIdentifier.Create(Names.Asin);
412446
public static readonly SqlIdentifier Atan = SqlIdentifier.Create(Names.Atan);
413447
public static readonly SqlIdentifier Atn2 = SqlIdentifier.Create(Names.Atn2);
@@ -431,18 +465,26 @@ public static class Identifiers
431465
public static readonly SqlIdentifier Tuple = SqlIdentifier.Create(Names.Tuple);
432466
public static readonly SqlIdentifier Udt = SqlIdentifier.Create(Names.Udt);
433467
public static readonly SqlIdentifier UInt32 = SqlIdentifier.Create(Names.UInt32);
434-
public static readonly SqlIdentifier Ceiling = SqlIdentifier.Create(Names.Ceiling);
468+
public static readonly SqlIdentifier Ceiling = SqlIdentifier.Create(Names.Ceiling);
469+
public static readonly SqlIdentifier Choose = SqlIdentifier.Create(Names.Choose);
435470
public static readonly SqlIdentifier Concat = SqlIdentifier.Create(Names.Concat);
436-
public static readonly SqlIdentifier Contains = SqlIdentifier.Create(Names.Contains);
471+
public static readonly SqlIdentifier Contains = SqlIdentifier.Create(Names.Contains);
472+
public static readonly SqlIdentifier ContainsAllCi = SqlIdentifier.Create(Names.ContainsAllCi);
473+
public static readonly SqlIdentifier ContainsAllCs = SqlIdentifier.Create(Names.ContainsAllCs);
474+
public static readonly SqlIdentifier ContainsAnyCi = SqlIdentifier.Create(Names.ContainsAnyCi);
475+
public static readonly SqlIdentifier ContainsAnyCs = SqlIdentifier.Create(Names.ContainsAnyCs);
437476
public static readonly SqlIdentifier Cos = SqlIdentifier.Create(Names.Cos);
438477
public static readonly SqlIdentifier Cot = SqlIdentifier.Create(Names.Cot);
439478
public static readonly SqlIdentifier Count = SqlIdentifier.Create(Names.Count);
440-
public static readonly SqlIdentifier DateTimeAdd = SqlIdentifier.Create(Names.DateTimeAdd);
441-
public static readonly SqlIdentifier DateTimeDiff = SqlIdentifier.Create(Names.DateTimeDiff);
479+
public static readonly SqlIdentifier DateTimeAdd = SqlIdentifier.Create(Names.DateTimeAdd);
480+
public static readonly SqlIdentifier DateTimeBin = SqlIdentifier.Create(Names.DateTimeBin);
481+
public static readonly SqlIdentifier DateTimeDiff = SqlIdentifier.Create(Names.DateTimeDiff);
482+
public static readonly SqlIdentifier DateTimeFormat = SqlIdentifier.Create(Names.DateTimeFormat);
442483
public static readonly SqlIdentifier DateTimeFromParts = SqlIdentifier.Create(Names.DateTimeFromParts);
443484
public static readonly SqlIdentifier DateTimePart = SqlIdentifier.Create(Names.DateTimePart);
444485
public static readonly SqlIdentifier DateTimeToTicks = SqlIdentifier.Create(Names.DateTimeToTicks);
445-
public static readonly SqlIdentifier DateTimeToTimestamp = SqlIdentifier.Create(Names.DateTimeToTimestamp);
486+
public static readonly SqlIdentifier DateTimeToTimestamp = SqlIdentifier.Create(Names.DateTimeToTimestamp);
487+
public static readonly SqlIdentifier Day = SqlIdentifier.Create(Names.Day);
446488
public static readonly SqlIdentifier Degrees = SqlIdentifier.Create(Names.Degrees);
447489
public static readonly SqlIdentifier Documentid = SqlIdentifier.Create(Names.Documentid);
448490
public static readonly SqlIdentifier Endswith = SqlIdentifier.Create(Names.Endswith);
@@ -454,7 +496,8 @@ public static class Identifiers
454496
public static readonly SqlIdentifier FullTextScore = SqlIdentifier.Create(Names.FullTextScore);
455497
public static readonly SqlIdentifier GetCurrentDateTime = SqlIdentifier.Create(Names.GetCurrentDateTime);
456498
public static readonly SqlIdentifier GetCurrentTicks = SqlIdentifier.Create(Names.GetCurrentTicks);
457-
public static readonly SqlIdentifier GetCurrentTimestamp = SqlIdentifier.Create(Names.GetCurrentTimestamp);
499+
public static readonly SqlIdentifier GetCurrentTimestamp = SqlIdentifier.Create(Names.GetCurrentTimestamp);
500+
public static readonly SqlIdentifier Iif = SqlIdentifier.Create(Names.Iif);
458501
public static readonly SqlIdentifier IndexOf = SqlIdentifier.Create(Names.IndexOf);
459502
public static readonly SqlIdentifier IntAdd = SqlIdentifier.Create(Names.IntAdd);
460503
public static readonly SqlIdentifier IntBitwiseAnd = SqlIdentifier.Create(Names.IntBitwiseAnd);
@@ -468,15 +511,17 @@ public static class Identifiers
468511
public static readonly SqlIdentifier IntMul = SqlIdentifier.Create(Names.IntMul);
469512
public static readonly SqlIdentifier IntSub = SqlIdentifier.Create(Names.IntSub);
470513
public static readonly SqlIdentifier IsArray = SqlIdentifier.Create(Names.IsArray);
471-
public static readonly SqlIdentifier IsBool = SqlIdentifier.Create(Names.IsBool);
514+
public static readonly SqlIdentifier IsBool = SqlIdentifier.Create(Names.IsBool);
515+
public static readonly SqlIdentifier IsDateTime = SqlIdentifier.Create(Names.IsDateTime);
472516
public static readonly SqlIdentifier IsDefined = SqlIdentifier.Create(Names.IsDefined);
473517
public static readonly SqlIdentifier IsFiniteNumber = SqlIdentifier.Create(Names.IsFiniteNumber);
474518
public static readonly SqlIdentifier IsInteger = SqlIdentifier.Create(Names.IsInteger);
475519
public static readonly SqlIdentifier IsNull = SqlIdentifier.Create(Names.IsNull);
476520
public static readonly SqlIdentifier IsNumber = SqlIdentifier.Create(Names.IsNumber);
477521
public static readonly SqlIdentifier IsObject = SqlIdentifier.Create(Names.IsObject);
478522
public static readonly SqlIdentifier IsPrimitive = SqlIdentifier.Create(Names.IsPrimitive);
479-
public static readonly SqlIdentifier IsString = SqlIdentifier.Create(Names.IsString);
523+
public static readonly SqlIdentifier IsString = SqlIdentifier.Create(Names.IsString);
524+
public static readonly SqlIdentifier LastIndexOf = SqlIdentifier.Create(Names.LastIndexOf);
480525
public static readonly SqlIdentifier Left = SqlIdentifier.Create(Names.Left);
481526
public static readonly SqlIdentifier Length = SqlIdentifier.Create(Names.Length);
482527
public static readonly SqlIdentifier Like = SqlIdentifier.Create(Names.Like);
@@ -485,7 +530,8 @@ public static class Identifiers
485530
public static readonly SqlIdentifier Lower = SqlIdentifier.Create(Names.Lower);
486531
public static readonly SqlIdentifier Ltrim = SqlIdentifier.Create(Names.Ltrim);
487532
public static readonly SqlIdentifier Max = SqlIdentifier.Create(Names.Max);
488-
public static readonly SqlIdentifier Min = SqlIdentifier.Create(Names.Min);
533+
public static readonly SqlIdentifier Min = SqlIdentifier.Create(Names.Min);
534+
public static readonly SqlIdentifier Month = SqlIdentifier.Create(Names.Month);
489535
public static readonly SqlIdentifier ObjectToArray = SqlIdentifier.Create(Names.ObjectToArray);
490536
public static readonly SqlIdentifier Pi = SqlIdentifier.Create(Names.Pi);
491537
public static readonly SqlIdentifier Power = SqlIdentifier.Create(Names.Power);
@@ -498,7 +544,11 @@ public static class Identifiers
498544
public static readonly SqlIdentifier Right = SqlIdentifier.Create(Names.Right);
499545
public static readonly SqlIdentifier Round = SqlIdentifier.Create(Names.Round);
500546
public static readonly SqlIdentifier RRF = SqlIdentifier.Create(Names.RRF);
501-
public static readonly SqlIdentifier Rtrim = SqlIdentifier.Create(Names.Rtrim);
547+
public static readonly SqlIdentifier Rtrim = SqlIdentifier.Create(Names.Rtrim);
548+
public static readonly SqlIdentifier SetDifference = SqlIdentifier.Create(Names.SetDifference);
549+
public static readonly SqlIdentifier SetEqual = SqlIdentifier.Create(Names.SetEqual);
550+
public static readonly SqlIdentifier SetIntersect = SqlIdentifier.Create(Names.SetIntersect);
551+
public static readonly SqlIdentifier SetUnion = SqlIdentifier.Create(Names.SetUnion);
502552
public static readonly SqlIdentifier Sign = SqlIdentifier.Create(Names.Sign);
503553
public static readonly SqlIdentifier Sin = SqlIdentifier.Create(Names.Sin);
504554
public static readonly SqlIdentifier Sqrt = SqlIdentifier.Create(Names.Sqrt);
@@ -509,7 +559,9 @@ public static class Identifiers
509559
public static readonly SqlIdentifier StIsvalid = SqlIdentifier.Create(Names.StIsvalid);
510560
public static readonly SqlIdentifier StIsvaliddetailed = SqlIdentifier.Create(Names.StIsvaliddetailed);
511561
public static readonly SqlIdentifier StWithin = SqlIdentifier.Create(Names.StWithin);
512-
public static readonly SqlIdentifier StringEquals = SqlIdentifier.Create(Names.StringEquals);
562+
public static readonly SqlIdentifier StringEquals = SqlIdentifier.Create(Names.StringEquals);
563+
public static readonly SqlIdentifier StringJoin = SqlIdentifier.Create(Names.StringJoin);
564+
public static readonly SqlIdentifier StringSplit = SqlIdentifier.Create(Names.StringSplit);
513565
public static readonly SqlIdentifier StringToArray = SqlIdentifier.Create(Names.StringToArray);
514566
public static readonly SqlIdentifier StringToBoolean = SqlIdentifier.Create(Names.StringToBoolean);
515567
public static readonly SqlIdentifier StringToNull = SqlIdentifier.Create(Names.StringToNull);
@@ -525,7 +577,9 @@ public static class Identifiers
525577
#pragma warning restore CS0108 // Member hides inherited member; missing new keyword
526578
public static readonly SqlIdentifier Trim = SqlIdentifier.Create(Names.Trim);
527579
public static readonly SqlIdentifier Trunc = SqlIdentifier.Create(Names.Trunc);
528-
public static readonly SqlIdentifier Upper = SqlIdentifier.Create(Names.Upper);
580+
public static readonly SqlIdentifier Upper = SqlIdentifier.Create(Names.Upper);
581+
public static readonly SqlIdentifier VectorDistance = SqlIdentifier.Create(Names.VectorDistance);
582+
public static readonly SqlIdentifier Year = SqlIdentifier.Create(Names.Year);
529583
}
530584
}
531585
}

0 commit comments

Comments
 (0)