Bharath Vissapragada has submitted this change and it was merged.

Change subject: CDH-41511: Fix the preconditions check in 
HdfsTable#setAvroSchema()
......................................................................


CDH-41511: Fix the preconditions check in HdfsTable#setAvroSchema()

In HdfsTable#setAvroSchema(), we rely on an incorrect precondition
check(!nonPartFieldSchemas_.isEmpty()) to make sure loadSchema() is
called. However nonPartFieldSchemas_ can still be empty for Avro
tables created using older versions of Hive. We take care of this
in the schema reconciliation step where we read the Avro schema to
populate the column list. This incorrect check prevents the Catalog
from reaching the schema reconciliation code path.

Fix: Added a new flag isSchemaLoaded_ and setAvroSchema() uses it
to check if the schema has been loaded properly.

Testing: I couldn't reproduce the issue directly by creating Avro
tables without any columns. So, I manually deleted the entries from
"COLUMNS_V2" table in the hms db to make sure to hit the incorrect
preconditions check. Applying this patch fixed it and Impala loaded
the table correctly and I can query it now.

Change-Id: I02b6852385d4f4b470f763308817991e60557060
Reviewed-on: http://gerrit.cloudera.org:8080/3446
Reviewed-by: Bharath Vissapragada <[email protected]>
Reviewed-by: Marcel Kornacker <[email protected]>
Reviewed-by: Dan Hecht <[email protected]>
Tested-by: Bharath Vissapragada <[email protected]>
---
M fe/src/main/java/com/cloudera/impala/catalog/HdfsTable.java
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Marcel Kornacker: Looks good to me, approved
  Bharath Vissapragada: Looks good to me, but someone else must approve; 
Verified
  Dan Hecht: Looks good to me, approved



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I02b6852385d4f4b470f763308817991e60557060
Gerrit-PatchSet: 2
Gerrit-Project: Impala
Gerrit-Branch: cdh5-2.6.0_5.8.0
Gerrit-Owner: Bharath Vissapragada <[email protected]>
Gerrit-Reviewer: Bharath Vissapragada <[email protected]>
Gerrit-Reviewer: Dan Hecht <[email protected]>
Gerrit-Reviewer: Marcel Kornacker <[email protected]>

Reply via email to