2016-11-16 64 views
0

此刻我只能在dfs.tmp.工作区工作,这很烦人。于是,我就change the default workspace到一个新的(现有的)文件夹(钻用户自备):Apache Drill无法设置默认工作区

"workspaces": { 
    "default": { 
     "location": "/var/drill", 
     "writable": true, 
     "defaultInputFormat": null 
    }, 
    "root": { 
     "location": "/", 
     "writable": false, 
     "defaultInputFormat": null 
    }, 
... 

但它不工作:

CREATE TABLE `test` as SELECT 'Test' FROM (VALUES(1)) 

返回下面的错误,这表明修改设置会被忽略。

org.apache.drill.common.exceptions.UserRemoteException: PARSE ERROR: Root schema is immutable. Creating or dropping tables/views is not allowed in root schema.Select a schema using 'USE schema' command.

我也前缀(没有成功)试了一下

CREATE TABLE dfs.default.`test` as SELECT 'Test' FROM (VALUES(1)) 

PARSE ERROR: Encountered ". default" at line 1, column 17.

而且还试图重新启动钻机,使root写入。

回答

1

添加此答案仅用于结合ColemanTO和devツ 中的两个现有示例并显示示例。

因此,就像迄今为止所说的其他答案一样,在钻取查询中保留单词“default”。您正确地引用docs来表示创建一个新的默认工作区,以便定义可写入的根(/)工作区。然而,documentation也给出了一个例子,为了实际引用自定义的“默认”工作区,您需要添加反引号。

所以,如果你增加了一个工作区

{ 
    "type": "file", 
    "enabled": true, 
    "connection": "hdfs:///", 
    "config": null, 
    "workspaces": { 
    "default": { 
     "location": "/some/path", 
     "writable": true, 
     "defaultInputFormat": null 
    } 
    ... 
    } 
... 
} 

你指的是在一个查询,如:

SELECT * FROM dfs.`default`.`path/relative/to/custom/default/location` LIMIT 10; 

在你的原贴的问题的情况下,你也可以创建一个新的工作区称为“var_drill”,这样您就不必在查询中从关键字“default”中跳出。

0

在工作区中使用除default之外的其他任何名称。

defaultreserved keyword为钻。 “

+0

我知道!但在手册中声明,我必须覆盖“默认”工作区以更改我的默认工作区!只需看看:https://drill.apache.org/docs/workspaces/ – NaN

0

”注意:默认值是一个保留字,您必须在保留字中包含保留字作为后备符号中的标识符。“

0

是默认值是一个保留关键字,它应该反引号