-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-25817: Add parentheses to print statements for python3 compatibility #6100
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
Conversation
Added 1 comment, rest of the changes LGTM. |
my python version is: Python 3.12.11
Parenthesis are required and indentation is not correct which is causing failure |
Outside scope of the PR, |
@Aggarwal-Raghav, thank you for the review! I've fixed the |
|
Changes LGTM +1 (non-binding). I understand that you are using try/except to make in compatible with python2. |
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 order to do a proper review and ensure that scripts work I will probably have to run and test each file that is modified. However, before running them I would like to know if we need/use all these python scripts? If we have useless stuff that can be dropped then we should do this before trying to make them Python 3 compatible.
@zabetak, most of them are used:
The main goal of the PR was to fix errors when executing qfile tests that use these python files. If you think that certain changes are too risky, let me know, I'm happy to reduce the scope of the 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.
I went over the changes and overall LGTM.
I run manually the modified scripts under data/scripts
using python3 and they seem to run fine. These scripts seem to be in use by various .q files so I assume that since tests are green the changes are OK. It still makes a bit wonder though since the tests were also running fine before the changes so it means somehow somewhere we are using and relying on an old Python version.
The changes in the scripts under hcatalog are completely based on my eyes. Not sure how and if these scripts are used nowadays.
I tried running fb303_simple_mgmt.py
but there are still many compatibility issues in dependent modules. Not sure if anyone is using these scripts these days.
I tried running gen-report.py but it fails due to various other compatibility issues. This is also a script that I am not sure if it is relevant anymore.
Thank you for the review, @zabetak! I've postponed fixing I can't see the merge button here, maybe because I don't have write permissions to the Hive repository. Could you merge it, please? |
What changes were proposed in this pull request?
Make the Python scripts compatible with Python 3 by changing
print ....
toprint(...)
, with some minor fixes where necessary.Why are the changes needed?
Some q files use python scripts. However, the python scripts use syntax that is not compatible with Python 3. Python 2 is out-of-date (last release in 2020), and some operating systems do not provide packages anymore (e.g., Ubuntu LTS 24.04). The goal of this ticket is to make the scripts compatible with Python 3.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Running
mvn test -pl itests/qtest -Pitests -Dtest=TestMiniLlapCliDriver -Dqfile=newline.q
locally.