hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remus Rusanu (JIRA)" <>
Subject [jira] [Commented] (HIVE-16667) PostgreSQL metastore handling of CLOB types for COLUMNS_V2.TYPE_NAME and other field is incorrect
Date Thu, 18 May 2017 15:42:04 GMT


Remus Rusanu commented on HIVE-16667:

While debugging this I found that there is a relevant JDO driver setting: {{DatastoreAdapter.CLOB_SET_USING_SETSTRING}},
that controls this, see [ClobRDBMSMapping.setString|]:
    public void setString(PreparedStatement ps, int param, String value)
        if (getDatastoreAdapter().supportsOption(DatastoreAdapter.CLOB_SET_USING_SETSTRING))
            super.setString(ps, param ,value);
            setObject(ps, param, value);
    public String getString(ResultSet rs, int param)
        if (getDatastoreAdapter().supportsOption(DatastoreAdapter.CLOB_SET_USING_SETSTRING))
            return super.getString(rs, param);
        return (String) getObject(rs, param);

However, I could not find any way to *configure* this. It is pre-set for [MySQL Adapter|],
but not for PG. I don't know if the connection URL/string can somehow set this preference/setting.
My experience with Datanucleus is rather limited.

> PostgreSQL metastore handling of CLOB types for COLUMNS_V2.TYPE_NAME and other field
is incorrect
> -------------------------------------------------------------------------------------------------
>                 Key: HIVE-16667
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Remus Rusanu
>            Assignee: Naveen Gangam
>         Attachments: HiveCLIOutput.txt, PostgresDBOutput.txt
> The CLOB JDO type introduced with HIVE-12274 does not work correctly with PostgreSQL.
The value is written out-of-band and the LOB handle is written,as an INT, into the table.
SELECTs return the INT value, which should had been read via the {{lo_get}} PG built-in, and
then cast into string.
> Furthermore, the behavior is different between fields upgraded from earlier metastore
versions (they retain their string storage) vs. values inserted after the upgrade (inserted
as LOB roots).
> Teh code in {{MetasoreDirectSql.getPartitionsFromPartitionIds/extractSqlClob}} expects
the underlying JDO/Datanucleus to map the column to a {{Clob}} but that does not happen, the
value is a Java String containing the int which is the LOB root saved by PG.
> This manifests at runtime with errors like:
> {code}
> hive> select * from srcpart;
> Failed with exception Error:
type expected at the position 0 of '24030:24031' but '24030' is found.
> {code}
> the 24030:24031 should be 'string:string'.
> repro:
> {code}
> CREATE TABLE srcpart (key STRING COMMENT 'default', value STRING COMMENT 'default') PARTITIONED
PARTITION (ds="2008-04-09", hr="11");
> select * from srcpart;
> {code}
> I did not see the issue being hit by non-partitioned/textfile tables, but that is just
the luck of the path taken by the code. Inspection of my PG metastore shows all the CLOB fields
suffering from this issue.

This message was sent by Atlassian JIRA

View raw message