jdere commented on a change in pull request #582: Hive 21386: Extend the fetch 
task enhancement done in HIVE-21279 to make it work with query result cache
URL: https://github.com/apache/hive/pull/582#discussion_r271043662
 
 

 ##########
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/cache/results/QueryResultsCache.java
 ##########
 @@ -517,30 +524,26 @@ public CacheEntry addToCache(QueryInfo queryInfo, 
ValidTxnWriteIdList txnWriteId
    * @return
    */
   public boolean setEntryValid(CacheEntry cacheEntry, FetchWork fetchWork) {
-    String queryText = cacheEntry.getQueryText();
-    boolean dataDirMoved = false;
     Path queryResultsPath = null;
     Path cachedResultsPath = null;
 
     try {
-      boolean requiresMove = true;
+      // if we are here file sink op should have created files to fetch from
+      assert(fetchWork.getFilesToFetch() != null );
+
+      boolean requiresCaching = true;
       queryResultsPath = fetchWork.getTblDir();
       FileSystem resultsFs = queryResultsPath.getFileSystem(conf);
-      long resultSize;
-      if (resultsFs.exists(queryResultsPath)) {
-        ContentSummary cs = resultsFs.getContentSummary(queryResultsPath);
-        resultSize = cs.getLength();
-      } else {
-        // No actual result directory, no need to move anything.
-        cachedResultsPath = zeroRowsPath;
-        // Even if there are no results to move, at least check that we have 
permission
-        // to check the existence of zeroRowsPath, or the read using the cache 
will fail.
-        // A failure here will cause this query to not be added to the cache.
-        FileSystem cacheFs = cachedResultsPath.getFileSystem(conf);
-        boolean fakePathExists = cacheFs.exists(zeroRowsPath);
-
-        resultSize = 0;
-        requiresMove = false;
+
+      long resultSize = 0;
+      for(FileStatus fs:fetchWork.getFilesToFetch()) {
+        if(resultsFs.exists(fs.getPath())) {
+          resultSize +=  fs.getLen();
 
 Review comment:
   With the new changes you've done in HIVE-21279, is this always a file, or 
can this be a directory?
   Just confirm that FileStatus.getLen() correctly returns back the size of the 
directory's contents, if this can be a directory.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to