Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Fix object/nested field select issue #584

Merged

Conversation

dai-chen
Copy link
Member

@dai-chen dai-chen commented Jul 17, 2020

Issue #, if available: #564, #369, #192

Description of changes: The root cause of missing object/nested field is ES Get Field Mapping API return nothing for object/nested field. The result of Get Field Mapping API determines which field to return, hence object/nested field missing. To fix this issue, we need to return default "object" field for both when unable to find its type in Get Field Mapping response.

Side effect: The assumption that fields not exist in Get Field Mapping response must be object/nested is held only if the field is a valid and existing one. This is true when our semantic analyzer enabled, otherwise wrong type returned. Ideally, we may change to Get Index Mapping API or our own LocalClusterState. But both changes are major and the efforts are not worth for old engine legacy code.

Testing: New UT, IT and doctest (as below) are added. All old tests can pass. Tested with JDBC driver. Right column can be returned but need to add object type handling logic to JDBC driver.

Documentation: Add a new section in https://github.com/dai-chen/sql/blob/fix-object-select-issue/docs/user/beyond/partiql.rst#querying-nested-tuple-values. Change introduction section to cover both object and nested field.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dai-chen dai-chen added bug Something isn't working SQL labels Jul 17, 2020
@dai-chen dai-chen self-assigned this Jul 17, 2020
@dai-chen dai-chen marked this pull request as ready for review July 20, 2020 16:21
@dai-chen dai-chen merged commit d74cb81 into opendistro-for-elasticsearch:develop Jul 20, 2020
@dai-chen dai-chen deleted the fix-object-select-issue branch July 20, 2020 20:52
dai-chen added a commit that referenced this pull request Aug 4, 2020
* Issue 584 Fix object/nested field select issue

* Issue 600 Fix CAST bool to integer issue

* Issue 609 Support queries end with semi colon
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working SQL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants