You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Quanlong Huang (Code Review)" <ge...@cloudera.org> on 2020/01/24 09:42:44 UTC

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Quanlong Huang has uploaded this change for review. ( http://gerrit.cloudera.org:8080/15103


Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................

IMPALA-9324: Correctly handle ORC UNION type in scanner

We don't support reading UNION columns. Queries on tables containing
UNION types will fail in planning. Error message is metadata loading
error. However, scanner may need to read an ORC file with UNION types if
the table schema doesn't map to the UNION columns. Though the UNION
values won't be read, the scanner need to resolve the file schema,
including the UNION types, correctly.

In OrcSchemaResolver::BuildSchemaPath, we create a map from ORC type ids
to Impala SchemaPath representation for all types of the file. We should
deal with UNION types as well.

This patch also include some refactor to improve code readability.

Tests:
 - Add tests for table schema and file schema mismatching on all complex
   types.

Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
---
M be/src/exec/hdfs-orc-scanner.cc
M be/src/exec/orc-metadata-utils.cc
M be/src/exec/orc-metadata-utils.h
M common/thrift/generate_error_codes.py
M testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
M tests/query_test/test_scanners.py
6 files changed, 127 insertions(+), 25 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/03/15103/1
-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 1
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 5:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/5466/ DRY_RUN=true


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Mon, 27 Jan 2020 02:02:04 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 5:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/5525/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 14:15:29 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Zoltan Borok-Nagy (Code Review)" <ge...@cloudera.org>.
Zoltan Borok-Nagy has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 5: Code-Review+1

(2 comments)

http://gerrit.cloudera.org:8080/#/c/15103/5/be/src/exec/orc-metadata-utils.cc
File be/src/exec/orc-metadata-utils.cc:

http://gerrit.cloudera.org:8080/#/c/15103/5/be/src/exec/orc-metadata-utils.cc@45
PS5, Line 45:   
nit: too much indentation


http://gerrit.cloudera.org:8080/#/c/15103/5/tests/query_test/test_scanners.py
File tests/query_test/test_scanners.py:

http://gerrit.cloudera.org:8080/#/c/15103/5/tests/query_test/test_scanners.py@1337
PS5, Line 1337:     # Create a table whose nested types don't match the underlying ORC files.
              :     # Reuse the data files of functional_orc_def.complextypestbl.
              :     complex_types_loc = get_fs_path("/test-warehouse/complextypestbl_orc_def")
              :     self.client.execute("""create external table %s.ill_complextypes2 (id bigint,
              :         int_array map<string, int>,
              :         int_array_array array<struct<x:int>>,
              :         int_map array<struct<k:string,v:int>>,
              :         int_map_array array<array<struct<k:string,v:int>>>
              :         ) stored as orc location '%s'""" % (unique_database, complex_types_loc))
Can it be moved to orc-type-checks.test?



-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Mon, 27 Jan 2020 14:10:13 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 7:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/5471/ DRY_RUN=false


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 7
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Mon, 27 Jan 2020 23:38:28 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Quanlong Huang has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 6:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/15103/5/be/src/exec/orc-metadata-utils.cc
File be/src/exec/orc-metadata-utils.cc:

http://gerrit.cloudera.org:8080/#/c/15103/5/be/src/exec/orc-metadata-utils.cc@45
PS5, Line 45: "F
> nit: too much indentation
Done


http://gerrit.cloudera.org:8080/#/c/15103/5/tests/query_test/test_scanners.py
File tests/query_test/test_scanners.py:

http://gerrit.cloudera.org:8080/#/c/15103/5/tests/query_test/test_scanners.py@1337
PS5, Line 1337:     self.run_test_case('DataErrorsTest/orc-type-checks', vector, unique_database)
              : 
              :   def test_orc_timestamp_out_of_range(self, vector, unique_database):
              :       """Test the validation of out-of-range timestamps."""
              :       test_files = ["testdata/data/out_of_range_timestamp.orc"]
              :       create_table_and_copy_files(self.client, "create table {db}.{tbl} "
              :                                                "(ts timestamp) stored as orc",
              :                                   unique_database, "out_of_range_timestamp", test_files)
              :       new_vector = deepcopy(vector)
> Can it be moved to orc-type-checks.test?
Sure. Better to be there to have pretty format.



-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 6
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Mon, 27 Jan 2020 15:56:29 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 4: Verified-1

Build failed: https://jenkins.impala.io/job/gerrit-verify-dryrun/5462/


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 12:46:49 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Quanlong Huang has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 2:

(4 comments)

Thanks for taking a look. Addressed the comments.

http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/hdfs-orc-scanner.cc
File be/src/exec/hdfs-orc-scanner.cc:

http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/hdfs-orc-scanner.cc@203
PS1, Line 203:           root_type->toString(), filename());
> nit: this could be unified with orc-metadata-utils.cc:28, would it make sen
Yes, added an error code.

