You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Joe McDonnell (Jira)" <ji...@apache.org> on 2023/03/06 18:20:00 UTC
[jira] [Created] (IMPALA-11973) Add absolute_import and division __future__ imports to all python code
Joe McDonnell created IMPALA-11973:
--------------------------------------
Summary: Add absolute_import and division __future__ imports to all python code
Key: IMPALA-11973
URL: https://issues.apache.org/jira/browse/IMPALA-11973
Project: IMPALA
Issue Type: Sub-task
Components: Infrastructure
Affects Versions: Impala 4.3.0
Reporter: Joe McDonnell
Python 3 changed the way imports work so that imports in modules need to be absolute. To make our Python 2 behave like Python 3, we can add "from __future__ import absolute_import" to our python files. More details here: [https://python-future.org/compatible_idioms.html#imports-relative-to-a-package]
Python 3 also changed the default behavior of division to use float division in more circumstances (i.e. 1 / 2 is 0.5 rather than 0). To make Python 2 behave like Python 3, we can add "from __future__ import division" to our python files. Locations that need the old integer division can use '//'. More details here: [https://python-future.org/compatible_idioms.html#division]
Since both involve adding an import to all files, doing them together reduces the disruption.
These correspond to the no-absolute-import and old-division checks in Pylint. For old division, Pylint can point out locations that may need to be modified, and that needs to happen before adding the division import.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org