hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bing Li (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-4577) hive CLI can't handle hadoop dfs command with space and quotes.
Date Mon, 04 Jan 2016 15:17:39 GMT

    [ https://issues.apache.org/jira/browse/HIVE-4577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15081257#comment-15081257
] 

Bing Li commented on HIVE-4577:
-------------------------------

Hi, [~ashutoshc]
Thank you for your suggestion, I'm afraid we can't use GenericOptionsParser in Hive.

In hadoop, before it runs into FsShell.main(), Linux shell already parses the parameters.
When it calls 
res = ToolRunner.run(shell, argv);  // " or ' already been removed from argv

For example,
[root@localhost bin]# hadoop fs -ls "ha ah"
/usr/jdk64/java-1.8.0-openjdk-1.8.0.45-28.b13.el6_6.x86_64/bin/java ... org.apache.hadoop.fs.FsShell
-ls ha ah
[root@localhost bin]# hadoop fs -ls 'a'
/usr/jdk64/java-1.8.0-openjdk-1.8.0.45-28.b13.el6_6.x86_64/bin/java ... org.apache.hadoop.fs.FsShell
-ls a

While in Hive, after launch HiveCLI, org.apache.hadoop.hive.cli.CliDriver will handle the
left inputs.
Which means that the java class in Hive should parse the input with " or ' by itself.

That's the reason I added a customized splitCmd() method.

Thank you,
Bing

> hive CLI can't handle hadoop dfs command  with space and quotes.
> ----------------------------------------------------------------
>
>                 Key: HIVE-4577
>                 URL: https://issues.apache.org/jira/browse/HIVE-4577
>             Project: Hive
>          Issue Type: Bug
>          Components: CLI
>    Affects Versions: 0.9.0, 0.10.0, 0.14.0, 0.13.1, 1.2.0, 1.1.0
>            Reporter: Bing Li
>            Assignee: Bing Li
>         Attachments: HIVE-4577.1.patch, HIVE-4577.2.patch, HIVE-4577.3.patch.txt, HIVE-4577.4.patch
>
>
> As design, hive could support hadoop dfs command in hive shell, like 
> hive> dfs -mkdir /user/biadmin/mydir;
> but has different behavior with hadoop if the path contains space and quotes
> hive> dfs -mkdir "hello"; 
> drwxr-xr-x   - biadmin supergroup          0 2013-04-23 09:40 /user/biadmin/"hello"
> hive> dfs -mkdir 'world';
> drwxr-xr-x   - biadmin supergroup          0 2013-04-23 09:43 /user/biadmin/'world'
> hive> dfs -mkdir "bei jing";
> drwxr-xr-x   - biadmin supergroup          0 2013-04-23 09:44 /user/biadmin/"bei
> drwxr-xr-x   - biadmin supergroup          0 2013-04-23 09:44 /user/biadmin/jing"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message