“不是文件”插入成功后选择异常 [英] "Not a file" exception on select after successful insert

查看:131
本文介绍了“不是文件”插入成功后选择异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个表:

  DROP TABLE IF EXISTS sampleout; 

CREATE EXTERNAL TABLE sampleout(
id bigint,
LNG FLOAT,
LAT FLOAT,
GMTDateTime TIMESTAMP,
计算列FLOAT


行格式限定字段','
存储为文本文件位置'wasb://sampleout@xxxxxx.blob.core.windows.net/';

然后我从这个查询中获得了成功:

 插入到表格sampleout中select *,0 as samplecolumncolumn from sampletable 



sampleout sampletable 相同,除了额外的列 calculatedcolumn 。插入成功后,我打开blob存储并打开文本文件以验证数据是否位于指定的文本文件位置。

然而...

  select * from sampleout limit 10 

会返回以下错误:

 使用文件中的配置初始化日志记录:/ C:/apps/dist/hive-0.13.0.2.1.12.1-0003/conf/hive-log4j.properties 
SLF4J:类路径包含多个SLF4J绑定。
SLF4J:在[jar:file:/ C:/apps/dist/hadoop-2.4.0.2.1.12.1-0003/share/hadoop/common/lib/slf4j-log4j12-1.7.5中找到绑定。 jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J:在[jar:file:/ C:/apps/dist/hbase-0.98.0.2.1.12.1-0003-hadoop2/lib中找到绑定/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J:有关说明,请参阅http://www.slf4j.org/codes.html#multiple_bindings。
SLF4J:实际绑定类型为[org.slf4j.impl.Log4jLoggerFactory] ​​
OK
失败,异常java.io.IOException:java.io.IOException:不是文件:wasb: //sampleout@xxxxxx.blob.core.windows.net/hive
花费的时间:3.032秒

我怎样才能成功插入,但不能从表中选择?请注意,该错误显示'/ hive'被添加到create中指定的文本文件位置。

解决方案

基本上,位于根目录的TEXTFILE位置。即使它是blob存储(没有真正的文件夹),HDFS所需的结构或其他东西都希望您至少使用一个子文件夹。



wasb://sampleout@xxxxxx.blob.core.windows.net/





wasb://sampleout@xxxxxx.blob.core.windows.net/somefolder/



解决了这个问题。信用: https://stackoverflow.com/users/4951010/andrew-moll


I have created a table:

DROP TABLE IF EXISTS sampleout;

CREATE EXTERNAL TABLE sampleout(
    id bigint,
    LNG FLOAT,
    LAT FLOAT,
    GMTDateTime TIMESTAMP,
    calculatedcolumn FLOAT
    )

ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' 
STORED AS TEXTFILE LOCATION 'wasb://sampleout@xxxxxx.blob.core.windows.net/';

I then got a success from this query:

INSERT into TABLE   sampleout  select *, 0 as calculatedcolumn from sampletable

sampleout is the same as sampletable except for the extra column calculatedcolumn. After the successful insert, I opened the blob storage and opened the text file to verify the data is in the specified textfile location.

However...

select * from sampleout limit 10

returns the following error:

Logging initialized using configuration in file:/C:/apps/dist/hive-0.13.0.2.1.12.1-0003/conf/hive-log4j.properties
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/apps/dist/hadoop-2.4.0.2.1.12.1-0003/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/apps/dist/hbase-0.98.0.2.1.12.1-0003-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
OK
Failed with exception java.io.IOException:java.io.IOException: Not a file: wasb://sampleout@xxxxxx.blob.core.windows.net/hive
Time taken: 3.032 seconds

how is it that I can successfully insert, but cannot select from the table? Note that the error shows '/hive' added to the textfile location specified in the create.

解决方案

Basically, do not put the TEXTFILE LOCATION at the root. Even though it is blob storage (no true folders), the structure needed by HDFS or something else wants you to use at least one sub folder in the location.

Moving from

wasb://sampleout@xxxxxx.blob.core.windows.net/

to

wasb://sampleout@xxxxxx.blob.core.windows.net/somefolder/

fixed the issue. Credit: https://stackoverflow.com/users/4951010/andrew-moll

这篇关于“不是文件”插入成功后选择异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