asinkovits commented on a change in pull request #2199:
URL: https://github.com/apache/hive/pull/2199#discussion_r622925033
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -290,7 +290,11 @@
TxnStatus.OPEN + "') \"T\" CROSS JOIN (" +
"SELECT COUNT(*), MIN(\"TXN_ID\"), ({0} - MIN(\"TXN_STARTED\"))/1000
FROM \"TXNS\" WHERE \"TXN_STATE\"='" +
TxnStatus.ABORTED + "') \"A\" CROSS JOIN (" +
- "SELECT COUNT(*), ({0} - MIN(\"HL_ACQUIRED_AT\"))/1000 FROM
\"HIVE_LOCKS\") \"HL\"";
+ "SELECT COUNT(*), ({0} - MIN(\"HL_ACQUIRED_AT\"))/1000 FROM
\"HIVE_LOCKS\") \"HL\" CROSS JOIN (" +
+ "SELECT COUNT(*) FROM (SELECT COUNT(\"TXN_ID\"), \"T2W_DATABASE\",
\"T2W_TABLE\" FROM \"TXN_TO_WRITE_ID\" " +
+ "INNER JOIN \"TXNS\" ON \"T2W_TXNID\" = \"TXN_ID\" WHERE
\"TXN_STATE\"='" + TxnStatus.ABORTED + "' " +
+ "GROUP BY \"T2W_DATABASE\", \"T2W_TABLE\" HAVING COUNT(\"TXN_ID\") >
?) \"L\") \"L\"";
Review comment:
I've double checked having seems to be fine in all 5 databases.
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -3739,34 +3743,34 @@ public GetLatestCommittedCompactionInfoResponse
getLatestCommittedCompactionInfo
public MetricsInfo getMetricsInfo() throws MetaException {
Connection dbConn = null;
- Statement stmt = null;
try {
MetricsInfo metrics = new MetricsInfo();
String s = MessageFormat.format(SELECT_METRICS_INFO_QUERY,
getEpochFn(dbProduct));
Review comment:
I've checked this, and it seems that prepared statements cannot handle
complex queries getEpochFn returns. In case of oracle for example:
"(cast(systimestamp at time zone 'UTC' as date) - date
'1970-01-01')*24*60*60*1000 + cast(mod( extract( second from systimestamp ), 1
) * 1000 as int)"
https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java#L258
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]