This is an automated email from the ASF dual-hosted git repository. michaelsmith pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 4ed6d765edfe1877b23b26e4196fd6d6d249006e Author: gaurav1086 <[email protected]> AuthorDate: Fri Nov 3 16:19:05 2023 -0700 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 <[email protected]> Tested-by: Wenzhe Zhou <[email protected]> --- fe/src/main/java/org/apache/impala/planner/DataSourceScanNode.java | 2 +- .../impala/extdatasource/jdbc/dao/GenericJdbcDatabaseAccessor.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fe/src/main/java/org/apache/impala/planner/DataSourceScanNode.java b/fe/src/main/java/org/apache/impala/planner/DataSourceScanNode.java index df95c2268..4c45b0187 100644 --- a/fe/src/main/java/org/apache/impala/planner/DataSourceScanNode.java +++ b/fe/src/main/java/org/apache/impala/planner/DataSourceScanNode.java @@ -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) { diff --git a/java/ext-data-source/jdbc/src/main/java/org/apache/impala/extdatasource/jdbc/dao/GenericJdbcDatabaseAccessor.java b/java/ext-data-source/jdbc/src/main/java/org/apache/impala/extdatasource/jdbc/dao/GenericJdbcDatabaseAccessor.java index 178a44ed6..7e106f6b3 100644 --- a/java/ext-data-source/jdbc/src/main/java/org/apache/impala/extdatasource/jdbc/dao/GenericJdbcDatabaseAccessor.java +++ b/java/ext-data-source/jdbc/src/main/java/org/apache/impala/extdatasource/jdbc/dao/GenericJdbcDatabaseAccessor.java @@ -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; });
