Presto执行sql插入语句会建立一个临时目录/tmp/presto-root在默认文件系统,使用hdfs翻译功能时候,需要将临时文件(在hdfs://hacluster/tmp/presto-root下)mv到目标文件目录(obs://yyp/job/yy,即映射的目标文件目录),文件不能跨文件系统移动,导致错误。
java.lang.UnsupportedOperationException: can not support rename across filesystem
at com.huawei.hadoop.MRSHDFSWrapperFileSystem.rename(MRSHDFSWrapperFileSystem.java:355)
at org.apache.hadoop.fs.FilterFileSystem.rename(FilterFileSystem.java:240)
at com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore.lambda$asyncRename
24
(
S
e
m
i
T
r
a
n
s
a
c
t
i
o
n
a
l
H
i
v
e
M
e
t
a
s
t
o
r
e
.
j
a
v
a
:
1596
)
a
t
j
a
v
a
.
u
t
i
l
.
c
o
n
c
u
r
r
e
n
t
.
C
o
m
p
l
e
t
a
b
l
e
F
u
t
u
r
e
24(SemiTransactionalHiveMetastore.java:1596) at java.util.concurrent.CompletableFuture
24(SemiTransactionalHiveMetastore.java:1596)atjava.util.concurrent.CompletableFutureAsyncRun.run(CompletableFuture.java:1626)
at io.airlift.concurrent.BoundedExecutor.drainQueue(BoundedExecutor.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
解决方法,将临时目录配置为要映射的文件系统的某个目录下面,插入到目标文件系统的数据ok。但是执行presto的sql语句将表创建在presto的默认文件系统(不加location),因为临时目录已经配置了目标文件系统obs,此时不能将临时文件从obs移动到hdfs(默认文件系统)。
好的解决方法:侵入式修改presto内核的代码,临时目录像hive一样,hive是用的location目录在加几层子目录。