hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Damien Carol (JIRA)" <>
Subject [jira] [Commented] (HIVE-7689) Fix wrong lower case table names in Postgres Metastore back end
Date Thu, 02 Oct 2014 08:04:34 GMT


Damien Carol commented on HIVE-7689:

[~alangates] [[~brocknoland] Now I can confirm that without the patch, Metastore backend for
stats on postgres don't work.

when using jdbc connector for stats, {{JDBCStatsPublisher}} throws errors. Here the error
in the logs :
14/10/02 09:49:11 ERROR jdbc.JDBCStatsPublisher: Error during JDBC initialization.
org.postgresql.util.PSQLException: ERROR: relation "partition_stats_v2" already exists
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(
        at org.postgresql.core.v3.QueryExecutorImpl.execute(
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(
        at org.apache.hadoop.hive.ql.stats.jdbc.JDBCStatsPublisher.init(

It is a side effect of mixing lower case and upper case.

To understand this bug :

1. JDBC stats publisher use this code to check if table exists.
 // Check if the table exists
        DatabaseMetaData dbm = conn.getMetaData();
        rs = dbm.getTables(null, null, JDBCStatsUtils.getStatTableName(), null);
        boolean tblExists =;
        if (!tblExists) { // Table does not exist, create it
          String createTable = JDBCStatsUtils.getCreate("");

2. But {{JDBCStatsUtils.getStatTableName()}} value is {{PARTITION_STATS_V2}} in *uppercase*.
3. The Metastore try to create an already existing table.

I will create another JIRA that fix *only* this part.

> Fix wrong lower case table names in Postgres Metastore back end
> ---------------------------------------------------------------
>                 Key: HIVE-7689
>                 URL:
>             Project: Hive
>          Issue Type: Improvement
>          Components: Metastore
>    Affects Versions: 0.14.0
>            Reporter: Damien Carol
>            Assignee: Damien Carol
>            Priority: Blocker
>              Labels: metastore, postgres
>             Fix For: 0.14.0
>         Attachments: HIVE-7689.5.patch, HIVE-7689.6.patch, HIVE-7689.7.patch, HIVE-7689.8.patch,
HIVE-7689.9.patch, HIVE-7889.1.patch, HIVE-7889.2.patch, HIVE-7889.3.patch, HIVE-7889.4.patch
> Current 0.14 patch create table with lower case names.
> This patch fix wrong lower case tables names in Postgres Metastore back end.
> Mixing lower case and upper case throws bugs in {{JDBCStatsPublisher}}

This message was sent by Atlassian JIRA

View raw message