You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (Jira)" <ji...@apache.org> on 2020/03/16 22:54:07 UTC
[jira] [Updated] (SPARK-30006) printSchema indeterministic output
[ https://issues.apache.org/jira/browse/SPARK-30006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dongjoon Hyun updated SPARK-30006:
----------------------------------
Affects Version/s: (was: 3.0.0)
3.1.0
> printSchema indeterministic output
> ----------------------------------
>
> Key: SPARK-30006
> URL: https://issues.apache.org/jira/browse/SPARK-30006
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 3.1.0
> Reporter: Hasil Sharma
> Priority: Minor
>
> printSchema doesn't give a consistent output in following example.
>
> {code:python}
> from pyspark.sql import SparkSession
> from pyspark.sql import Row
> spark = SparkSession.builder.appName("new-session").getOrCreate()
> l = [('Ankit',25),('Jalfaizy',22),('saurabh',20),('Bala',26)]
> rdd = spark.sparkContext.parallelize(l)
> people = rdd.map(lambda x: Row(name=x[0], age=int(x[1])))
> df1 = spark.createDataFrame(people)
> print(df1.printSchema())
> df2 = df1.select("name", "age")
> print(df2.printSchema())
> {code}
>
> first print outputs
> {noformat}
> root
> |– age: long (nullable = true)
> |– name: string (nullable = true)
> {noformat}
>
> second print outputs
> {noformat}
> root
> |– name: string (nullable = true)
> |– age: long (nullable = true)
> {noformat}
> Expectation: The output should be same because the column names are same.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org