diff --git a/Microsoft.Azure.Cosmos/src/SqlObjects/SqlFunctionCallScalarExpression.cs b/Microsoft.Azure.Cosmos/src/SqlObjects/SqlFunctionCallScalarExpression.cs index e234077850..3877256961 100644 --- a/Microsoft.Azure.Cosmos/src/SqlObjects/SqlFunctionCallScalarExpression.cs +++ b/Microsoft.Azure.Cosmos/src/SqlObjects/SqlFunctionCallScalarExpression.cs @@ -249,16 +249,24 @@ public static class Names public const string InternalStDistance = "_ST_DISTANCE"; public const string InternalStIntersects = "_ST_INTERSECTS"; public const string InternalStWithin = "_ST_WITHIN"; - public const string InternalTryArrayContains = "_TRY_ARRAY_CONTAINS"; + public const string InternalTryArrayContains = "_TRY_ARRAY_CONTAINS"; + public const string Abs = "ABS"; public const string Acos = "ACOS"; public const string All = "ALL"; public const string Any = "ANY"; - public const string Array = "ARRAY"; + public const string Array = "ARRAY"; + public const string ArrayAvg = "ARRAY_AVG"; public const string ArrayConcat = "ARRAY_CONCAT"; - public const string ArrayContains = "ARRAY_CONTAINS"; - public const string ArrayLength = "ARRAY_LENGTH"; - public const string ArraySlice = "ARRAY_SLICE"; + public const string ArrayContains = "ARRAY_CONTAINS"; + public const string ArrayContainsAll = "ARRAY_CONTAINS_ALL"; + public const string ArrayContainsAny = "ARRAY_CONTAINS_ANY"; + public const string ArrayLength = "ARRAY_LENGTH"; + public const string ArrayMax = "ARRAY_MAX"; + public const string ArrayMedian = "ARRAY_MEDIAN"; + public const string ArrayMin = "ARRAY_MIN"; + public const string ArraySlice = "ARRAY_SLICE"; + public const string ArraySum = "ARRAY_SUM"; public const string Asin = "ASIN"; public const string Atan = "ATAN"; public const string Atn2 = "ATN2"; @@ -282,18 +290,26 @@ public static class Names public const string Tuple = "C_TUPLE"; public const string Udt = "C_UDT"; public const string UInt32 = "C_UINT32"; - public const string Ceiling = "CEILING"; + public const string Ceiling = "CEILING"; + public const string Choose = "CHOOSE"; public const string Concat = "CONCAT"; - public const string Contains = "CONTAINS"; + public const string Contains = "CONTAINS"; + public const string ContainsAllCi = "ContainsAllCi"; + public const string ContainsAllCs = "ContainsAllCs"; + public const string ContainsAnyCi = "ContainsAnyCi"; + public const string ContainsAnyCs = "ContainsAnyCs"; public const string Cos = "COS"; public const string Cot = "COT"; public const string Count = "COUNT"; - public const string DateTimeAdd = "DateTimeAdd"; - public const string DateTimeDiff = "DateTimeDiff"; + public const string DateTimeAdd = "DateTimeAdd"; + public const string DateTimeBin = "DateTimeBin"; + public const string DateTimeDiff = "DateTimeDiff"; + public const string DateTimeFormat = "DateTimeFormat"; public const string DateTimeFromParts = "DateTimeFromParts"; public const string DateTimePart = "DateTimePart"; public const string DateTimeToTicks = "DateTimeToTicks"; - public const string DateTimeToTimestamp = "DateTimeToTimestamp"; + public const string DateTimeToTimestamp = "DateTimeToTimestamp"; + public const string Day = "DAY"; public const string Degrees = "DEGREES"; public const string Documentid = "DOCUMENTID"; public const string Endswith = "ENDSWITH"; @@ -305,7 +321,8 @@ public static class Names public const string FullTextScore = "FullTextScore"; public const string GetCurrentDateTime = "GetCurrentDateTime"; public const string GetCurrentTicks = "GetCurrentTicks"; - public const string GetCurrentTimestamp = "GetCurrentTimestamp"; + public const string GetCurrentTimestamp = "GetCurrentTimestamp"; + public const string Iif = "IIF"; public const string IndexOf = "INDEX_OF"; public const string IntAdd = "IntAdd"; public const string IntBitwiseAnd = "IntBitwiseAnd"; @@ -319,7 +336,8 @@ public static class Names public const string IntMul = "IntMul"; public const string IntSub = "IntSub"; public const string IsArray = "IS_ARRAY"; - public const string IsBool = "IS_BOOL"; + public const string IsBool = "IS_BOOL"; + public const string IsDateTime = "IS_DATETIME"; public const string IsDefined = "IS_DEFINED"; public const string IsFiniteNumber = "IS_FINITE_NUMBER"; public const string IsInteger = "IS_INTEGER"; @@ -327,7 +345,8 @@ public static class Names public const string IsNumber = "IS_NUMBER"; public const string IsObject = "IS_OBJECT"; public const string IsPrimitive = "IS_PRIMITIVE"; - public const string IsString = "IS_STRING"; + public const string IsString = "IS_STRING"; + public const string LastIndexOf = "LastIndexOf"; public const string Left = "LEFT"; public const string Length = "LENGTH"; public const string Like = "LIKE"; @@ -336,7 +355,8 @@ public static class Names public const string Lower = "LOWER"; public const string Ltrim = "LTRIM"; public const string Max = "MAX"; - public const string Min = "MIN"; + public const string Min = "MIN"; + public const string Month = "MONTH"; public const string ObjectToArray = "ObjectToArray"; public const string Pi = "PI"; public const string Power = "POWER"; @@ -349,7 +369,11 @@ public static class Names public const string Right = "RIGHT"; public const string Round = "ROUND"; public const string RRF = "RRF"; - public const string Rtrim = "RTRIM"; + public const string Rtrim = "RTRIM"; + public const string SetDifference = "SetDifference"; + public const string SetEqual = "SetEqual"; + public const string SetIntersect = "SetIntersect"; + public const string SetUnion = "SetUnion"; public const string Sign = "SIGN"; public const string Sin = "SIN"; public const string Sqrt = "SQRT"; @@ -360,7 +384,9 @@ public static class Names public const string StIsvalid = "ST_ISVALID"; public const string StIsvaliddetailed = "ST_ISVALIDDETAILED"; public const string StWithin = "ST_WITHIN"; - public const string StringEquals = "StringEquals"; + public const string StringEquals = "StringEquals"; + public const string StringJoin = "StringJoin"; + public const string StringSplit = "StringSplit"; public const string StringToArray = "StringToArray"; public const string StringToBoolean = "StringToBoolean"; public const string StringToNull = "StringToNull"; @@ -377,7 +403,8 @@ public static class Names public const string Trim = "TRIM"; public const string Trunc = "TRUNC"; public const string Upper = "UPPER"; - public const string VectorDistance = "VectorDistance"; + public const string VectorDistance = "VectorDistance"; + public const string Year = "YEAR"; } public static class Identifiers @@ -403,11 +430,18 @@ public static class Identifiers public static readonly SqlIdentifier Acos = SqlIdentifier.Create(Names.Acos); public static readonly SqlIdentifier All = SqlIdentifier.Create(Names.All); public static readonly SqlIdentifier Any = SqlIdentifier.Create(Names.Any); - public static readonly SqlIdentifier Array = SqlIdentifier.Create(Names.Array); + public static readonly SqlIdentifier Array = SqlIdentifier.Create(Names.Array); + public static readonly SqlIdentifier ArrayAvg = SqlIdentifier.Create(Names.ArrayAvg); public static readonly SqlIdentifier ArrayConcat = SqlIdentifier.Create(Names.ArrayConcat); - public static readonly SqlIdentifier ArrayContains = SqlIdentifier.Create(Names.ArrayContains); - public static readonly SqlIdentifier ArrayLength = SqlIdentifier.Create(Names.ArrayLength); - public static readonly SqlIdentifier ArraySlice = SqlIdentifier.Create(Names.ArraySlice); + public static readonly SqlIdentifier ArrayContains = SqlIdentifier.Create(Names.ArrayContains); + public static readonly SqlIdentifier ArrayContainsAll = SqlIdentifier.Create(Names.ArrayContainsAll); + public static readonly SqlIdentifier ArrayContainsAny = SqlIdentifier.Create(Names.ArrayContainsAny); + public static readonly SqlIdentifier ArrayLength = SqlIdentifier.Create(Names.ArrayLength); + public static readonly SqlIdentifier ArrayMax = SqlIdentifier.Create(Names.ArrayMax); + public static readonly SqlIdentifier ArrayMedian = SqlIdentifier.Create(Names.ArrayMedian); + public static readonly SqlIdentifier ArrayMin = SqlIdentifier.Create(Names.ArrayMin); + public static readonly SqlIdentifier ArraySlice = SqlIdentifier.Create(Names.ArraySlice); + public static readonly SqlIdentifier ArraySum = SqlIdentifier.Create(Names.ArraySum); public static readonly SqlIdentifier Asin = SqlIdentifier.Create(Names.Asin); public static readonly SqlIdentifier Atan = SqlIdentifier.Create(Names.Atan); public static readonly SqlIdentifier Atn2 = SqlIdentifier.Create(Names.Atn2); @@ -431,18 +465,26 @@ public static class Identifiers public static readonly SqlIdentifier Tuple = SqlIdentifier.Create(Names.Tuple); public static readonly SqlIdentifier Udt = SqlIdentifier.Create(Names.Udt); public static readonly SqlIdentifier UInt32 = SqlIdentifier.Create(Names.UInt32); - public static readonly SqlIdentifier Ceiling = SqlIdentifier.Create(Names.Ceiling); + public static readonly SqlIdentifier Ceiling = SqlIdentifier.Create(Names.Ceiling); + public static readonly SqlIdentifier Choose = SqlIdentifier.Create(Names.Choose); public static readonly SqlIdentifier Concat = SqlIdentifier.Create(Names.Concat); - public static readonly SqlIdentifier Contains = SqlIdentifier.Create(Names.Contains); + public static readonly SqlIdentifier Contains = SqlIdentifier.Create(Names.Contains); + public static readonly SqlIdentifier ContainsAllCi = SqlIdentifier.Create(Names.ContainsAllCi); + public static readonly SqlIdentifier ContainsAllCs = SqlIdentifier.Create(Names.ContainsAllCs); + public static readonly SqlIdentifier ContainsAnyCi = SqlIdentifier.Create(Names.ContainsAnyCi); + public static readonly SqlIdentifier ContainsAnyCs = SqlIdentifier.Create(Names.ContainsAnyCs); public static readonly SqlIdentifier Cos = SqlIdentifier.Create(Names.Cos); public static readonly SqlIdentifier Cot = SqlIdentifier.Create(Names.Cot); public static readonly SqlIdentifier Count = SqlIdentifier.Create(Names.Count); - public static readonly SqlIdentifier DateTimeAdd = SqlIdentifier.Create(Names.DateTimeAdd); - public static readonly SqlIdentifier DateTimeDiff = SqlIdentifier.Create(Names.DateTimeDiff); + public static readonly SqlIdentifier DateTimeAdd = SqlIdentifier.Create(Names.DateTimeAdd); + public static readonly SqlIdentifier DateTimeBin = SqlIdentifier.Create(Names.DateTimeBin); + public static readonly SqlIdentifier DateTimeDiff = SqlIdentifier.Create(Names.DateTimeDiff); + public static readonly SqlIdentifier DateTimeFormat = SqlIdentifier.Create(Names.DateTimeFormat); public static readonly SqlIdentifier DateTimeFromParts = SqlIdentifier.Create(Names.DateTimeFromParts); public static readonly SqlIdentifier DateTimePart = SqlIdentifier.Create(Names.DateTimePart); public static readonly SqlIdentifier DateTimeToTicks = SqlIdentifier.Create(Names.DateTimeToTicks); - public static readonly SqlIdentifier DateTimeToTimestamp = SqlIdentifier.Create(Names.DateTimeToTimestamp); + public static readonly SqlIdentifier DateTimeToTimestamp = SqlIdentifier.Create(Names.DateTimeToTimestamp); + public static readonly SqlIdentifier Day = SqlIdentifier.Create(Names.Day); public static readonly SqlIdentifier Degrees = SqlIdentifier.Create(Names.Degrees); public static readonly SqlIdentifier Documentid = SqlIdentifier.Create(Names.Documentid); public static readonly SqlIdentifier Endswith = SqlIdentifier.Create(Names.Endswith); @@ -454,7 +496,8 @@ public static class Identifiers public static readonly SqlIdentifier FullTextScore = SqlIdentifier.Create(Names.FullTextScore); public static readonly SqlIdentifier GetCurrentDateTime = SqlIdentifier.Create(Names.GetCurrentDateTime); public static readonly SqlIdentifier GetCurrentTicks = SqlIdentifier.Create(Names.GetCurrentTicks); - public static readonly SqlIdentifier GetCurrentTimestamp = SqlIdentifier.Create(Names.GetCurrentTimestamp); + public static readonly SqlIdentifier GetCurrentTimestamp = SqlIdentifier.Create(Names.GetCurrentTimestamp); + public static readonly SqlIdentifier Iif = SqlIdentifier.Create(Names.Iif); public static readonly SqlIdentifier IndexOf = SqlIdentifier.Create(Names.IndexOf); public static readonly SqlIdentifier IntAdd = SqlIdentifier.Create(Names.IntAdd); public static readonly SqlIdentifier IntBitwiseAnd = SqlIdentifier.Create(Names.IntBitwiseAnd); @@ -468,7 +511,8 @@ public static class Identifiers public static readonly SqlIdentifier IntMul = SqlIdentifier.Create(Names.IntMul); public static readonly SqlIdentifier IntSub = SqlIdentifier.Create(Names.IntSub); public static readonly SqlIdentifier IsArray = SqlIdentifier.Create(Names.IsArray); - public static readonly SqlIdentifier IsBool = SqlIdentifier.Create(Names.IsBool); + public static readonly SqlIdentifier IsBool = SqlIdentifier.Create(Names.IsBool); + public static readonly SqlIdentifier IsDateTime = SqlIdentifier.Create(Names.IsDateTime); public static readonly SqlIdentifier IsDefined = SqlIdentifier.Create(Names.IsDefined); public static readonly SqlIdentifier IsFiniteNumber = SqlIdentifier.Create(Names.IsFiniteNumber); public static readonly SqlIdentifier IsInteger = SqlIdentifier.Create(Names.IsInteger); @@ -476,7 +520,8 @@ public static class Identifiers public static readonly SqlIdentifier IsNumber = SqlIdentifier.Create(Names.IsNumber); public static readonly SqlIdentifier IsObject = SqlIdentifier.Create(Names.IsObject); public static readonly SqlIdentifier IsPrimitive = SqlIdentifier.Create(Names.IsPrimitive); - public static readonly SqlIdentifier IsString = SqlIdentifier.Create(Names.IsString); + public static readonly SqlIdentifier IsString = SqlIdentifier.Create(Names.IsString); + public static readonly SqlIdentifier LastIndexOf = SqlIdentifier.Create(Names.LastIndexOf); public static readonly SqlIdentifier Left = SqlIdentifier.Create(Names.Left); public static readonly SqlIdentifier Length = SqlIdentifier.Create(Names.Length); public static readonly SqlIdentifier Like = SqlIdentifier.Create(Names.Like); @@ -485,7 +530,8 @@ public static class Identifiers public static readonly SqlIdentifier Lower = SqlIdentifier.Create(Names.Lower); public static readonly SqlIdentifier Ltrim = SqlIdentifier.Create(Names.Ltrim); public static readonly SqlIdentifier Max = SqlIdentifier.Create(Names.Max); - public static readonly SqlIdentifier Min = SqlIdentifier.Create(Names.Min); + public static readonly SqlIdentifier Min = SqlIdentifier.Create(Names.Min); + public static readonly SqlIdentifier Month = SqlIdentifier.Create(Names.Month); public static readonly SqlIdentifier ObjectToArray = SqlIdentifier.Create(Names.ObjectToArray); public static readonly SqlIdentifier Pi = SqlIdentifier.Create(Names.Pi); public static readonly SqlIdentifier Power = SqlIdentifier.Create(Names.Power); @@ -498,7 +544,11 @@ public static class Identifiers public static readonly SqlIdentifier Right = SqlIdentifier.Create(Names.Right); public static readonly SqlIdentifier Round = SqlIdentifier.Create(Names.Round); public static readonly SqlIdentifier RRF = SqlIdentifier.Create(Names.RRF); - public static readonly SqlIdentifier Rtrim = SqlIdentifier.Create(Names.Rtrim); + public static readonly SqlIdentifier Rtrim = SqlIdentifier.Create(Names.Rtrim); + public static readonly SqlIdentifier SetDifference = SqlIdentifier.Create(Names.SetDifference); + public static readonly SqlIdentifier SetEqual = SqlIdentifier.Create(Names.SetEqual); + public static readonly SqlIdentifier SetIntersect = SqlIdentifier.Create(Names.SetIntersect); + public static readonly SqlIdentifier SetUnion = SqlIdentifier.Create(Names.SetUnion); public static readonly SqlIdentifier Sign = SqlIdentifier.Create(Names.Sign); public static readonly SqlIdentifier Sin = SqlIdentifier.Create(Names.Sin); public static readonly SqlIdentifier Sqrt = SqlIdentifier.Create(Names.Sqrt); @@ -509,7 +559,9 @@ public static class Identifiers public static readonly SqlIdentifier StIsvalid = SqlIdentifier.Create(Names.StIsvalid); public static readonly SqlIdentifier StIsvaliddetailed = SqlIdentifier.Create(Names.StIsvaliddetailed); public static readonly SqlIdentifier StWithin = SqlIdentifier.Create(Names.StWithin); - public static readonly SqlIdentifier StringEquals = SqlIdentifier.Create(Names.StringEquals); + public static readonly SqlIdentifier StringEquals = SqlIdentifier.Create(Names.StringEquals); + public static readonly SqlIdentifier StringJoin = SqlIdentifier.Create(Names.StringJoin); + public static readonly SqlIdentifier StringSplit = SqlIdentifier.Create(Names.StringSplit); public static readonly SqlIdentifier StringToArray = SqlIdentifier.Create(Names.StringToArray); public static readonly SqlIdentifier StringToBoolean = SqlIdentifier.Create(Names.StringToBoolean); public static readonly SqlIdentifier StringToNull = SqlIdentifier.Create(Names.StringToNull); @@ -525,7 +577,9 @@ public static class Identifiers #pragma warning restore CS0108 // Member hides inherited member; missing new keyword public static readonly SqlIdentifier Trim = SqlIdentifier.Create(Names.Trim); public static readonly SqlIdentifier Trunc = SqlIdentifier.Create(Names.Trunc); - public static readonly SqlIdentifier Upper = SqlIdentifier.Create(Names.Upper); + public static readonly SqlIdentifier Upper = SqlIdentifier.Create(Names.Upper); + public static readonly SqlIdentifier VectorDistance = SqlIdentifier.Create(Names.VectorDistance); + public static readonly SqlIdentifier Year = SqlIdentifier.Create(Names.Year); } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlFunctionCalls.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlFunctionCalls.xml index d40ced7026..c96170c087 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlFunctionCalls.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/SqlObjectVisitorBaselineTests.SqlFunctionCalls.xml @@ -739,6 +739,50 @@ ARRAY(42) + + + ARRAY_AVG + + + + + + 323897902 + + + ARRAY_CONCAT @@ -1975,17 +2019,17 @@ COUNT(42) "Arguments": [ { "Literal": { - "Value": "Year" + "Value": "yyyy" } }, { "Literal": { - "Value": 2020 + "Value": 1 } }, { "Literal": { - "Value": "YYYY" + "Value": "2020-08-06T20:45:22.1234567Z" } } ], @@ -1993,16 +2037,84 @@ COUNT(42) }]]> - + + 1610287731 + + + + + + DateTimeBin + + + + + + -2042557462 + + + + + + DateTimeFormat + + + + + - 1570860718 - + -366443220 + @@ -2010,7 +2122,7 @@ DateTimeAdd( DateTimeDiff - + - 702180380 - + -1313869462 + @@ -2171,6 +2283,32 @@ DateTimeToTimestamp("2020-08-06T20:45:22.1234567Z") + + + DAY + + + + + + 730252520 + + + DEGREES @@ -2369,6 +2507,46 @@ GetCurrentTimestamp() + + + IIF + + + + + + 1912853209 + + + INDEX_OF @@ -2455,6 +2633,32 @@ IS_BOOL(true) + + + IS_DATETIME + + + + + + -1529891165 + + + IS_DEFINED @@ -2635,6 +2839,40 @@ IS_STRING("hello") + + + LastIndexOf + + + + + + -1618285648 + + + LEFT @@ -2891,6 +3129,32 @@ MIN(42) + + + MONTH + + + + + + -1384364250 + + + ObjectToArray @@ -3203,25 +3467,305 @@ RTRIM(42) - SIGN + SetDifference - + + 1109260146 + + + + + + SetEqual + + + + + + -2058439928 + + + + + + SetIntersect + + + + + + -644124670 + + + + + + SetUnion + + + + + + 1177661016 + + + + + + SIGN + + + + + 1835961124 @@ -3527,6 +4071,92 @@ StringEquals( + + + StringJoin + + + + + + 379070440 + + + + + + StringSplit + + + + + + 1939927191 + + + StringToArray @@ -3905,4 +4535,100 @@ UPPER(42) + + + VectorDistance + + + + + + 341383158 + + + + + + YEAR + + + + + + 1895825496 + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SqlObjects/SqlObjectVisitorBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SqlObjects/SqlObjectVisitorBaselineTests.cs index 541d6034fa..cba3cfb796 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SqlObjects/SqlObjectVisitorBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SqlObjects/SqlObjectVisitorBaselineTests.cs @@ -12,6 +12,9 @@ namespace Microsoft.Azure.Cosmos.Test.SqlObjects using System.Text.RegularExpressions; using System.Xml; using BaselineTest; + using Microsoft.Azure.Cosmos.CosmosElements; + using Microsoft.Azure.Cosmos.CosmosElements.Numbers; + using Microsoft.Azure.Cosmos.Query.Core.ClientDistributionPlan.Cql; using Microsoft.Azure.Cosmos.SqlObjects; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; @@ -401,6 +404,14 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Array, SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.ArrayAvg, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.ArrayAvg, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.ArrayConcat, SqlFunctionCallScalarExpression.CreateBuiltin( @@ -628,13 +639,25 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Names.DateTimeAdd, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.DateTimeAdd, - SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("Year")), - SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2020)), - SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("YYYY")))), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("yyyy")), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.DateTimeBin, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.DateTimeBin, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("yyyy")))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.DateTimeFormat, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.DateTimeFormat, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("(h-hh-hhh)")))), new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.DateTimeDiff, SqlFunctionCallScalarExpression.CreateBuiltin( - SqlFunctionCallScalarExpression.Identifiers.DateTimeAdd, + SqlFunctionCallScalarExpression.Identifiers.DateTimeDiff, SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("Year")), SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")), SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), @@ -662,6 +685,11 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.DateTimeToTimestamp, SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.Day, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.Day, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.Degrees, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Degrees, @@ -700,6 +728,13 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.GetCurrentTimestamp)), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.Iif, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.Iif, + SqlLiteralScalarExpression.Create(SqlBooleanLiteral.Create(true)), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("YES")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("NO")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.IndexOf, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.IndexOf, @@ -716,6 +751,11 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.IsBool, SqlLiteralScalarExpression.Create(SqlBooleanLiteral.Create(true)))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.IsDateTime, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.IsDateTime, + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.IsDefined, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.IsDefined, @@ -751,6 +791,12 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.IsString, SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hello")))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.LastIndexOf, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.LastIndexOf, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("ABCDABCDABC")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("ABC")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.Left, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Left, @@ -799,6 +845,11 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.Min, SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.Month, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.Month, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.ObjectToArray, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.ObjectToArray, @@ -857,6 +908,54 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Identifiers.Rtrim, SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.SetDifference, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.SetDifference, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.SetEqual, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.SetEqual, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.SetIntersect, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.SetIntersect, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.SetUnion, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.SetUnion, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.Sign, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Sign, @@ -917,6 +1016,21 @@ public void SqlFunctionCalls() SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hi")), SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hello")))), new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.StringJoin, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.StringJoin, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("a")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("b")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("c"))), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hello")))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.StringSplit, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.StringSplit, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("hello")), + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("e")))), + new SqlObjectVisitorInput( SqlFunctionCallScalarExpression.Names.StringToArray, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.StringToArray, @@ -987,7 +1101,24 @@ public void SqlFunctionCalls() SqlFunctionCallScalarExpression.Names.Upper, SqlFunctionCallScalarExpression.CreateBuiltin( SqlFunctionCallScalarExpression.Identifiers.Upper, - SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))) + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(42)))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.VectorDistance, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.VectorDistance, + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))), + SqlArrayCreateScalarExpression.Create( + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(1)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(2)), + SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3))))), + new SqlObjectVisitorInput( + SqlFunctionCallScalarExpression.Names.Year, + SqlFunctionCallScalarExpression.CreateBuiltin( + SqlFunctionCallScalarExpression.Identifiers.Year, + SqlLiteralScalarExpression.Create(SqlStringLiteral.Create("2020-08-06T20:45:22.1234567Z")))), }; this.ExecuteTestSuite(inputs);