【发布时间】:2017-02-07 15:39:00
【问题描述】:
在表上运行 describe 后,我在 RedShift 中具有以下结构(所有字段均为 Nullable):
a integer
b numeric(18)
c date
d char(3)
e smallint
f char(1)
g varchar(20)
h numeric(11,2)
所有数据都被提取到 S3。现在想将数据加载到 Spark Dataframe 中,但还需要为此表创建适当的架构。
这些字段的 Spark 架构会是什么样子?
这个结构正确吗? (特别想知道 Numeric (11,2)、Date、Char(1) 字段)
val schema = StructType(
Array(
StructField("a", IntegerType, true),
StructField("b", IntegerType, true),
StructField("c", StringType, true),
StructField("d", StringType, true),
StructField("e", IntegerType, true),
StructField("f", StringType, true),
StructField("g", StringType, true),
StructField("h", IntegerType, true)
)
)
【问题讨论】:
标签: scala apache-spark schema structure