generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 178
Support access to nested field of struct after fields command #4719
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
Merged
Merged
Changes from all commits
Commits
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
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
integ-test/src/yamlRestTest/resources/rest-api-spec/test/issues/3459.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| setup: | ||
| - do: | ||
| query.settings: | ||
| body: | ||
| transient: | ||
| plugins.calcite.enabled : true | ||
|
|
||
| - do: | ||
| indices.create: | ||
| index: test | ||
| body: | ||
| mappings: | ||
| properties: | ||
| parent_field: | ||
| properties: | ||
| child_field: | ||
| type: integer | ||
|
|
||
| - do: | ||
| bulk: | ||
| index: test | ||
| refresh: true | ||
| body: | ||
| - '{"index": {}}' | ||
| - '{ "parent_field": { "child_field": 4 } }' | ||
| - '{"index": {}}' | ||
| - '{ "parent_field": { "child_field": 3 } }' | ||
| - '{"index": {}}' | ||
| - '{ "parent_field": { "child_field": 2 } }' | ||
| - '{"index": {}}' | ||
| - '{ "parent_field": { "child_field": 1 } }' | ||
| - '{"index": {}}' | ||
| - '{ "parent_field": { "child_field": 5 } }' | ||
|
|
||
| --- | ||
| teardown: | ||
| - do: | ||
| query.settings: | ||
| body: | ||
| transient: | ||
| plugins.calcite.enabled : false | ||
|
|
||
| --- | ||
| "Access to nested field after field command": | ||
| - skip: | ||
| features: | ||
| - headers | ||
| - allowed_warnings | ||
|
|
||
| - do: | ||
| headers: | ||
| Content-Type: 'application/json' | ||
| ppl: | ||
| body: | ||
| query: source=test | fields parent_field | sort parent_field.child_field | head 3 | ||
|
|
||
| - match: { total: 3 } | ||
| - match: { schema: [ { "name": "parent_field", "type": "struct" } ] } | ||
| - match: { datarows: [ [ {"child_field": 1} ], [ {"child_field": 2} ], [ {"child_field": 3} ] ] } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Non-blocking: Do you have any idea how to specify precise type here? Calcite 1.41.0 has more strict type checking in RexToLixTranslator. If the Map value is another Array type, it cannot cast a ANY to Array.
Uh oh!
There was an error while loading. Please reload this page.
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.
Maybe we can do type-conversion recursively for the nested fields and store them in a customized type? It will has benefit to resolve proper functions for these fields.
What's more I'm thinking we may be able to deprecate the flatten fields if these nested fields' type are precise enough. It's not worthy to do that now since we have flatten fields and it only takes effect after
FIELDcommand. It should be done as another issue for enhancement.Uh oh!
There was an error while loading. Please reload this page.
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.
In the beginning, I'm thinking using
RelRecordTypeinstead ofMapSqlTypeto address this issue, which will get better performance and naturally support variant types.But looks like using map to support dynamic fields and type tolerance will be our trend. #4349 and #4433