[
https://issues.apache.org/jira/browse/SPARK-9807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14712583#comment-14712583
]
Karen Yin-Yee Ng commented on SPARK-9807:
-----------------------------------------
According to the documentation at
http://spark.apache.org/docs/latest/api/python/pyspark.sql.html?highlight=createdataframe#pyspark.sql.SQLContext.createDataFrame
it says:
> When schema is a list of column names, the type of each column will be
> inferred from data.
I did supply the `sqlContext.createDataFrame` method with the column names in
my example.
Please correct the documentation if the type inference is not supposed to work.
> pyspark.sql.createDataFrame does not infer data type of parsed TSV
> ------------------------------------------------------------------
>
> Key: SPARK-9807
> URL: https://issues.apache.org/jira/browse/SPARK-9807
> Project: Spark
> Issue Type: Bug
> Components: PySpark
> Affects Versions: 1.4.1
> Environment: CentOS 6, Python version 2.7.10, Scala version 2-10
> Reporter: Karen Yin-Yee Ng
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> I tried parsing a space-separated file from HDFS.
> And using `pyspark.sqlContext.createDataFrame` to convert the parsed lines to
> a PySpark DataFrame. However, all entries are parsed as string type
> regardless of what the correct data type is.
> An example of my code and output can be found at:
> https://gist.github.com/karenyyng/a1264d6344c54df4fcc5
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]