hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Naveen Gangam (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-16667) PostgreSQL metastore handling of CLOB types for COLUMNS_V2.TYPE_NAME and other field is incorrect
Date Wed, 07 Jun 2017 03:28:18 GMT

    [ https://issues.apache.org/jira/browse/HIVE-16667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040097#comment-16040097
] 

Naveen Gangam commented on HIVE-16667:
--------------------------------------

The unit test failures are related to the patch. I had not specified VARCHAR length in the
mapping hoping the datanucleus would map it max length permitted for {{java.lang.String}}.
Based on the error message in the test failures {{Caused by: java.sql.SQLDataException: A
truncation error was encountered trying to shrink VARCHAR '{"BASIC_STATS":"true","COLUMN_STATS":{"c_bigint":"true","c_b&'
to length 255}}
it appears that it is attempting to limit to 255 which is too short. I then tried testing
with max length which also caused problems with DERBY as it has a checks the lengh
https://fossies.org/dox/db-derby-10.13.1.1-src/interfaceorg_1_1apache_1_1derby_1_1iapi_1_1reference_1_1Limits.html#a4e223303a7751ae27dfdd8e62e993588

So for I think we are kinda limited to ~32k for max value. As this is an improvement compared
to where we were at and only a limitation for derby, we should use this value for this release
and fix the postgres issue in the next release.

I am uploading a patch with a length in the JDO mapping file. 

> PostgreSQL metastore handling of CLOB types for COLUMNS_V2.TYPE_NAME and other field
is incorrect
> -------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-16667
>                 URL: https://issues.apache.org/jira/browse/HIVE-16667
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Remus Rusanu
>            Assignee: Naveen Gangam
>         Attachments: HIVE-16667.2.patch, HIVE-16667.3.patch, HIVE-16667.patch, 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 java.io.IOException:java.lang.IllegalArgumentException: 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
BY (ds STRING, hr STRING) STORED AS TEXTFILE;
> LOAD DATA LOCAL INPATH "${hiveconf:test.data.dir}/kv1.txt" OVERWRITE INTO TABLE srcpart
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
(v6.3.15#6346)

Mime
View raw message