Both of them are necessary. 'root_type' here is the result returned by orc::RowReader::getSelectedType(). 'root_' inside OrcSchemaResolver is the result returned by orc::Reader::getType(). They are different results so we'd better check them in case for bugs in the ORC lib.


http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/orc-metadata-utils.h
File be/src/exec/orc-metadata-utils.h:

http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/orc-metadata-utils.h@42
PS1, Line 42:   Status BuildSchemaPaths(int num_partition_keys, std::vector<SchemaPath>* col_id_path_map);
> line too long (92 > 90)
Done


http://gerrit.cloudera.org:8080/#/c/15103/1/testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
File testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test:

http://gerrit.cloudera.org:8080/#/c/15103/1/testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test@160
PS1, Line 160: Note that before
             : # IMPALA-9324 this query will crash.
> nit: I think this comment here is not necessary.
OK. Removed it.


http://gerrit.cloudera.org:8080/#/c/15103/1/testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test@172
PS1, Line 172: File '$NAMENODE/test-warehouse/$DATABASE.db/union_complextypes/000000_0'
> Just a question: Isn't the fie is also part of the error msg? Can they be o
Yes, they can be ommitted if the expected string is not a regex. Substring matching is performed: https://github.com/apache/impala/blob/0163a10/tests/common/impala_test_suite.py#L478-L479

I found it error-prone to match the exact file name. So just added file name for ill_complextypes table since only one file in it.



-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 2
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 02:23:10 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 5: Verified+1


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Mon, 27 Jan 2020 06:53:40 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 4:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/5523/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 07:56:46 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/15103/2/be/src/exec/orc-metadata-utils.h
File be/src/exec/orc-metadata-utils.h:

http://gerrit.cloudera.org:8080/#/c/15103/2/be/src/exec/orc-metadata-utils.h@42
PS2, Line 42:   Status BuildSchemaPaths(int num_partition_keys, std::vector<SchemaPath>* col_id_path_map);
line too long (92 > 90)



-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 2
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 02:23:20 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Norbert Luksa, Gabor Kaszab, Zoltan Borok-Nagy, Csaba Ringhofer, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/15103

