You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Dan Burkert (JIRA)" <ji...@apache.org> on 2017/06/29 21:15:00 UTC

[jira] [Updated] (HIVE-16993) ThriftHiveMetastore.create_database can fail if the locationUri is not set

     [ https://issues.apache.org/jira/browse/HIVE-16993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Burkert updated HIVE-16993:
-------------------------------
    Attachment: HIVE-16993.0-master.patch

> ThriftHiveMetastore.create_database can fail if the locationUri is not set
> --------------------------------------------------------------------------
>
>                 Key: HIVE-16993
>                 URL: https://issues.apache.org/jira/browse/HIVE-16993
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>            Reporter: Dan Burkert
>            Assignee: Dan Burkert
>         Attachments: HIVE-16993.0-master.patch
>
>
> Calling [{{ThriftHiveMetastore.create_database}}|https://github.com/apache/hive/blob/3fa48346d509813977cd3c7622d581c0ccd51e99/metastore/if/hive_metastore.thrift#L1078] with a database with an unset {{locationUri}} field through the C++ implementation fails with:
> {code}
> MetaException(message=java.lang.IllegalArgumentException: Can not create a Path from an empty string)
> {code}
> The [{{locationUri}}|https://github.com/apache/hive/blob/3fa48346d509813977cd3c7622d581c0ccd51e99/metastore/if/hive_metastore.thrift#L270] Thrift field is 'default requiredness (implicit)', and Thrift [does not specify|https://thrift.apache.org/docs/idl#default-requiredness-implicit] whether unset default requiredness fields are encoded.  Empirically, the Java generated code [does not write the {{locationUri}}|https://github.com/apache/hive/blob/3fa48346d509813977cd3c7622d581c0ccd51e99/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Database.java#L938-L942] when the field is unset, while the C++ generated code [does|https://github.com/apache/hive/blob/3fa48346d509813977cd3c7622d581c0ccd51e99/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp#L3888-L3890].
> The MetaStore treats the field as optional, and [fills in a default value|https://github.com/apache/hive/blob/3fa48346d509813977cd3c7622d581c0ccd51e99/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java#L867-L871] if the field is unset.
> The end result is that when the C++ implementation sends a {{Database}} without the field set, it actually writes an empty string, and the MetaStore treats it as a set field (non-null), and then calls a {{Path}} API which rejects the empty string.  The fix is simple: make the {{locationUri}} field optional in metastore.thrift.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)