How to show full column content in a Spark Dataframe?

前端 未结 14 2136
萌比男神i
萌比男神i 2020-12-07 07:46

I am using spark-csv to load data into a DataFrame. I want to do a simple query and display the content:

val df = sqlContext.read.format(\"com.databricks.spa         


        
相关标签:
14条回答
  • 2020-12-07 08:29

    In c# Option("truncate", false) does not truncate data in the output.

    StreamingQuery query = spark
                        .Sql("SELECT * FROM Messages")
                        .WriteStream()
                        .OutputMode("append")
                        .Format("console")
                        .Option("truncate", false)
                        .Start();
    
    0 讨论(0)
  • 2020-12-07 08:33

    Below code would help to view all rows without truncation in each column

    df.show(df.count(), False)
    
    0 讨论(0)
  • 2020-12-07 08:34

    results.show(false) will show you the full column content.

    Show method by default limit to 20, and adding a number before false will show more rows.

    0 讨论(0)
  • 2020-12-07 08:35

    Tried this in pyspark

    df.show(truncate=0)
    
    0 讨论(0)
  • 2020-12-07 08:37

    If you put results.show(false) , results will not be truncated

    0 讨论(0)
  • 2020-12-07 08:37

    results.show(20, False) or results.show(20, false) depending on whether you are running it on Java/Scala/Python

    0 讨论(0)
提交回复
热议问题