Apache:Drill 无法创建视图

问题描述 投票:0回答:1

我是 Apache Drill 的新手。我尝试将两个工作区中的文件放在一个视图中以查看便捷查询,但出现错误。

我尝试使用SQL语句构建视图,将两个工作区的数据整合到一个视图中,语句如下:

CREATE VIEW data_access.all_channels_view AS (
SELECT
     columns[0] as channel_number,
     columns[1] as stimestamp,
     columns[2] as svalue,
     'channel_0' as channel
FROM
     data_access.channel_0.`*.txt`
UNION ALL
SELECT
     columns[0] as channel_number,
     columns[1] as stimestamp,
     columns[2] as svalue,
     'channel_1' as channel
FROM
     data_access.channel_1.`*.txt`);

错误是:

Error: VALIDATION ERROR: Unable to create or drop objects. Schema [data_access] is immutable.

我保证我的所有工作区都设置为可写,如下:

{
  "type": "file",
  "connection": "file:///",
  "workspaces": {
    "channel_0": {
      "location": "C:\\Users\\Admin\\Desktop\\DataFiles\\Channel_0",
      "writable": true,
      "defaultInputFormat": null,
      "allowAccessOutsideWorkspace": true
    },
    "channel_1": {
      "location": "C:\\Users\\Admin\\Desktop\\DataFiles\\Channel_1",
      "writable": true,
      "defaultInputFormat": null,
      "allowAccessOutsideWorkspace": true
    }
  },
  "formats": {
    "json": {
      "type": "json",
      "extensions": [
        "json"
      ]
    },
    "csv": {
      "type": "text",
      "extensions": [
        "txt"
      ],
      "lineDelimiter": "\n",
      "fieldDelimiter": ",",
      "quote": "\"",
      "escape": "\"",
      "comment": "#"
    },
    "parquet": {
      "type": "parquet"
    }
  },
  "authMode": "SHARED_USER",
  "enabled": true
}

查了很多资料,但没有什么帮助。如果有人可以提供帮助,我将不胜感激。

sql windows apache view apache-drill
1个回答
0
投票

试试这个 -

错误消息表明模式

data_access
是不可变的,这意味着您无法在此模式中创建或删除对象(如视图)。 查看您的工作区配置,我注意到您定义了工作区
channel_0
channel_1
,但没有定义名为
data_access
的工作区或模式。 要解决此问题,您需要创建一个名为
data_access
的可写工作区或架构。您可以通过向配置文件添加新工作区来完成此操作:

在channel_1之后,将其添加到配置文件中

"data_access": {
  "location": "C:\\Users\\Admin\\Desktop\\DataFiles\\DataAccess",
  "writable": true,
  "defaultInputFormat": null,
  "allowAccessOutsideWorkspace": true
}
© www.soinside.com 2019 - 2024. All rights reserved.