Files
impala/tests/infra/test_thrift_parser.py
Riza Suminto c08aff420d IMPALA-13672: Migrate query_test/test_kudu.py to use hs2 protocol
This patch migrate query_test/test_kudu.py to use hs2 client protocol.
Here are the steps taken:

- Override default_test_protocol() to return 'hs2'.
  See documentation in ImpalaTestSuite about what this method does.
- Remove usage of deprecated cursor and unique_cursor fixture.
- Replace all direct ImpalaTestSuite.client usage with helper
  function call such as execute_query() or execute_query_using_vector().
- Remove all "SET" query invocation and replace it with passing
  exec_option dictionary to helper method.
- Replace veryfing kudu modified / inserted rows from reading query
  output to reading runtime profile counters.
- Add HS2_TYPES section at test cases where only TYPES exist.
- Remove all drop_impala_table_after_context() calls and replace it with
  proper use of unique_database fixture.

KuduTestSuite is fixed with hs2 protocol dimension. Meanwhile,
CustomKuduTest is fixed to use beeswax protocol dimension until proper
migration can be done.

Added following convenience methods:
- ImpalaTestSuite.default_test_protocol() to allow individual test
  class to override its default test procol.
- ImpylaHS2ResultSet.tuples() to access the raw HS2 result set that is
  a list of tuples.

This patch also added several literal constants around test vector
dimension to help with traceability.

Fixed a bug where "SHOW PARTITIONS" via hs2 over kudu table will shows
NULL number of #Replicas because TResultRowBuilder does not have
overload for int type value. Adjust numFiles variable inside
HdfsTable.getTableStats() from int to long to match Type.BIGINT of
column '#Files'.

Fixed py.test classes that does not inherit BaseTestSuite. Fixed flake8
issues in test_statestore.py.

Testing:
- Run and pass all tests extended from KuduTestSuite in exhaustive mode.

Change-Id: I5f38baf5a0bbde1a1ad0bb4666c300f4f3cabd33
Reviewed-on: http://gerrit.cloudera.org:8080/22358
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2025-02-07 11:57:59 +00:00

43 lines
1.7 KiB
Python

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from __future__ import absolute_import
import os
from subprocess import check_output
from tests.common.base_test_suite import BaseTestSuite
class TestThriftParser(BaseTestSuite):
def test_thrift_parser(self):
"""Make sure thrift_parser can parse all the thrift files"""
impala_home = os.getenv("IMPALA_HOME")
# Only supports python3
output = check_output([os.path.join(impala_home, "bin/impala-python3"),
os.path.join(impala_home, "bin/jenkins/thrift_parser.py"),
os.path.join(impala_home, "common/thrift")],
universal_newlines=True)
assert "TStatus" in output
assert "Field1 required ErrorCodes.TErrorCode status_code" in output
assert "Field2 optional list<string> error_msgs" in output
assert "TErrorCode" in output
assert "EnumItem OK" in output
assert "EnumItem UNUSED" in output
assert "EnumItem GENERAL" in output
assert "EnumItem CANCELLED" in output