-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
make hive macros return string type vs bytes #8598
Conversation
It looks like (at least some of) the tests are failing because other tests that call |
The reason is that the consumers of this return type should not be getting a byte back but a real string response. Wanted to make this clear |
@Acehaidrey Not sure I have the context to say. Could you explain what you mean by "incompatible return"? |
Hi @jhtimmins , Sorry for the delayed response. I cleaned my message - realized it didn't make sense. There is not any incompatible return. But I fixed the tests so please take a look. This method is intended to be used with passing string values to scripts in template-able sql scripts and returning a string type is what is expected. |
@jhtimmins if you have a chance to revisit this |
@jhtimmins sorry for pestering but would love to get these in and close out |
@ashb mind taking a look at this one too? sorry for all the tags |
@ashb mind taking a look now? did the updates |
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.
@turbaszek mind taking a look at this too?
Summary: make hive macros py3 compatible with decoded string Reviewers: #big-data-platform Tags: #big-data-platform Differential Revision: https://phabricator.pinadmin.com/D548643
@turbaszek I just rebased instead of git pull etc. @ashb mind please taking a look one last time to close this out once and for all? |
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.
This looks okay for master, any idea what the change should look like for 1.10 where we still have to support py2+3
Hey @ashb for 1.10 it actually can remain the same. So from a quick test I ran locally even if py2 it returns the value as a string type. Not sure why they encoded but maybe older versions of py2 had some caveat? Also thanks for reviewing! |
hey @ashb mind taking a look at the latest comment. |
What about py3 on 1.10.x? |
This change is actually done using branch v1.10-stable. So it works as is here @ashb . Good question. So no concern there either |
@ashb wanted too knoow if there were any more concerns or if we merge this |
@ashb sorry to keep pinging - |
@ashb @turbaszek any chance we can get this in |
I'll look first thing tomorrow morning. It should be good! (Sorry, we've had some issues with our ci that need attention) |
thank team! |
Co-authored-by: Ace Haidrey <[email protected]> (cherry-picked from c78e2a5)
Co-authored-by: Ace Haidrey <[email protected]>
Co-authored-by: Ace Haidrey <[email protected]> (cherry-picked from c78e2a5)
Co-authored-by: Ace Haidrey <[email protected]> (cherry-picked from c78e2a5)
Co-authored-by: Ace Haidrey <[email protected]> (cherry-picked from c78e2a5)
With the current implementation of the hive macros encoding the resultant from the metastore calls, in py2 this returns a string type still but in python3 encoding forces the representation to be a byte type. See the example below
The issue with this is that the resultant for example being used by macros returns a byte type that isn't templatable as a string and breaks the queries it is used in. What this means is that all the templates need to be written as something like this:
Requiring from the users end to always decode the value is not the intention of this method and should use a value that can be returned as is.
This PR is to fix this ordeal. We may be able to just remove the encoding altogether but it could make things backwards incompatible.
Make sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.