-
Notifications
You must be signed in to change notification settings - Fork 180
Fix mapping after aggregation push down #4500
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| setup: | ||
| - do: | ||
| query.settings: | ||
| body: | ||
| transient: | ||
| plugins.calcite.enabled : true | ||
| - do: | ||
| bulk: | ||
| index: test | ||
| refresh: true | ||
| body: | ||
| - '{"index": {}}' | ||
| - '{"num": 11}' | ||
| - '{"index": {}}' | ||
| - '{"num": 15}' | ||
| - '{"index": {}}' | ||
| - '{"num": 22}' | ||
|
|
||
| --- | ||
| teardown: | ||
| - do: | ||
| query.settings: | ||
| body: | ||
| transient: | ||
| plugins.calcite.enabled : false | ||
|
|
||
| --- | ||
| "big decimal literal": | ||
| - skip: | ||
| features: | ||
| - headers | ||
| - allowed_warnings | ||
| - do: | ||
| headers: | ||
| Content-Type: 'application/json' | ||
| ppl: | ||
| body: | ||
| query: source=test | bin num bins=3 | stats count() by num | ||
|
|
||
| - match: { total: 2 } | ||
| - match: { "schema": [ { "name": "count()", "type": "bigint" }, { "name": "num", "type": "string" }] } | ||
| - match: {"datarows": [[2, "10-20"], [1, "20-30"]]} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,11 +85,7 @@ public class OpenSearchExprValueFactory { | |
| * @param typeMapping A data type mapping produced by aggregation. | ||
| */ | ||
| public void extendTypeMapping(Map<String, OpenSearchDataType> typeMapping) { | ||
| for (var field : typeMapping.keySet()) { | ||
| // Prevent overwriting, because aggregation engine may be not aware | ||
| // of all niceties of all types. | ||
| this.typeMapping.putIfAbsent(field, typeMapping.get(field)); | ||
| } | ||
| this.typeMapping.putAll(typeMapping); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. q: should we check
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bug actually. We'd better always have this change despite of what this configuration is. |
||
| } | ||
|
|
||
| @Getter @Setter private OpenSearchAggregationResponseParser parser; | ||
|
|
||
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.
what's the result without this patch? is it a test about overwrite existing type? if yes, better to match the schema too.
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.
Corrected the issue link, #4115. It will throw exception without this PR
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.
Also add the schema verification in the commit acecdd1