hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ratandeep Ratti (JIRA)" <>
Subject [jira] [Updated] (HIVE-13115) MetaStore Direct SQL getPartitions call fail when the columns schemas for a partition are null
Date Wed, 24 Feb 2016 04:55:18 GMT


Ratandeep Ratti updated HIVE-13115:
    Attachment: HIVE-13115.reproduce.issue.patch

I've attached a patch which reproduce the issue. Though there are no test failures, since
the code falls back on ORM. But we can see the exception (I've added in the description) in
the logs. 

We can apply the patch and run the following command.
mvn clean test -Dtest=TestEmbeddedHiveMetaStore -Phadoop-2

Then check the logs in {{itests/hive-unit/target/tmp/log/hive.log}}, we can see the exception

> MetaStore Direct SQL getPartitions call fail when the columns schemas for a partition
are null
> ----------------------------------------------------------------------------------------------
>                 Key: HIVE-13115
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 1.2.1
>            Reporter: Ratandeep Ratti
>            Assignee: Ratandeep Ratti
>         Attachments: HIVE-13115.reproduce.issue.patch
> We are seeing the following exception in our MetaStore logs
> {noformat}
> 2016-02-11 00:00:19,002 DEBUG metastore.MetaStoreDirectSql (
- Direct SQL query in 5.842372ms + 1.066728ms, the query is [select "PARTITIONS"."PART_ID"
from "PARTITIONS"  inner join "TBLS" on "PART
> ITIONS"."TBL_ID" = "TBLS"."TBL_ID"     and "TBLS"."TBL_NAME" = ?   inner join "DBS" on
"TBLS"."DB_ID" = "DBS"."DB_ID"      and "DBS"."NAME" = ?  order by "PART_NAME" asc]
> 2016-02-11 00:00:19,021 ERROR metastore.ObjectStore (
- Direct SQL failed, falling back to ORM
> MetaException(message:Unexpected null for one of the IDs, SD 6437, column null, serde
6437 for a non- view)
>         at org.apache.hadoop.hive.metastore.MetaStoreDirectSql.getPartitionsViaSqlFilterInternal(
>         at org.apache.hadoop.hive.metastore.MetaStoreDirectSql.getPartitions(
>         at org.apache.hadoop.hive.metastore.ObjectStore$1.getSqlResult(
>         at org.apache.hadoop.hive.metastore.ObjectStore$1.getSqlResult(
>         at org.apache.hadoop.hive.metastore.ObjectStore$
>         at org.apache.hadoop.hive.metastore.ObjectStore.getPartitionsInternal(
>         at org.apache.hadoop.hive.metastore.ObjectStore.getPartitions(
>         at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>         at java.lang.reflect.Method.invoke(
>         at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(
>         at com.sun.proxy.$Proxy5.getPartitions(Unknown Source)
>         at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.get_partitions(
>         at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$get_partitions.getResult(
>         at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$get_partitions.getResult(
>         at org.apache.thrift.ProcessFunction.process(
>         at org.apache.thrift.TBaseProcessor.process(
>         at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge20S$Server$TUGIAssumingProcessor$
>         at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge20S$Server$TUGIAssumingProcessor$
>         at Method)
>         at
>         at
>         at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge20S$Server$TUGIAssumingProcessor.process(
>         at org.apache.thrift.server.TThreadPoolServer$
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(
>         at java.util.concurrent.ThreadPoolExecutor$
>         at
> {noformat}
> This direct SQL call fails for every {{getPartitions}} call and then falls back to ORM.
> The query which fails is
> {code}
> select 
>   left outer join SDS on PARTITIONS.SD_ID = SDS.SD_ID 
>   left outer join SERDES on SDS.SERDE_ID = SERDES.SERDE_ID 
>   where PART_ID in (  ?  ) order by PART_NAME asc;
> {code}
> By looking at the source {{}}, the third column in the query (
SDS.CD_ID), the column descriptor ID, is null, which triggers the exception. This exception
is not thrown from the ORM layer since it is more forgiving to the null column descriptor.
See {{}}
> {code}
>  List<MFieldSchema> mFieldSchemas = msd.getCD() == null ? null : msd.getCD().getCols();
> {code}
> I verified that this exception gets triggered in the first place when we add a new partition
without setting column level schemas for the partition, using the MetaStoreClient API. This
exception does not occur when adding partitions using the CLI
> I see two ways to solve the issue.
> 1. Make the MetaStoreClient API more strict and not allow creating partition without
having column level schemas set. (This could break clients which use the MetaStoreclient API)
> 2. Make the Direct SQL code path and the ORM code path more consistent, where the Direct
SQL does not fail on null column descriptor ID.
> I feel 2 is more safer and easier to fix.

This message was sent by Atlassian JIRA

View raw message