[
https://issues.apache.org/jira/browse/HIVE-8329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14156208#comment-14156208
]
Damien Carol commented on HIVE-8329:
------------------------------------
when using jdbc connector for stats, JDBCStatsPublisher throws errors. Here the
error in the logs :
{noformat}
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(QueryExecutorImpl.java:2096)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1829)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:510)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:372)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:300)
at
org.apache.hadoop.hive.ql.stats.jdbc.JDBCStatsPublisher.init(JDBCStatsPublisher.java:286)
{noformat}
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.
{code}
// Check if the table exists
DatabaseMetaData dbm = conn.getMetaData();
rs = dbm.getTables(null, null, JDBCStatsUtils.getStatTableName(), null);
boolean tblExists = rs.next();
if (!tblExists) { // Table does not exist, create it
String createTable = JDBCStatsUtils.getCreate("");
stmt.executeUpdate(createTable);
}
{code}
2. But {{JDBCStatsUtils.getStatTableName()}} value is {{PARTITION_STATS_V2}} in
*uppercase*.
3. The Metastore try to create an already existing table.
> Enable postgres for storing stats
> ---------------------------------
>
> Key: HIVE-8329
> URL: https://issues.apache.org/jira/browse/HIVE-8329
> Project: Hive
> Issue Type: Bug
> Components: Statistics
> Affects Versions: 0.14.0
> Reporter: Damien Carol
> Assignee: Damien Carol
> Priority: Blocker
> Fix For: 0.14.0
>
>
> Simple patch to enable postgresql as JDBC publisher for statistics.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)