[
https://issues.apache.org/jira/browse/HIVE-25803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17798113#comment-17798113
]
Ayush Saxena commented on HIVE-25803:
-------------------------------------
[~hemanth619] Did some investigation
This should be the fix
{noformat}
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 0823b6d9ba..9ab3569c20 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -8051,8 +8051,14 @@ protected Operator genFileSinkPlan(String dest, QB qb,
Operator input)
loadFileDesc.setMoveTaskId(moveTaskId);
loadFileWork.add(loadFileDesc);
try {
+ FileSystem fs;
+ if (!isDfsDir) {
+ fs = FileSystem.getLocal(conf);
+ } else {
+ fs = destinationPath.getFileSystem(conf);
+ }
Path qualifiedPath =
conf.getBoolVar(ConfVars.HIVE_RANGER_USE_FULLY_QUALIFIED_URL) ?
-
destinationPath.getFileSystem(conf).makeQualified(destinationPath) :
destinationPath;
+ fs.makeQualified(destinationPath) : destinationPath;
if (!outputs.add(new WriteEntity(qualifiedPath, !isDfsDir,
isDestTempFile))) {
throw new
SemanticException(ErrorMsg.OUTPUT_SPECIFIED_MULTIPLE_TIMES
.getMsg(destinationPath.toUri().toString()));
{noformat}
The FileSystem in case full path isn't specified is getting resolved to
DefaultFs, but in case of Local it should use the LocalFileSystem rather than
the Default FileSystem.
It isn't HDFS specific but DefaultFs specific, I am changing the title of the
ticket
> URL Mapping appends hdfs:// even for LOCAL DIRECTORY ops
> --------------------------------------------------------
>
> Key: HIVE-25803
> URL: https://issues.apache.org/jira/browse/HIVE-25803
> Project: Hive
> Issue Type: Bug
> Components: Authorization, HiveServer2
> Affects Versions: 4.0.0
> Reporter: Soumitra Sulav
> Assignee: Sai Hemanth Gantasala
> Priority: Critical
>
> Repro steps:
> Connect to beeline
> {code:java}
> beeline -u
> "jdbc:hive2://quasar-pxlypi-2.quasar-pxlypi.root.hwx.site:10001/;principal=hive/[email protected];ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks;trustStorePassword=VOAnRk5l4oXsg0upJ1ApscSuNksirOKgyhJvoPv2o4j;transportMode=http;httpPath=cliservice;"
> {code}
>
> Create a test table and run insert on local
> {code:java}
> > create table dual (id int);
> > insert overwrite local directory "/tmp/" select * from dual;
> {code}
> {code:java}
> Error: Error while compiling statement: FAILED: HiveAccessControlException
> Permission denied: user [hrt_qa] does not have [ALL] privilege on
> [hdfs://ns1/tmp] (state=42000,code=40000)
> {code}
> It always appends hdfs:// to the path even if the operation is meant for
> local directory.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)