-
Notifications
You must be signed in to change notification settings - Fork 33
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
Extract value from map when the key is nested field alike #600
Extract value from map when the key is nested field alike #600
Conversation
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.
Please add the command description in the README file
Also run the |
9653201
to
64e2c52
Compare
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 u plz add in the PR description what u'v done in this PR and explain how its solved the bug ?
thanks
integ-test/src/integration/scala/org/opensearch/flint/spark/unmapped.json
Outdated
Show resolved
Hide resolved
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 i'm missing something, is this to replace the actual mapped nested fields ?
why not adding new tests which covers this additional use case?
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 you describe what you are referring to? I don't get this
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
74fe1cc
to
968ab8f
Compare
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Kacper Trochimiak <[email protected]>
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.
Could you elaborate why we need to treat this Struct as a Map? I thought this is no difference than accessing a Struct column?
CREATE TABLE nested_test ( age INT, user_data STRUCT<`user.first.name`:STRING> ) USING JSON; INSERT INTO nested_test VALUES ( 30, STRUCT("Alice") ), ( 40, STRUCT("Bob") ); SELECT age FROM nested_test WHERE user_data.`user.first.name` = 'Bob'; --- 40
I think it doesn't matter whether this column is of Struct or Map type. With tables defined as
and
commands like:
return the same results. Looks like ppl aready supports commands where nested field containing dots is enclosed in ` ` |
Yes, that's my question. I don't quite understand why we add special syntax here. I thought existing syntax for delimiting identifier is sufficient in SQL and PPL. Let me know if I miss anything. Thanks! |
You're right. I just wanted to introduce syntax similar to the one the person reporting this issue used in the SQL query. |
Description
Fixes bug where PPL cannot extract value when field is a map structure with key value pairs, but the key is like a nested JSON path.
It looks like dots in Spark are used for accessing nested fields in complex data types such as structs.
But it doesn't work when the keys are nested field alike. The person reporting the bug wrote that:
SQL is able to do it by select unmapped['userIdentity.sessioncontext.sessionIssuer.type']
.The original Spark parser translates such expression to:
I also used this approach in my solution.
Issues Resolved
#565
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.