Hive:dfs copyToLocal给出" org.apache.hive.service.cli.HiveSQLException:处理语句时出错:null"

时间:2016-12-19 13:58:51

标签: hadoop hive

我正在努力做一个“复制地方”。来自.hql文件,如下所示:

dfs -copyToLocal hdfs://nameservice1/HDFS_FOLDER1/HDFS_FOLDER2/file_name.dat /LOCAL_FOLDER1/LOCAL_FOLDER2/;

但我得到以下提到的异常:

Error: Error while processing statement: null (state=,code=1)
    org.apache.hive.service.cli.HiveSQLException: Error while processing statement: null
            at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:239)
            at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:225)
            at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:244)
            at org.apache.hive.beeline.Commands.executeInternal(Commands.java:902)
            at org.apache.hive.beeline.Commands.execute(Commands.java:1089)
            at org.apache.hive.beeline.Commands.sql(Commands.java:985)
            at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:1085)
            at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:917)
            at org.apache.hive.beeline.BeeLine.executeFile(BeeLine.java:895)
            at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:837)
            at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:482)
            at org.apache.hive.beeline.BeeLine.main(BeeLine.java:465)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
            at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
    Caused by: org.apache.hive.service.cli.HiveSQLException: Error while processing statement: null
            at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:385)
            at org.apache.hive.service.cli.operation.HiveCommandOperation.runInternal(HiveCommandOperation.java:116)
            at org.apache.hive.service.cli.operation.Operation.run(Operation.java:327)
            at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:424)
            at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:401)
            at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
            at org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36)
            at org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:63)
            at java.security.AccessController.doPrivileged(Native Method)
            at javax.security.auth.Subject.doAs(Subject.java:422)
            at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1709)
            at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:59)
            at com.sun.proxy.$Proxy21.executeStatementAsync(Unknown Source)
            at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:258)
            at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:500)
            at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1313)
            at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298)
            at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
            at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
            at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge$Server$TUGIAssumingProcessor.process(HadoopThriftAuthBridge.java:746)
            at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

但是当我在一段时间后使用相同的.hql文件执行相同的语句时,它会按预期复制到本地。 任何人都可以帮助我理解为什么这样会发生什么?

Version: Hive 1.1.0-cdh5.8.3

更新1 :我使用" get"而不是" copyToLocal"并得到了同样的例外。

更新2 :此文件包含粘贴位:

-rwxrwxrwt .....  /HDFS_FOLDER1/HDFS_FOLDER2/file_name.dat

我是创建该文件的用户,我正在尝试使用HQL文件中的dfs选项将其从HDFS复制到本地文件夹。

2 个答案:

答案 0 :(得分:1)

HADOOP COMMAND ,用于复制到本地文件位置。

hdfs dfs -copyToLocal <input> <output>

以下是您的确切示例:

hdfs dfs -copyToLocal /nameservice1/HDFS_FOLDER1/HDFS_FOLDER2/file_name.dat /LOCAL_FOLDER1/LOCAL_FOLDER2;

这是已弃用的版本:

hadoop fs -copyToLocal /nameservice1/HDFS_FOLDER1/HDFS_FOLDER2/file_name.dat /LOCAL_FOLDER1/LOCAL_FOLDER2;

HIVE COMMAND ,用于将文件复制到本地文件位置。

 INSERT OVERWRITE LOCAL DIRECTORY '/your/directory/in/local' SELECT * FROM myTable

答案 1 :(得分:0)

我正在使用java进行某些中间逻辑操作。 我必须得到一个

org.apache.hadoop.fs.FileSystem

对象并执行

fileSystem.copyToLocalFile(new Path("hdfs://nameservice1/HDFS_FOLDER1/HDFS_FOLDER2/file_name.dat"), new Path(localDir));