Я получаю сообщение об ошибке в простом случае:
Я хочу прочитать несколько CSV, все имеют одинаковый формат, но без заголовков.
Итак, я пытаюсь указать заголовки.
from pyspark.sql import SQLContext
from pyspark.sql.types import *
sqlContext = SQLContext(sc)
schema = StructType([
StructField("c0", StringType(), True),
StructField("c1", StringType(), True),
StructField("c2", StringType(), True),
StructField("c3", TimestampType, True),
StructField("c4", TimestampType, True),
StructField("c5", StringType(), True),
StructField("c6", StringType(), True),
StructField("c7", StringType(), True),
StructField("c8", StringType(), True),
StructField("c9", StringType(), True),
StructField("c10", StringType(), True),
StructField("c11", StringType(), True),
StructField("c12", StringType(), True),
StructField("c13", StringType(), True),
StructField("c14", StringType(), True),
StructField("c15", StringType(), True),
StructField("c16", StringType(), True),
StructField("c17", StringType(), True)
])
df = sqlContext.read.load('good_loc.csv',
format='com.databricks.spark.csv',
header='false',
inferSchema='true')
Я получаю ошибку:
dataType should be DataType
Traceback (most recent call last):
File "/usr/hdp/current/spark2-client/python/pyspark/sql/types.py", line 403, in __init__
assert isinstance(dataType, DataType), "dataType should be DataType"
AssertionError: dataType should be DataType
Ошибка, я думаю, исходит от TimeStamp Type. Я использую Spark 2.2
Спасибо за помощь!