[ https://issues.apache.org/jira/browse/HIVE-3242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13408505#comment-13408505 ]
Zhenxiao Luo commented on HIVE-3242: ------------------------------------ if dfs -ls file, when the file does not exist, hadoop0.20 returns exit code -1, and hadoop0.23 returns exit code 1. Is this correct? For example, in hive, for the following dfs command: dfs -ls ../build/ql/tmp/hbase/hbase_table_0; If the file does not exist, get exit code -1 on hadoop0.20, and exit code 1 on hadoop0.23. A brief read of hadoop code, on hadoop 0.20(FsShell.java): private int ls(String srcf, boolean recursive) throws IOException { Path srcPath = new Path(srcf); FileSystem srcFs = srcPath.getFileSystem(this.getConf()); FileStatus[] srcs = srcFs.globStatus(srcPath); if (srcs==null || srcs.length==0) { throw new FileNotFoundException("Cannot access " + srcf + ": No such file or directory."); } boolean printHeader = (srcs.length == 1) ? true: false; int numOfErrors = 0; for(int i=0; i<srcs.length; i++) { numOfErrors += ls(srcs[i], srcFs, recursive, printHeader); } return numOfErrors == 0 ? 0 : -1; } So, it returns -1 on non-exist file. While, on hadoop0.23(Command.java): public int run(String...argv) { LinkedList<String> args = new LinkedList<String>(Arrays.asList(argv)); try { if (isDeprecated()) { displayWarning( "DEPRECATED: Please use '"+ getReplacementCommand() + "' instead."); } processOptions(args); processRawArguments(args); } catch (IOException e) { displayError(e); } return (numErrors == 0) ? exitCode : exitCodeForError(); } /** The exit code to be returned if any errors occur during execution. This method is needed to account for the inconsistency in the exit codes returned by various commands. @return a non-zero exit code */ protected int exitCodeForError() { return 1; } So, it returns 1 on non-exist file. The return exit code is always non-zero on non-exist file, while, it is 1 on hadoop0.23, and -1 on hadoop0.20. Plan to have separate qfile and expected output for hadoop0.20 and hadoop0.23 > Fix cascade_dbdrop.q when building hive on hadoop0.23 > ----------------------------------------------------- > > Key: HIVE-3242 > URL: https://issues.apache.org/jira/browse/HIVE-3242 > Project: Hive > Issue Type: Bug > Reporter: Zhenxiao Luo > Assignee: Zhenxiao Luo > > cascade_dbdrop.q is failing when building hive on hadoop0.23: > Failing with the following diff: > -Command failed with exit code = -1 > +Command failed with exit code = 1 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira