Davies Liu created SPARK-3592:
---------------------------------

             Summary: applySchema to an RDD of Row
                 Key: SPARK-3592
                 URL: https://issues.apache.org/jira/browse/SPARK-3592
             Project: Spark
          Issue Type: Bug
          Components: PySpark, SQL
            Reporter: Davies Liu
            Priority: Critical


Right now, we can not appy schema to a RDD of Row, this should be a Bug,

{code}
>>> srdd = sqlCtx.jsonRDD(sc.parallelize(["""{"a":2}"""]))
>>> sqlCtx.applySchema(srdd.map(lambda x:x), srdd.schema())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/daviesliu/work/spark/python/pyspark/sql.py", line 1121,
in applySchema
    _verify_type(row, schema)
  File "/Users/daviesliu/work/spark/python/pyspark/sql.py", line 736,
in _verify_type
    % (dataType, type(obj)))
TypeError: StructType(List(StructField(a,IntegerType,true))) can not
accept abject in type <class 'pyspark.sql.Row'>
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to