【问题标题】:AWS Redshift Spectrum decimal type to read parquet double typeAWS Redshift Spectrum 十进制类型读取 parquet double 类型
【发布时间】:2019-09-27 22:49:50
【问题描述】:

我有由 Pandas(pyarrow) 编写的镶木地板文件,其中包含 Double 类型的字段。 以下是镶木地板架构:

message schema {
  optional binary domain (STRING);
  optional binary type;
  optional binary country;
  optional binary region;
  optional binary country_code (STRING);
  optional int64 date (TIMESTAMP(MILLIS,true));
  optional double visits;
  optional double average_visit_duration;
}

问题: 我使用 Redshift Spectrum 创建外部表来读取这些 parquet 中的数据。 表架构:

CREATE EXTERNAL TABLE spectrum.similarweb_daily_current(
  domain varchar(200), 
  type varchar(200), 
  country varchar(200), 
  region varchar(200), 
  country_code varchar(200), 
  visits decimal(38,37), 
  average_visit_duration decimal(38,37))
STORED as PARQUET
LOCATION
  's3://XXX'

在进行简单的选择查询时,会显示模式不兼容 => Double vs Decimal 的错误。 有人知道如何解决吗?

我做过的研究:
在 Pandas/pyarrow 上,写入镶木地板时,我似乎无法将架构调整为十进制。
在 Redshift 上,Double 类型不支持外部表(谱)

【问题讨论】:

  • 您是否使用 Glue 进行编目? Glue 说的类型是什么?

标签: pandas amazon-redshift parquet


【解决方案1】:

解决了这个问题。 在镶木地板中使用 Redshift“双精度”类型进行双精度。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-19
    • 2020-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多