IMPALA-12470 (PART-2): delete temporary file in

/tmp after class loaded

This patch fixes the bug added in the previous patch for IMPALA-12470.
It adds the prefix "file://" to the unix standard path string to
create the corresponding valid hadoop.fs.Path object. For example:
"/tmp" is converted to "file:///tmp".

Testing:
1. Deleted all the jar files in the /tmp directory.
2. Ran the local jdbc ext data sources tests:
  - impala-py.test tests/query_test/test_ext_data_sources.py
  - impala-py.test tests/custom_cluster/test_ext_data_sources.py
3. Upon completion of the tests successfully, Verified that there were
   no .jar files in the /tmp directory.

Change-Id: Iab7cc66383bc62f209987dd3fb42fc3fc6604726
Reviewed-on: http://gerrit.cloudera.org:8080/20654
Reviewed-by: Wenzhe Zhou <wzhou@cloudera.com>
Tested-by: Wenzhe Zhou <wzhou@cloudera.com>
This commit is contained in:
gaurav1086
2023-11-03 16:19:05 -07:00
committed by Wenzhe Zhou
parent 543bcf42c0
commit 4ed6d765ed
2 changed files with 2 additions and 2 deletions

View File

@@ -194,7 +194,7 @@ public class DataSourceScanNode extends ScanNode {
DataSource.debugString(table_.getDataSource())), e);
} finally {
// Delete the jar file once its loaded
Path localJarPath = new Path(localPath);
Path localJarPath = new Path("file://" + localPath);
FileSystemUtil.deleteIfExists(localJarPath);
}
if (prepareStatus.getStatus_code() != TErrorCode.OK) {

View File

@@ -251,7 +251,7 @@ public class GenericJdbcDatabaseAccessor implements DatabaseAccessor {
getClass().getClassLoader());
basicDataSource.setDriverClassLoader(driverLoader);
// Delete the jar file once its loaded
Path localJarPath = new Path(driverLocalPath);
Path localJarPath = new Path("file://" + driverLocalPath);
FileSystemUtil.deleteIfExists(localJarPath);
return basicDataSource;
});