to look at the new patch set (#6).

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................

IMPALA-9324: Correctly handle ORC UNION type in scanner

We don't support reading UNION columns. Queries on tables containing
UNION types will fail in planning. Error message is metadata loading
error. However, scanner may need to read an ORC file with UNION types if
the table schema doesn't map to the UNION columns. Though the UNION
values won't be read, the scanner need to resolve the file schema,
including the UNION types, correctly.

In OrcSchemaResolver::BuildSchemaPath, we create a map from ORC type ids
to Impala SchemaPath representation for all types of the file. We should
deal with UNION types as well.

This patch also include some refactor to improve code readability.

Tests:
 - Add tests for table schema and file schema mismatching on all complex
   types.

Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
---
M be/src/exec/hdfs-orc-scanner.cc
M be/src/exec/orc-metadata-utils.cc
M be/src/exec/orc-metadata-utils.h
M common/thrift/generate_error_codes.py
M testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
M tests/query_test/test_scanners.py
6 files changed, 132 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/03/15103/6
-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 6
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................

IMPALA-9324: Correctly handle ORC UNION type in scanner

We don't support reading UNION columns. Queries on tables containing
UNION types will fail in planning. Error message is metadata loading
error. However, scanner may need to read an ORC file with UNION types if
the table schema doesn't map to the UNION columns. Though the UNION
values won't be read, the scanner need to resolve the file schema,
including the UNION types, correctly.

In OrcSchemaResolver::BuildSchemaPath, we create a map from ORC type ids
to Impala SchemaPath representation for all types of the file. We should
deal with UNION types as well.

This patch also include some refactor to improve code readability.

Tests:
 - Add tests for table schema and file schema mismatching on all complex
   types.

Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Reviewed-on: http://gerrit.cloudera.org:8080/15103
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
M be/src/exec/hdfs-orc-scanner.cc
M be/src/exec/orc-metadata-utils.cc
M be/src/exec/orc-metadata-utils.h
M common/thrift/generate_error_codes.py
M testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
M tests/query_test/test_scanners.py
6 files changed, 132 insertions(+), 28 deletions(-)

Approvals:
  Impala Public Jenkins: Looks good to me, approved; Verified

-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 8
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 2:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/5520/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 2
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 03:06:46 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 4:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/5462/ DRY_RUN=true


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 08:00:41 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 7: Verified+1


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 7
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Tue, 28 Jan 2020 04:30:20 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Norbert Luksa, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/15103

to look at the new patch set (#3).

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................

IMPALA-9324: Correctly handle ORC UNION type in scanner

We don't support reading UNION columns. Queries on tables containing
UNION types will fail in planning. Error message is metadata loading
error. However, scanner may need to read an ORC file with UNION types if
the table schema doesn't map to the UNION columns. Though the UNION
values won't be read, the scanner need to resolve the file schema,
including the UNION types, correctly.

In OrcSchemaResolver::BuildSchemaPath, we create a map from ORC type ids
to Impala SchemaPath representation for all types of the file. We should
deal with UNION types as well.

This patch also include some refactor to improve code readability.

Tests:
 - Add tests for table schema and file schema mismatching on all complex
   types.

Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
---
M be/src/exec/hdfs-orc-scanner.cc
M be/src/exec/orc-metadata-utils.cc
M be/src/exec/orc-metadata-utils.h
M common/thrift/generate_error_codes.py
M testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
M tests/query_test/test_scanners.py
6 files changed, 134 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/03/15103/3
-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 5: Verified-1

Build failed: https://jenkins.impala.io/job/gerrit-verify-dryrun/5464/


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 19:12:48 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 6:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/5530/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 6
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Mon, 27 Jan 2020 16:41:55 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/orc-metadata-utils.h
File be/src/exec/orc-metadata-utils.h:

http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/orc-metadata-utils.h@42
PS1, Line 42:   Status BuildSchemaPaths(int num_partition_keys, std::vector<SchemaPath>* col_id_path_map);
line too long (92 > 90)



-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 1
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Fri, 24 Jan 2020 09:43:23 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Norbert Luksa (Code Review)" <ge...@cloudera.org>.
Norbert Luksa has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 5: Code-Review+1

(2 comments)

http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/hdfs-orc-scanner.cc
File be/src/exec/hdfs-orc-scanner.cc:

http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/hdfs-orc-scanner.cc@203
PS1, Line 203:           root_type->toString(), filename());
> Yes, added an error code.
I see, thanks for the clarification!


http://gerrit.cloudera.org:8080/#/c/15103/1/testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
File testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test:

http://gerrit.cloudera.org:8080/#/c/15103/1/testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test@172
PS1, Line 172: ====
> Yes, they can be ommitted if the expected string is not a regex. Substring 
Great to know, thanks!
I'm okay if you leave it that way, as you find it best.



-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Mon, 27 Jan 2020 10:36:07 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Zoltan Borok-Nagy (Code Review)" <ge...@cloudera.org>.
Zoltan Borok-Nagy has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 6: Code-Review+2

Thanks for the additional comments! They really help to understand the code better.


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 6
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Mon, 27 Jan 2020 16:13:20 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 5:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/5464/ DRY_RUN=true


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 14:21:22 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 3:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/15103/3/be/src/exec/orc-metadata-utils.h
File be/src/exec/orc-metadata-utils.h:

http://gerrit.cloudera.org:8080/#/c/15103/3/be/src/exec/orc-metadata-utils.h@42
PS3, Line 42:   Status BuildSchemaPaths(int num_partition_keys, std::vector<SchemaPath>* col_id_path_map);
line too long (92 > 90)



-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 02:25:14 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 3:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/5521/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Comment-Date: Sun, 26 Jan 2020 03:09:37 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Norbert Luksa, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/15103

to look at the new patch set (#5).

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................

IMPALA-9324: Correctly handle ORC UNION type in scanner

We don't support reading UNION columns. Queries on tables containing
UNION types will fail in planning. Error message is metadata loading
error. However, scanner may need to read an ORC file with UNION types if
the table schema doesn't map to the UNION columns. Though the UNION
values won't be read, the scanner need to resolve the file schema,
including the UNION types, correctly.

In OrcSchemaResolver::BuildSchemaPath, we create a map from ORC type ids
to Impala SchemaPath representation for all types of the file. We should
deal with UNION types as well.

This patch also include some refactor to improve code readability.

Tests:
 - Add tests for table schema and file schema mismatching on all complex
   types.

Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
---
M be/src/exec/hdfs-orc-scanner.cc
M be/src/exec/orc-metadata-utils.cc
M be/src/exec/orc-metadata-utils.h
M common/thrift/generate_error_codes.py
M testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
M tests/query_test/test_scanners.py
6 files changed, 134 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/03/15103/5
-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Norbert Luksa, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/15103

to look at the new patch set (#2).

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................

IMPALA-9324: Correctly handle ORC UNION type in scanner

We don't support reading UNION columns. Queries on tables containing
UNION types will fail in planning. Error message is metadata loading
error. However, scanner may need to read an ORC file with UNION types if
the table schema doesn't map to the UNION columns. Though the UNION
values won't be read, the scanner need to resolve the file schema,
including the UNION types, correctly.

In OrcSchemaResolver::BuildSchemaPath, we create a map from ORC type ids
to Impala SchemaPath representation for all types of the file. We should
deal with UNION types as well.

This patch also include some refactor to improve code readability.

Tests:
 - Add tests for table schema and file schema mismatching on all complex
   types.

Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
---
M be/src/exec/hdfs-orc-scanner.cc
M be/src/exec/orc-metadata-utils.cc
M be/src/exec/orc-metadata-utils.h
M common/thrift/generate_error_codes.py
M testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
M tests/query_test/test_scanners.py
6 files changed, 135 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/03/15103/2
-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 2
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 7: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 7
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Gabor Kaszab <ga...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Zoltan Borok-Nagy <bo...@cloudera.com>
Gerrit-Comment-Date: Mon, 27 Jan 2020 23:38:26 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 1:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/5511/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 1
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Fri, 24 Jan 2020 10:27:54 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Norbert Luksa, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/15103

to look at the new patch set (#4).

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................

IMPALA-9324: Correctly handle ORC UNION type in scanner

We don't support reading UNION columns. Queries on tables containing
UNION types will fail in planning. Error message is metadata loading
error. However, scanner may need to read an ORC file with UNION types if
the table schema doesn't map to the UNION columns. Though the UNION
values won't be read, the scanner need to resolve the file schema,
including the UNION types, correctly.

In OrcSchemaResolver::BuildSchemaPath, we create a map from ORC type ids
to Impala SchemaPath representation for all types of the file. We should
deal with UNION types as well.

This patch also include some refactor to improve code readability.

Tests:
 - Add tests for table schema and file schema mismatching on all complex
   types.

Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
---
M be/src/exec/hdfs-orc-scanner.cc
M be/src/exec/orc-metadata-utils.cc
M be/src/exec/orc-metadata-utils.h
M common/thrift/generate_error_codes.py
M testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
M tests/query_test/test_scanners.py
6 files changed, 135 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/03/15103/4
-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>

[Impala-ASF-CR] IMPALA-9324: Correctly handle ORC UNION type in scanner

Posted by "Norbert Luksa (Code Review)" <ge...@cloudera.org>.
Norbert Luksa has posted comments on this change. ( http://gerrit.cloudera.org:8080/15103 )

Change subject: IMPALA-9324: Correctly handle ORC UNION type in scanner
......................................................................


Patch Set 1: Code-Review+1

(3 comments)

Left some minor comments, but it LGTM.

http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/hdfs-orc-scanner.cc
File be/src/exec/hdfs-orc-scanner.cc:

http://gerrit.cloudera.org:8080/#/c/15103/1/be/src/exec/hdfs-orc-scanner.cc@203
PS1, Line 203:           "Root of the selected type returned by the ORC lib is not STRUCT: $0. "
nit: this could be unified with orc-metadata-utils.cc:28, would it make sense to add an error code for this case as well?

Or are both checks necessary?


http://gerrit.cloudera.org:8080/#/c/15103/1/testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test
File testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test:

http://gerrit.cloudera.org:8080/#/c/15103/1/testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test@160
PS1, Line 160: Note that before
             : # IMPALA-9324 this query will crash.
nit: I think this comment here is not necessary.


http://gerrit.cloudera.org:8080/#/c/15103/1/testdata/workloads/functional-query/queries/DataErrorsTest/orc-type-checks.test@172
PS1, Line 172: has an incompatible ORC schema for column '$DATABASE.ill_complextypes.u',
Just a question: Isn't the fie is also part of the error msg? Can they be omitted?



-- 
To view, visit http://gerrit.cloudera.org:8080/15103
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I452d27b4e281eada00b62ac58af773a3479163ec
Gerrit-Change-Number: 15103
Gerrit-PatchSet: 1
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Norbert Luksa <no...@cloudera.com>
Gerrit-Comment-Date: Fri, 24 Jan 2020 10:50:26 +0000
Gerrit-HasComments: Yes