hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (HIVE-21279) Avoid moving/rename operation in FileSink op for SELECT queries
Date Mon, 01 Apr 2019 20:53:00 GMT

     [ https://issues.apache.org/jira/browse/HIVE-21279?focusedWorklogId=221468&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-221468
]

ASF GitHub Bot logged work on HIVE-21279:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Apr/19 20:52
            Start Date: 01/Apr/19 20:52
    Worklog Time Spent: 10m 
      Work Description: jdere commented on 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_r271044849
 
 

 ##########
 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();
+        } else {
+          // No actual result directory, no need to cache anything.
+          requiresCaching = false;
 
 Review comment:
   This is a loop over a list of FileStatus objects, but if _any_ of these files does not
exist it bails out and goes to the requiresCaching=false case. If it is ever possible for
fetchWork.getFilesToFetch() have a mix of both existing and non-existing files, then this
logic is probably incorrect.
 
----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 221468)
    Time Spent: 50m  (was: 40m)

> Avoid moving/rename operation in FileSink op for SELECT queries
> ---------------------------------------------------------------
>
>                 Key: HIVE-21279
>                 URL: https://issues.apache.org/jira/browse/HIVE-21279
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Planning
>            Reporter: Vineet Garg
>            Assignee: Vineet Garg
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>         Attachments: HIVE-21279.1.patch, HIVE-21279.10.patch, HIVE-21279.11.patch, HIVE-21279.12.patch,
HIVE-21279.13.patch, HIVE-21279.2.patch, HIVE-21279.3.patch, HIVE-21279.4.patch, HIVE-21279.5.patch,
HIVE-21279.6.patch, HIVE-21279.7.patch, HIVE-21279.8.patch, HIVE-21279.9.patch
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Currently at the end of a job FileSink operator moves/rename temp directory to another
directory from which FetchTask fetches result. This is done to avoid fetching potential partial/invalid
files by failed/runway tasks. This operation is expensive for cloud storage. It could be avoided
if FetchTask is passed on set of files to read from instead of whole directory.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message