You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2020/12/15 22:51:26 UTC

[impala] 03/04: IMPALA-10393: Iceberg field id-based column resolution fails in ASAN builds

This is an automated email from the ASF dual-hosted git repository.

tarmstrong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit d1f4a4cc457c0327cf0e5d482116b97431da154e
Author: Zoltan Borok-Nagy <bo...@cloudera.com>
AuthorDate: Mon Dec 14 15:20:11 2020 +0100

    IMPALA-10393: Iceberg field id-based column resolution fails in ASAN builds
    
    For MAP types field id resolution indexes the top-level columns
    via the current 'table_idx - 1'. In this case table_idx is either
    SchemaPathConstants::MAP_KEY or SchemaPathConstants::MAP_VALUE which
    are 0 and 1 respectively. Hence 'table_idx - 1' can be -1 which is not
    a valid index for a vector, hence we get an ASAN error. Even if
    'table_idx - 1' is zero we get a wrong field id.
    
    Note that at this point in the schema resolution we have successfully
    found a MAP type with a matching field id, therefore it is safe to
    resolve the child via the value of 'table_idx' (which is the position
    of the child, MAP_KEY or MAP_VALUE).
    
    Testing:
     * Built impala with ASAN (buildall.sh -notests -skiptests -asan), then
       executed test_iceberg_query
    
    Change-Id: I41e8daaebe8a6024716e6c22f6ccd819f43508bd
    Reviewed-on: http://gerrit.cloudera.org:8080/16873
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/exec/parquet/parquet-metadata-utils.cc | 14 +++-----------
 tests/query_test/test_scanners.py             |  2 --
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/be/src/exec/parquet/parquet-metadata-utils.cc b/be/src/exec/parquet/parquet-metadata-utils.cc
index 2e77326..e2b1e46 100644
--- a/be/src/exec/parquet/parquet-metadata-utils.cc
+++ b/be/src/exec/parquet/parquet-metadata-utils.cc
@@ -764,17 +764,9 @@ SchemaNode* ParquetSchemaResolver::NextSchemaNode(
       DCHECK_EQ(col_type->type, TYPE_MAP);
       DCHECK(table_idx == SchemaPathConstants::MAP_KEY ||
              table_idx == SchemaPathConstants::MAP_VALUE);
-      int field_id = -1;
-      if (table_idx == SchemaPathConstants::MAP_KEY) {
-        field_id = tbl_desc_.col_descs()[table_idx - 1].field_map_key_id();
-      } else {
-        field_id = tbl_desc_.col_descs()[table_idx - 1].field_map_value_id();
-      }
-      file_idx = FindChildWithFieldId(node, field_id);
-      if (file_idx >= node->children.size()) {
-        // Couldn't resolve by field id, fall back to resolution by position.
-        file_idx = table_idx;
-      }
+      // At this point we've found a MAP with a matching field id. It's safe to resolve
+      // the child (key or value) by position.
+      file_idx = table_idx;
     }
   } else {
     // Resolution by position.
diff --git a/tests/query_test/test_scanners.py b/tests/query_test/test_scanners.py
index 3192144..5a865cc 100644
--- a/tests/query_test/test_scanners.py
+++ b/tests/query_test/test_scanners.py
@@ -348,8 +348,6 @@ class TestIceberg(ImpalaTestSuite):
         create_exec_option_dimension(debug_action_options=DEBUG_ACTION_DIMS))
     cls.ImpalaTestMatrix.add_constraint(
       lambda v: v.get_value('table_format').file_format == 'parquet')
-    cls.ImpalaTestMatrix.add_dimension(
-        ImpalaTestDimension('PARQUET_FALLBACK_SCHEMA_RESOLUTION', 2))
 
   def test_iceberg_query(self, vector):
     self.run_test_case('QueryTest/iceberg-query', vector)