Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IMPALA-3314/IMPALA-3513: Fix querying tables/partitions altered to Av…
…ro format Bug: Impalads crash if we query an Avro table with stale metadata Cause: This happens because avroSchema_ is not set in HdfsTable, which is not propagated to the avro scanner and it doesn't have appropriate checks to make sure the schema is non-null. The patch fixes the following. 1. Avro scanner should gracefully handle the case where the avro schema is not set. Appropriate null checks and a meaning error message have been added. 2. This is a special case with multi-fileformat partitioned tables. avroSchema_ should be set in HdfsTable even if any subset of the partitions are backed by avro. Without this patch, we only set it if the base table file format is Avro. Change-Id: I09262d3a7b85a2263c721f3beafd0cab2a1bdf4b Reviewed-on: http://gerrit.cloudera.org:8080/3136 Reviewed-by: Bharath Vissapragada <bharathv@cloudera.com> Tested-by: Internal Jenkins
- Loading branch information
Bharath Vissapragada
authored and
Internal Jenkins
committed
May 21, 2016
1 parent
a8ead31
commit 6d90f47
Showing
6 changed files
with
107 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
testdata/workloads/functional-query/queries/QueryTest/avro-stale-schema.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
==== | ||
---- QUERY | ||
CREATE EXTERNAL TABLE alltypesagg_staleschema ( | ||
id INT, | ||
bool_col BOOLEAN, | ||
tinyint_col INT, | ||
smallint_col INT, | ||
int_col INT, | ||
bigint_col BIGINT, | ||
float_col FLOAT, | ||
double_col DOUBLE, | ||
date_string_col STRING, | ||
string_col STRING, | ||
timestamp_col STRING | ||
) | ||
LOCATION 'hdfs://localhost:20500//test-warehouse/alltypesaggmultifilesnopart_avro_snap' | ||
TBLPROPERTIES ('avro.schema.url'= '/test-warehouse/avro_schemas/functional/alltypesaggmultifilesnopart.json') | ||
==== | ||
---- QUERY | ||
alter table alltypesagg_staleschema set fileformat avro | ||
==== | ||
---- QUERY | ||
select count(*) from alltypesagg_staleschema | ||
---- CATCH | ||
Missing Avro schema in scan node. This could be due to stale metadata. | ||
==== | ||
---- QUERY | ||
invalidate metadata alltypesagg_staleschema | ||
==== | ||
---- QUERY | ||
select count(*) from alltypesagg_staleschema | ||
---- RESULTS | ||
11000 | ||
---- TYPES | ||
bigint | ||
==== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters