创建雅典娜表不匹配输入错误

发布于 2025-01-30 14:17:42 字数 449 浏览 2 评论 0原文

遇到以下错误,

line 1:8: mismatched input 'EXTERNAL'. Expecting: 'OR', 'SCHEMA', 'TABLE', 'VIEW'

在使用以下命令创建雅典娜表格时,

CREATE EXTERNAL TABLE IF NOT EXISTS 'abcd_123' (Item:struct<Id:struct<S:string>>)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES ('ignore.malformed.json' = 'true')
LOCATION 's3://mybucket'

我经历了其他Q&amp; a,并且没有任何答案对我有所帮助 - 关于错误可能在哪里?

Getting the following error,

line 1:8: mismatched input 'EXTERNAL'. Expecting: 'OR', 'SCHEMA', 'TABLE', 'VIEW'

when creating an Athena table with the following command,

CREATE EXTERNAL TABLE IF NOT EXISTS 'abcd_123' (Item:struct<Id:struct<S:string>>)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES ('ignore.malformed.json' = 'true')
LOCATION 's3://mybucket'

I've gone through other Q&A's and none of the answers have helped me - any points as to where the error might be here ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓬勃野心 2025-02-06 14:17:42

尝试在物品和结构之间而不是结构上放置一个空间,例如,

CREATE EXTERNAL TABLE IF NOT EXISTS 'abcd_123' (
    Item struct<
        Id:struct<
            S:string
        >
    >
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES ('ignore.malformed.json' = 'true')
LOCATION 's3://mybucket'

这是从 AWS Athena Docs 。我相信仅在结构及其类型的字段之间需要结肠,而不是列名称及其类型。

CREATE EXTERNAL TABLE IF NOT EXISTS cloudfront_logs (
    `Date` Date,
    Time STRING,
    Location STRING,
    Bytes INT,
    RequestIP STRING,
    ...

Try putting a space between Item and struct instead of a colon, like so

CREATE EXTERNAL TABLE IF NOT EXISTS 'abcd_123' (
    Item struct<
        Id:struct<
            S:string
        >
    >
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES ('ignore.malformed.json' = 'true')
LOCATION 's3://mybucket'

This is taken from the AWS Athena docs. I believe the colon is only required between fields of structs and their types, not column names and their types.

CREATE EXTERNAL TABLE IF NOT EXISTS cloudfront_logs (
    `Date` Date,
    Time STRING,
    Location STRING,
    Bytes INT,
    RequestIP STRING,
    ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文