简体   繁体   English

创建 Athena 表时输入不匹配错误

[英]Mismatched input error when creating Athena table

Getting the following error,收到以下错误,

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

when creating an Athena table with the following command,使用以下命令创建 Athena 表时,

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 ?我已经完成了其他问答,但没有一个答案对我有帮助 - 关于错误可能在这里的任何点?

Try putting a space between Item and struct instead of a colon, like so尝试在 Item 和 struct 之间放置一个空格而不是冒号,就像这样

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 .这取自AWS Athena 文档 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,
    ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 创建分区时,Amazon Athena 返回“不匹配的输入‘分区’期望 {,‘with’}”错误 - Amazon Athena returning "mismatched input 'partitioned' expecting {, 'with'}" error when creating partitions 在 AWS Athena 中创建外部表时出错 - Error when creating external table in AWS Athena Amazon Athena CREATE EXTERNAL TABLE 不匹配的输入“外部”无效请求异常 - Amazon Athena CREATE EXTERNAL TABLE mismatched input 'external' invalidrequestexception 在分隔符之前创建带有转义字符的 Athena 表 - Creating Athena table with escape character before separator 即使在 escaping 带有反引号(`)的点之后,在 Amazon Athena 中创建列名包含点 (.) 的表时也会出错 - Error in creating table with column name containing dot (.) in Amazon Athena even after escaping the dot with backticks(`) Amazon Athena 创建分区表时出错 - Amazon Athena Error Creating Partitioned Tables 在 ATHENA 中创建带有分区的外部表会导致空表 - creating external table with partition in ATHENA results in empty table 在胶水表(RDS)上运行AWS Athena查询时出现HIVE_UNKNOWN_ERROR - HIVE_UNKNOWN_ERROR when running AWS Athena query on Glue table (RDS) 表文件格式规范中输入&#39;org&#39;的输入不匹配,期望StringLiteral在&#39;BY&#39;附近 - mismatched input 'org' expecting StringLiteral near 'BY' in table file format specification 当我们从 s3 中的 csv 文件读取数据并在 aws athena 中创建表时如何跳过标题。 - How to skip headers when we are reading data from a csv file in s3 and creating a table in aws athena.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM