-
Notifications
You must be signed in to change notification settings - Fork 180
Return comparable LinkedHashMap in valueForCalcite() of ExprTupleValue
#4629
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
Return comparable LinkedHashMap in valueForCalcite() of ExprTupleValue
#4629
Conversation
Signed-off-by: Lantao Jin <[email protected]>
| V thisFirstValue = this.values().iterator().next(); | ||
| V otherFirstValue = other.values().iterator().next(); | ||
|
|
||
| if (thisFirstValue instanceof Comparable) { |
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.
Only comparing the first element?
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.
changed to compare recursively
Signed-off-by: Lantao Jin <[email protected]>
| public void testDifferentFirstValue() { | ||
| ComparableLinkedHashMap<String, Integer> map1 = new ComparableLinkedHashMap<>(); | ||
| map1.put("a", 1); | ||
| map1.put("b", 2); | ||
|
|
||
| ComparableLinkedHashMap<String, Integer> map2 = new ComparableLinkedHashMap<>(); | ||
| map2.put("c", 3); | ||
| map2.put("d", 2); | ||
|
|
||
| assertTrue(map1.compareTo(map2) < 0); | ||
| assertTrue(map2.compareTo(map1) > 0); | ||
| } |
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.
Can the keys of ExprTupleValues be ignored? Or are they guaranteed to come with the same order?
…lue (#4629) * Return comparable LinkedHashMap in valueForCalcite() of ExprTupleValue Signed-off-by: Lantao Jin <[email protected]> * change to compare recursively Signed-off-by: Lantao Jin <[email protected]> --------- Signed-off-by: Lantao Jin <[email protected]> (cherry picked from commit 80fb6b7) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
@qianheng-aws I filed a followup PR. The current ComparableLinkedHashMap only compares the values. Change it to compare key than value. |
…lue (#4629) (#4647) * Return comparable LinkedHashMap in valueForCalcite() of ExprTupleValue * change to compare recursively --------- (cherry picked from commit 80fb6b7) Signed-off-by: Lantao Jin <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* default-main: (34 commits) Enhance dynamic source clause to support only metadata filters (opensearch-project#4554) Make nested alias type support referring to outer context (opensearch-project#4673) Update big5 ppl queries and check plans (opensearch-project#4668) Support push down sort after limit (opensearch-project#4657) Use table scan rowType in filter pushdown could fix rename issue (opensearch-project#4670) Fix: Support Alias Fields in MIN, MAX, FIRST, LAST, and TAKE Aggregations (opensearch-project#4621) Fix bin nested fields issue (opensearch-project#4606) Add `per_minute`, `per_hour`, `per_day` function support (opensearch-project#4531) Pushdown sort aggregate metrics (opensearch-project#4603) Followup: Change ComparableLinkedHashMap to compare Key than Value (opensearch-project#4648) Mitigate the CI failure caused by 500 Internal Server Error (opensearch-project#4646) Allow renaming group-by fields to existing field names (opensearch-project#4586) Publish internal modules separately for downstream reuse (opensearch-project#4484) Revert "Update grammar files and developer guide (opensearch-project#4301)" (opensearch-project#4643) Support Automatic Type Conversion for REX/SPATH/PARSE Command Extractions (opensearch-project#4599) Replace all dots in fields of table scan's PhysType (opensearch-project#4633) Return comparable LinkedHashMap in `valueForCalcite()` of ExprTupleValue (opensearch-project#4629) Refactor JsonExtractAllFunctionIT and MapConcatFunctionIT (opensearch-project#4623) Pushdown case function in aggregations as range queries (opensearch-project#4400) Update GEOIP function to support IP types as input (opensearch-project#4613) ... # Conflicts: # docs/user/ppl/functions/conversion.rst
* default-main: (34 commits) Enhance dynamic source clause to support only metadata filters (opensearch-project#4554) Make nested alias type support referring to outer context (opensearch-project#4673) Update big5 ppl queries and check plans (opensearch-project#4668) Support push down sort after limit (opensearch-project#4657) Use table scan rowType in filter pushdown could fix rename issue (opensearch-project#4670) Fix: Support Alias Fields in MIN, MAX, FIRST, LAST, and TAKE Aggregations (opensearch-project#4621) Fix bin nested fields issue (opensearch-project#4606) Add `per_minute`, `per_hour`, `per_day` function support (opensearch-project#4531) Pushdown sort aggregate metrics (opensearch-project#4603) Followup: Change ComparableLinkedHashMap to compare Key than Value (opensearch-project#4648) Mitigate the CI failure caused by 500 Internal Server Error (opensearch-project#4646) Allow renaming group-by fields to existing field names (opensearch-project#4586) Publish internal modules separately for downstream reuse (opensearch-project#4484) Revert "Update grammar files and developer guide (opensearch-project#4301)" (opensearch-project#4643) Support Automatic Type Conversion for REX/SPATH/PARSE Command Extractions (opensearch-project#4599) Replace all dots in fields of table scan's PhysType (opensearch-project#4633) Return comparable LinkedHashMap in `valueForCalcite()` of ExprTupleValue (opensearch-project#4629) Refactor JsonExtractAllFunctionIT and MapConcatFunctionIT (opensearch-project#4623) Pushdown case function in aggregations as range queries (opensearch-project#4400) Update GEOIP function to support IP types as input (opensearch-project#4613) ... Signed-off-by: Asif Bashar <[email protected]>
…lue (opensearch-project#4629) * Return comparable LinkedHashMap in valueForCalcite() of ExprTupleValue Signed-off-by: Lantao Jin <[email protected]> * change to compare recursively Signed-off-by: Lantao Jin <[email protected]> --------- Signed-off-by: Lantao Jin <[email protected]>
Description
Fix
class java.util.LinkedHashMap cannot be cast to class java.lang.Comparableindedupstruct fieldRelated Issues
Resolves #4339
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.