DataFormatConversion.InvalidSchema 在 AWS Glue 和 Firehose 中使用 hyphen/dash

DataFormatConversion.InvalidSchema using hyphen/dash in AWS Glue and Firehose

我有这个 CloudFormation Glue 模板,其中一个结构字段中包含一个连字符:

  TestGlue:
    Type: AWS::Glue::Table
    Properties:
      CatalogId: !Ref AWS::AccountId
      DatabaseName: testdatabase
        Name: 'test'
        StorageDescriptor:
          Location: "s3://testpath"
          Columns:
            - Name: test
              Type: struct<testcol:string,item-testcol:string>

此 table 用于 Kinesis Firehose 记录转换,但每当我尝试发送数据进行处理时,都会收到以下错误。有没有办法强制使用破折号或连字符,到目前为止我无法将其更改为下划线,因为当前数据使用连字符并且会有很大的影响。

"lastErrorCode":"DataFormatConversion.InvalidSchema","lastErrorMessage":"The schema is invalid. Error parsing the schema: Error:: expected at the position XX of 'struct<testcol:string,item-testcol:string>' but '-' is found."

由于 Glue 数据目录 运行 在 Hive Metastore 上,我认为不能在名称中使用破折号。

正如@Robert 也提到的,Glue 不支持在列名中使用 'hyphens'。

来自 Glue 文档:

When you create schema in AWS Glue to query in Athena, consider the following:

- database name cannot be longer than 252 characters.
- table name cannot be longer than 255 characters.
- column name cannot be longer than 128 characters.
- The only acceptable characters for database names, table names, and column names are lowercase letters, numbers, and the underscore character.

详情请参考Glue best practices