You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am getting a 'System.InvalidOperationException: Invalid Expression Type' when I combine certain operators in the Where clause on an AggregationSet.
Very similar to #353 but in my case I use arrays and .Contains. I used the test method added in #365 (AggregationSetTests.cs -> RightBinExpressionOperator) to reproduce this issue as follows:
System.InvalidOperationException: Invalid Expression Type
at Redis.OM.Aggregation.AggregationPredicates.QueryPredicate.ValidateAndPushOperand(Expression expression, Stack`1 stack)
at Redis.OM.Aggregation.AggregationPredicates.QueryPredicate.SplitBinaryExpression(BinaryExpression expression, Stack`1 stack)
at Redis.OM.Common.BooleanExpression.SplitExpression()
at Redis.OM.Aggregation.AggregationPredicates.QueryPredicate.Serialize()
at Redis.OM.Aggregation.RedisAggregation.Serialize()
at Redis.OM.Aggregation.AggregationEnumerator`1.get_SerializedArgs()
at Redis.OM.Aggregation.AggregationEnumerator`1.StartEnumeration()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
While playing around to understand how the expressions are handled, I also found a situation where there is no exception, but the test fails. I've added an example for that as well:
[Fact]
public void RightBinExpressionOperator()
{
var collection = new RedisAggregationSet<Person>(_substitute, true, chunkSize: 10000);
_substitute.Execute("FT.AGGREGATE", Arg.Any<string[]>()).Returns(MockedResult);
_substitute.Execute("FT.CURSOR", Arg.Any<string[]>()).Returns(MockedResultCursorEnd);
var age = 0;
Expression<Func<AggregationResult<Person>, bool>> query = a => a.RecordShell!.Age == age && (a.RecordShell!.Age == age + 2 || a.RecordShell!.Age == age + 50);
_ = collection.Where(query).ToList();
_substitute.Received().Execute("FT.AGGREGATE", "person-idx", "( @Age:[0 0] ( @Age:[2 2] | @Age:[50 50] ) )", "WITHCURSOR", "COUNT", "10000");
}
Not sure if I am supposed to use them another way or if it's a bug. Any help is appreciated, especially for the first scenario. Thank you.
The text was updated successfully, but these errors were encountered:
Hello,
I am getting a 'System.InvalidOperationException: Invalid Expression Type' when I combine certain operators in the Where clause on an AggregationSet.
Very similar to #353 but in my case I use arrays and .Contains. I used the test method added in #365 (AggregationSetTests.cs -> RightBinExpressionOperator) to reproduce this issue as follows:
The exception that I receive:
While playing around to understand how the expressions are handled, I also found a situation where there is no exception, but the test fails. I've added an example for that as well:
Not sure if I am supposed to use them another way or if it's a bug. Any help is appreciated, especially for the first scenario. Thank you.
The text was updated successfully, but these errors were encountered: