You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by mi...@apache.org on 2026/09/09 20:34:32 UTC
(impala) 07/10: IMPALA-15217: Fix avro.schema.url tests on S3, Ozone
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 2d1fa22b2009e66db80f136ffc6f93035bfd6d72
Author: Michael Smith <mi...@cloudera.com>
AuthorDate: Wed Jul 22 09:31:47 2026 -0700
IMPALA-15217: Fix avro.schema.url tests on S3, Ozone
With S3 and Ozone, we get different error messages when the file doesn't
exist. Assert the general error prefix we add.
For Ozone we need to account for different warehouse paths.
Change-Id: I5712ed42877bf289f07a4a5a46ca8c3061d7eabc
Reviewed-on: http://gerrit.cloudera.org:8080/24802
Reviewed-by: Michael Smith <mi...@cloudera.com>
Tested-by: Michael Smith <mi...@cloudera.com>
---
bin/load-data.py | 2 --
testdata/bin/create-load-data.sh | 3 +++
.../{ => data/schemas}/bad_avro_schemas/bad_json.json | 0
.../schemas}/bad_avro_schemas/neg_precision.json | 0
.../{ => data/schemas}/bad_avro_schemas/neg_scale.json | 0
.../{ => data/schemas}/bad_avro_schemas/no_name.json | 0
.../schemas}/bad_avro_schemas/no_precision.json | 0
.../{ => data/schemas}/bad_avro_schemas/no_type.json | 0
.../{ => data/schemas}/bad_avro_schemas/union.json | 0
.../queries/QueryTest/avro-schema-checks.test | 18 +++++++++---------
tests/query_test/test_avro_schema_urls.py | 3 +--
11 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/bin/load-data.py b/bin/load-data.py
index 59977e11c..45f9d317c 100755
--- a/bin/load-data.py
+++ b/bin/load-data.py
@@ -87,7 +87,6 @@ WORKLOAD_DIR = options.workload_dir
DATASET_DIR = options.dataset_dir
TESTDATA_BIN_DIR = os.path.join(os.environ['IMPALA_HOME'], 'testdata/bin')
AVRO_SCHEMA_DIR = "avro_schemas"
-BAD_AVRO_SCHEMA_DIR = os.path.join(os.environ['IMPALA_HOME'], 'testdata/bad_avro_schemas')
GENERATE_SCHEMA_CMD = "generate-schema-statements.py --exploration_strategy=%s "\
"--workload=%s --scale_factor=%s --verbose"
@@ -389,7 +388,6 @@ def main():
# Copy the avro schemas (see #2) into HDFS
avro_schemas_path = os.path.join(sql_dir, AVRO_SCHEMA_DIR)
copy_avro_schemas_to_hdfs(avro_schemas_path)
- copy_avro_schemas_to_hdfs(BAD_AVRO_SCHEMA_DIR)
# List all of the files in the sql directory to sort out the various types of
# files (see #3).
diff --git a/testdata/bin/create-load-data.sh b/testdata/bin/create-load-data.sh
index debe1c8b8..915989fd2 100755
--- a/testdata/bin/create-load-data.sh
+++ b/testdata/bin/create-load-data.sh
@@ -202,6 +202,7 @@ function load-custom-schemas {
SCHEMA_TMP_DIR="${TMP_DIR}/schemas"
mkdir ${SCHEMA_TMP_DIR}
mkdir ${SCHEMA_TMP_DIR}/enum
+ mkdir ${SCHEMA_TMP_DIR}/bad_avro_schemas
ln -s ${SCHEMA_SRC_DIR}/zipcode_incomes.parquet ${SCHEMA_TMP_DIR}
ln -s ${SCHEMA_SRC_DIR}/alltypestiny.parquet ${SCHEMA_TMP_DIR}
ln -s ${SCHEMA_SRC_DIR}/enum/* ${SCHEMA_TMP_DIR}/enum
@@ -209,6 +210,7 @@ function load-custom-schemas {
ln -s ${SCHEMA_SRC_DIR}/decimal.parquet ${SCHEMA_TMP_DIR}
ln -s ${SCHEMA_SRC_DIR}/nested/modern_nested.parquet ${SCHEMA_TMP_DIR}
ln -s ${SCHEMA_SRC_DIR}/nested/legacy_nested.parquet ${SCHEMA_TMP_DIR}
+ ln -s ${SCHEMA_SRC_DIR}/bad_avro_schemas/* ${SCHEMA_TMP_DIR}/bad_avro_schemas
# CHAR and VARCHAR tables written by Hive
mkdir -p ${TMP_DIR}/chars_formats_avro_snap \
@@ -229,6 +231,7 @@ function load-custom-schemas {
ln -s ${IMPALA_HOME}/testdata/data/warmup_table_list.txt\
${TMP_DIR}/warmup_table_list.txt
+
hadoop fs -put -f ${TMP_DIR}/* /test-warehouse
rm -r ${TMP_DIR}
diff --git a/testdata/bad_avro_schemas/bad_json.json b/testdata/data/schemas/bad_avro_schemas/bad_json.json
similarity index 100%
rename from testdata/bad_avro_schemas/bad_json.json
rename to testdata/data/schemas/bad_avro_schemas/bad_json.json
diff --git a/testdata/bad_avro_schemas/neg_precision.json b/testdata/data/schemas/bad_avro_schemas/neg_precision.json
similarity index 100%
rename from testdata/bad_avro_schemas/neg_precision.json
rename to testdata/data/schemas/bad_avro_schemas/neg_precision.json
diff --git a/testdata/bad_avro_schemas/neg_scale.json b/testdata/data/schemas/bad_avro_schemas/neg_scale.json
similarity index 100%
rename from testdata/bad_avro_schemas/neg_scale.json
rename to testdata/data/schemas/bad_avro_schemas/neg_scale.json
diff --git a/testdata/bad_avro_schemas/no_name.json b/testdata/data/schemas/bad_avro_schemas/no_name.json
similarity index 100%
rename from testdata/bad_avro_schemas/no_name.json
rename to testdata/data/schemas/bad_avro_schemas/no_name.json
diff --git a/testdata/bad_avro_schemas/no_precision.json b/testdata/data/schemas/bad_avro_schemas/no_precision.json
similarity index 100%
rename from testdata/bad_avro_schemas/no_precision.json
rename to testdata/data/schemas/bad_avro_schemas/no_precision.json
diff --git a/testdata/bad_avro_schemas/no_type.json b/testdata/data/schemas/bad_avro_schemas/no_type.json
similarity index 100%
rename from testdata/bad_avro_schemas/no_type.json
rename to testdata/data/schemas/bad_avro_schemas/no_type.json
diff --git a/testdata/bad_avro_schemas/union.json b/testdata/data/schemas/bad_avro_schemas/union.json
similarity index 100%
rename from testdata/bad_avro_schemas/union.json
rename to testdata/data/schemas/bad_avro_schemas/union.json
diff --git a/testdata/workloads/functional-query/queries/QueryTest/avro-schema-checks.test b/testdata/workloads/functional-query/queries/QueryTest/avro-schema-checks.test
index 71553b3b2..b744c9fda 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/avro-schema-checks.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/avro-schema-checks.test
@@ -8,21 +8,21 @@
# CREATE TABLE with a schema literal where the decimal field has no precision.
# Precision is required by the Avro spec; the error is caught in CatalogOpExecutor.
CREATE TABLE avro_decimal_no_precision STORED AS AVRO TBLPROPERTIES (
- 'avro.schema.url'='/test-warehouse/bad_avro_schemas/no_precision.json')
+ 'avro.schema.url'='$FILESYSTEM_PREFIX/test-warehouse/schemas/bad_avro_schemas/no_precision.json')
---- CATCH
No 'precision' property specified for 'decimal' logicalType
====
---- QUERY
# CREATE TABLE with a schema literal where the decimal precision is negative.
CREATE TABLE avro_decimal_neg_precision STORED AS AVRO TBLPROPERTIES (
- 'avro.schema.url'='/test-warehouse/bad_avro_schemas/neg_precision.json')
+ 'avro.schema.url'='$FILESYSTEM_PREFIX/test-warehouse/schemas/bad_avro_schemas/neg_precision.json')
---- CATCH
Invalid decimal 'precision' property value
====
---- QUERY
# CREATE TABLE with a schema literal where the decimal scale is negative.
CREATE TABLE avro_decimal_neg_scale STORED AS AVRO TBLPROPERTIES (
- 'avro.schema.url'='/test-warehouse/bad_avro_schemas/neg_scale.json')
+ 'avro.schema.url'='$FILESYSTEM_PREFIX/test-warehouse/schemas/bad_avro_schemas/neg_scale.json')
---- CATCH
Invalid decimal 'scale' property value
====
@@ -30,7 +30,7 @@ Invalid decimal 'scale' property value
# CREATE TABLE with a schema literal containing a non-nullable union, which Impala
# does not support. Error is caught in CatalogOpExecutor.
CREATE TABLE avro_create_union_type STORED AS AVRO TBLPROPERTIES (
- 'avro.schema.url'='/test-warehouse/bad_avro_schemas/union.json')
+ 'avro.schema.url'='$FILESYSTEM_PREFIX/test-warehouse/schemas/bad_avro_schemas/union.json')
---- CATCH
Unsupported type 'union' of column 'union1'
====
@@ -38,7 +38,7 @@ Unsupported type 'union' of column 'union1'
# CREATE TABLE with a syntactically invalid JSON schema literal.
# Error is caught in CatalogOpExecutor.
CREATE TABLE avro_create_bad_json STORED AS AVRO TBLPROPERTIES (
- 'avro.schema.url'='/test-warehouse/bad_avro_schemas/bad_json.json')
+ 'avro.schema.url'='$FILESYSTEM_PREFIX/test-warehouse/schemas/bad_avro_schemas/bad_json.json')
---- CATCH
Unexpected close marker ']': expected '}'
====
@@ -49,28 +49,28 @@ CREATE TABLE avro_alter_schema_errors (s string) STORED AS AVRO
---- QUERY
# ALTER TABLE with a schema literal containing a non-nullable union type.
ALTER TABLE avro_alter_schema_errors SET TBLPROPERTIES (
- 'avro.schema.url'='/test-warehouse/bad_avro_schemas/union.json')
+ 'avro.schema.url'='$FILESYSTEM_PREFIX/test-warehouse/schemas/bad_avro_schemas/union.json')
---- CATCH
Unsupported type 'union' of column 'union1'
====
---- QUERY
# ALTER TABLE with a syntactically invalid JSON schema literal.
ALTER TABLE avro_alter_schema_errors SET TBLPROPERTIES (
- 'avro.schema.url'='/test-warehouse/bad_avro_schemas/bad_json.json')
+ 'avro.schema.url'='$FILESYSTEM_PREFIX/test-warehouse/schemas/bad_avro_schemas/bad_json.json')
---- CATCH
Unexpected close marker ']': expected '}'
====
---- QUERY
# ALTER TABLE with a schema literal that has no "type" field.
ALTER TABLE avro_alter_schema_errors SET TBLPROPERTIES (
- 'avro.schema.url'='/test-warehouse/bad_avro_schemas/no_type.json')
+ 'avro.schema.url'='$FILESYSTEM_PREFIX/test-warehouse/schemas/bad_avro_schemas/no_type.json')
---- CATCH
No type:
====
---- QUERY
# ALTER TABLE with a schema literal record that has no "name" field.
ALTER TABLE avro_alter_schema_errors SET TBLPROPERTIES (
- 'avro.schema.url'='/test-warehouse/bad_avro_schemas/no_name.json')
+ 'avro.schema.url'='$FILESYSTEM_PREFIX/test-warehouse/schemas/bad_avro_schemas/no_name.json')
---- CATCH
No name in schema:
====
diff --git a/tests/query_test/test_avro_schema_urls.py b/tests/query_test/test_avro_schema_urls.py
index d71907712..1d2988292 100644
--- a/tests/query_test/test_avro_schema_urls.py
+++ b/tests/query_test/test_avro_schema_urls.py
@@ -80,8 +80,7 @@ class TestAvroSchemaUrls(ImpalaTestSuite):
self.client,
"create table {db}.t stored as avro tblproperties "
"('avro.schema.url'='{loc}')".format(db=unique_database, loc=nonexistent))
- err_str = str(err)
- assert "does not exist" in err_str
+ assert "Unable to read schema from given path" in str(err)
def test_literal_overrides_http_url(self, unique_database):
"""avro.schema.literal takes precedence; avro.schema.url is never evaluated.