-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CSHARP-5730: Support static String.Compare method #1789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
var strATranslation = ExpressionToAggregationExpressionTranslator.Translate(context, strAExpression); | ||
var strBExpression = arguments[1]; | ||
var strBTranslation = ExpressionToAggregationExpressionTranslator.Translate(context, strBExpression); | ||
var ast = AstExpression.Cmp(strATranslation.Ast, strBTranslation.Ast); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add support for case insensitive/more overloads comparison by translating to $strcasecmp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose if we do this, we will have to support this compare overload -> https://learn.microsoft.com/en-us/dotnet/api/system.string.compare?view=net-9.0#system-string-compare(system-string-system-string-system-boolean)
var strATranslation = ExpressionToAggregationExpressionTranslator.Translate(context, strAExpression); | ||
var strBExpression = arguments[1]; | ||
var strBTranslation = ExpressionToAggregationExpressionTranslator.Translate(context, strBExpression); | ||
var ast = AstExpression.Cmp(strATranslation.Ast, strBTranslation.Ast); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose if we do this, we will have to support this compare overload -> https://learn.microsoft.com/en-us/dotnet/api/system.string.compare?view=net-9.0#system-string-compare(system-string-system-string-system-boolean)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this class was extended to support the static string.Compare
method, it seems its name is a bit outdated now? I would suggest updating the class name though I don't have a good suggestion maybe StringComparisonExpressionToFilterTranslator
?
throw new ExpressionNotSupportedException(expression); | ||
} | ||
|
||
private static bool IsStaticCompareMethod(MethodInfo method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IsStaticCompareMethod
doesn't actually check if the method is named "Compare". I doubt this is intentional?
No description provided.