【发布时间】:2023-03-30 08:32:01
【问题描述】:
我正在阅读一个描述超过 256 个字符的来源。我想把它们写到 Redshift。
根据:https://github.com/databricks/spark-redshift#configuring-the-maximum-size-of-string-columns 只能在 Scala 中实现。
据此:https://github.com/databricks/spark-redshift/issues/137#issuecomment-165904691 在创建数据框时指定架构应该是一种解决方法。我无法让它工作。
如何使用 varchar(max) 指定架构?
df = ...from source
schema = StructType([
StructField('field1', StringType(), True),
StructField('description', StringType(), True)
])
df = sqlContext.createDataFrame(df.rdd, schema)
【问题讨论】:
标签: apache-spark pyspark apache-spark-sql amazon-redshift