Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>true</IsPackable>
<PackageId>CosmosDB.InMemoryEmulator.JsTriggers</PackageId>
<Version>2.0.183</Version>
<Version>2.0.185</Version>
<Authors>lemonlion</Authors>
<Description>JavaScript trigger body interpretation for CosmosDB.InMemoryEmulator. Uses Jint to execute real Cosmos DB trigger JavaScript (getContext, getRequest, getResponse, getBody, setBody) inside your in-memory tests.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>true</IsPackable>
<PackageId>CosmosDB.InMemoryEmulator.ProductionExtensions</PackageId>
<Version>2.0.183</Version>
<Version>2.0.185</Version>
<Description>Production-safe extension methods for Azure Cosmos DB that enable seamless in-memory testing via CosmosDB.InMemoryEmulator.</Description>
<AzureCosmosDisableNewtonsoftJsonCheck>true</AzureCosmosDisableNewtonsoftJsonCheck>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>true</IsPackable>
<PackageId>CosmosDB.InMemoryEmulator</PackageId>
<Version>2.0.183</Version>
<Version>2.0.185</Version>
<Authors>lemonlion</Authors>
<Description>A high-fidelity, in-memory implementation of the Azure Cosmos DB SDK for .NET — purpose-built for fast, reliable component and integration testing. Drop-in replacements for CosmosClient, Container, and Database with full CRUD, SQL queries, LINQ, patch, bulk operations, batches, change feed, fault injection, and DI integration. Zero production code changes required with FakeCosmosHandler.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
18 changes: 18 additions & 0 deletions src/CosmosDB.InMemoryEmulator/CosmosSqlParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,24 @@ public static WhereExpression ToWhereExpression(SqlExpression expr)
return new SqlExpressionCondition(func);
}

var hasNestedFunctions = func.Arguments.Any(ContainsFunctionCall);
if (hasNestedFunctions)
{
return new SqlExpressionCondition(func);
}

var hasArithmetic = func.Arguments.Any(ContainsArithmetic);
if (hasArithmetic)
{
return new SqlExpressionCondition(func);
}

var hasComplexExpressions = func.Arguments.Any(ContainsComplexExpression);
if (hasComplexExpressions)
{
return new SqlExpressionCondition(func);
}

if (LegacyFunctionNames.Contains(func.FunctionName))
{
var args = func.Arguments.Select(ExprToString).ToArray();
Expand Down
12 changes: 11 additions & 1 deletion src/CosmosDB.InMemoryEmulator/InMemoryContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5860,6 +5860,11 @@ private static bool EvaluateFunction(
return jArray.Any(t => t.Type == JTokenType.Null);
}

if (searchValue is UndefinedValue)
{
return false;
}

var searchStr = searchValue.ToString();
var partial = func.Arguments.Length >= 3 &&
string.Equals(func.Arguments[2].Trim(), "true", StringComparison.OrdinalIgnoreCase);
Expand Down Expand Up @@ -6210,7 +6215,7 @@ and not "FULLTEXTSCORE" and not "FULLTEXTCONTAINS" and not "FULLTEXTCONTAINSALL"
// (even when its value is null).
if (func.Arguments[0] is ParameterExpression param)
return parameters.ContainsKey(param.Name);
return args[0] != null;
return args[0] is not null and not UndefinedValue;
}
case "IS_NULL": return args.Length > 0 && args[0] is null;
case "IS_ARRAY":
Expand Down Expand Up @@ -6720,6 +6725,11 @@ and not "FULLTEXTSCORE" and not "FULLTEXTCONTAINS" and not "FULLTEXTCONTAINSALL"
return jArray.Any(t => t.Type == JTokenType.Null);
}

if (searchValue is UndefinedValue)
{
return false;
}

var searchStr = searchValue.ToString();
return ArrayContainsMatch(jArray, searchStr, partial);
}
Expand Down
Loading
Loading