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

Eugene Koifman commented on HIVE-13912:
---------------------------------------

I think fixing this in addLimitClause is not easy: you'd have to reparse the 
sql to find if it has column names that will conflict without table qualifier 
which is not trivial in a general case.  And then you'd have to alias the 
columns, which means that the projections will now have different names in the 
ResultSet so if someone is accessing them by name, that will also be a problem.

> DbTxnManager.commitTxn(): ORA-00918: column ambiguously defined
> ---------------------------------------------------------------
>
>                 Key: HIVE-13912
>                 URL: https://issues.apache.org/jira/browse/HIVE-13912
>             Project: Hive
>          Issue Type: Bug
>          Components: Transactions
>    Affects Versions: 1.3.0, 2.1.0
>            Reporter: Eugene Koifman
>            Assignee: Eugene Koifman
>            Priority: Blocker
>         Attachments: HIVE-13912.patch
>
>
> {noformat}
> Caused by: MetaException(message:Unable to update transaction database 
> java.sql.SQLSyntaxErrorException: ORA-00918: column ambiguously defined
>       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
>       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
>       at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
>       at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
>       at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
>       at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
>       at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
>       at 
> oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:852)
>       at 
> oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
>       at 
> oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
>       at 
> oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1477)
>       at 
> oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:392)
>       at 
> com.jolbox.bonecp.StatementHandle.executeQuery(StatementHandle.java:464)
>       at 
> org.apache.hadoop.hive.metastore.txn.TxnHandler.commitTxn(TxnHandler.java:662)
>       at 
> org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.commit_txn(HiveMetaStore.java:5864)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at 
> org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:140)
>       at 
> org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:99)
>       at com.sun.proxy.$Proxy49.commit_txn(Unknown Source)
>       at 
> org.apache.hadoop.hive.metastore.HiveMetaStoreClient.commitTxn(HiveMetaStoreClient.java:2090)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at 
> org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:154)
>       at com.sun.proxy.$Proxy50.commitTxn(Unknown Source)
>       at 
> org.apache.hadoop.hive.ql.lockmgr.DbTxnManager$SynchronizedMetaStoreClient.commitTxn(DbTxnManager.java:655)
>       at 
> org.apache.hadoop.hive.ql.lockmgr.DbTxnManager.commitTxn(DbTxnManager.java:356)
>       at 
> org.apache.hadoop.hive.ql.Driver.releaseLocksAndCommitOrRollback(Driver.java:1024)
>       at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1321)
>       at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1083)
>       at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1071)
> {noformat}
> caused by 
> {noformat}
>             (sqlGenerator.addLimitClause(1, "committed.ws_txnid, 
> committed.ws_commit_id, committed.ws_database," +
>               "committed.ws_table, committed.ws_partition, cur.ws_commit_id " 
> +
>               "from WRITE_SET committed INNER JOIN WRITE_SET cur " +
>               "ON committed.ws_database=cur.ws_database and 
> committed.ws_table=cur.ws_table " +
>               //For partitioned table we always track writes at partition 
> level (never at table)
>               //and for non partitioned - always at table level, thus the 
> same table should never
>               //have entries with partition key and w/o
>               "and (committed.ws_partition=cur.ws_partition or 
> (committed.ws_partition is null and cur.ws_partition is null)) " +
>               "where cur.ws_txnid <= committed.ws_commit_id" + //txns 
> overlap; could replace ws_txnid
>               // with txnid, though any decent DB should infer this
>               " and cur.ws_txnid=" + txnid + //make sure RHS of join only has 
> rows we just inserted as
>               // part of this commitTxn() op
>               " and committed.ws_txnid <> " + txnid + //and LHS only has 
> committed txns
>               //U+U and U+D is a conflict but D+D is not and we don't 
> currently track I in WRITE_SET at all
>               " and (committed.ws_operation_type=" + 
> quoteChar(OpertaionType.UPDATE.sqlConst) +
>               " OR cur.ws_operation_type=" + 
> quoteChar(OpertaionType.UPDATE.sqlConst) + ")"));
> {noformat}
> because addLimitClause on Oracle does
> _select * from (select  .....) where rownum <= N_
> so if original query has a join...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to