dengzhhu653 commented on a change in pull request #2344:
URL: https://github.com/apache/hive/pull/2344#discussion_r702712424



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
##########
@@ -2107,15 +2115,17 @@ private ColumnStatisticsObj 
prepareCSObjWithAdjustedNDV(Object[] row, int i,
                 makeParams(inputColNames.size()), 
makeParams(inputPartNames.size()));
             long start = doTrace ? System.nanoTime() : 0;
             Query query = pm.newQuery("javax.jdo.query.SQL", queryText);
-            Object qResult = executeWithArray(query, prepareParams(
-                catName, dbName, tableName, inputPartNames, inputColNames, 
engine), queryText);
-            MetastoreDirectSqlUtils.timingTrace(doTrace, queryText0, start, 
(doTrace ? System.nanoTime() : 0));
-            if (qResult == null) {
-              query.closeAll();
-              return Collections.emptyList();
+            try {

Review comment:
       Maybe we should need this,  `Query#execute` may return a lazy result, 
e.g, the `org.datanucleus.store.rdbms.query.ForwardQueryResult`,  closing the 
query ealier may result to the exception `Query result has been closed` when 
iterating/accessing the result later on.
   For example:
   MetaException(message:Query result has been closed)
        at 
org.apache.hadoop.hive.metastore.ObjectStore$GetHelper.handleDirectSqlError(ObjectStore.java:4298)
        at 
org.apache.hadoop.hive.metastore.ObjectStore$GetHelper.run(ObjectStore.java:4255)
        at 
org.apache.hadoop.hive.metastore.ObjectStore.getPartitionColumnStatisticsInternal(ObjectStore.java:10079)
        at 
org.apache.hadoop.hive.metastore.ObjectStore.getPartitionColumnStatistics(ObjectStore.java:9995)
        at 
org.apache.hadoop.hive.metastore.cache.TestCachedStore.testCacheUpdatePartitionColStats(TestCachedStore.java:365)
   
   on `list.size()` 
https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java#L2135




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to