Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix null values in UDF and UDA fields
  • Loading branch information
SiyaoIsHiding committed Nov 11, 2024
commit 3b05e38585eddfa3739e25c4607a33ae2bbb98a9
2 changes: 1 addition & 1 deletion src/Cassandra.IntegrationTests/Core/UdfTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public void GetFunction_Should_Retrieve_Metadata_Of_Cql_Function_Without_Paramet
Assert.AreEqual(false, func.CalledOnNullInput);
Assert.False(func.Monotonic);
Assert.False(func.Deterministic);
Assert.AreEqual(func.MonotonicOn, new string[0]);
Assert.AreEqual(new string[0], func.MonotonicOn);
}

[Test, TestCase(true), TestCase(false), TestCassandraVersion(2, 2)]
Expand Down
13 changes: 8 additions & 5 deletions src/Cassandra/SchemaParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,7 @@ public override Task<AggregateMetadata> GetAggregateAsync(string keyspaceName, s
StateFunction = row.GetValue<string>("state_func"),
FinalFunction = row.GetValue<string>("final_func"),
InitialCondition = row.GetValue<string>("initcond"),
Deterministic = row.GetColumn("deterministic") != null &&
row.GetValue<bool>("deterministic"),
Deterministic = row.GetValue<Nullable<Boolean>>("deterministic").GetValueOrDefault(false),
Signature = argumentTypes,
StateType = tasks[0].Result,
ReturnType = tasks[1].Result,
Expand Down Expand Up @@ -893,10 +892,14 @@ public override Task<FunctionMetadata> GetFunctionAsync(string keyspaceName, str

if (row.GetColumn("deterministic") != null)
{
// DSE 6.0+
result.Deterministic = row.GetValue<bool>("deterministic");
result.Monotonic = row.GetValue<bool>("monotonic");
// DSE 6.0+ or HCD
result.Deterministic = row.GetValue<Nullable<Boolean>>("deterministic").GetValueOrDefault(false);
result.Monotonic = row.GetValue<Nullable<Boolean>>("monotonic").GetValueOrDefault(false);
result.MonotonicOn = row.GetValue<string[]>("monotonic_on");
if (result.MonotonicOn is null)
{
result.MonotonicOn = new string[0];
}
}

return result;
Expand Down