IMPALA-11980 (part 1): Put all thrift-generated python code into the impala_thrift_gen package

This puts all of the thrift-generated python code into the
impala_thrift_gen package. This is similar to what Impyla
does for its thrift-generated python code, except that it
uses the impala_thrift_gen package rather than impala._thrift_gen.
This is a preparatory patch for fixing the absolute import
issues.

This patches all of the thrift files to add the python namespace.
This has code to apply the patching to the thirdparty thrift
files (hive_metastore.thrift, fb303.thrift) to do the same.

Putting all the generated python into a package makes it easier
to understand where the imports are getting code. When the
subsequent change rearranges the shell code, the thrift generated
code can stay in a separate directory.

This uses isort to sort the imports for the affected Python files
with the provided .isort.cfg file. This also adds an impala-isort
shell script to make it easy to run.

Testing:
 - Ran a core job

Change-Id: Ie2927f22c7257aa38a78084efe5bd76d566493c0
Reviewed-on: http://gerrit.cloudera.org:8080/20169
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Riza Suminto <riza.suminto@cloudera.com>
This commit is contained in:
Joe McDonnell
2023-07-01 11:02:55 -07:00
parent c0174bb438
commit c5a0ec8bdf
90 changed files with 589 additions and 321 deletions

View File

@@ -22,9 +22,11 @@ from __future__ import absolute_import, division, print_function
import base64
import datetime
import zlib
from thrift.protocol import TCompactProtocol
from thrift.TSerialization import deserialize
from RuntimeProfile.ttypes import TRuntimeProfileTree
from impala_thrift_gen.RuntimeProfile.ttypes import TRuntimeProfileTree
def decode_profile_line(line):