Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-31735][SQL] Include date/timestamp in the summary report #28554

Closed
wants to merge 2 commits into from

Commits on Jun 7, 2020

  1. [SPARK-31735][CORE] Include date/timestamp in the summary report

    Currently dates are missing from the export:
    
    from datetime import datetime, timedelta, timezone
    from pyspark.sql import types as T
    from pyspark.sql import Row
    from pyspark.sql import functions as F
    
    START = datetime(2014, 1, 1, tzinfo=timezone.utc)
    
    n_days = 22
    
    date_range = [Row(date=(START + timedelta(days=n))) for n in range(0, n_days)]
    
    schema = T.StructType([T.StructField(name="date", dataType=T.DateType(), nullable=False)])
    
    rdd = spark.sparkContext.parallelize(date_range)
    
    df = spark.createDataFrame(data=rdd, schema=schema)
    
    df.agg(F.max("date")).show()
    
    df.summary().show()
    +-------+
    |summary|
    +-------+
    |  count|
    |   mean|
    | stddev|
    |    min|
    |    25%|
    |    50%|
    |    75%|
    |    max|
    +-------+
    
    Would be nice to include these as well
    
    Signed-off-by: Fokko Driesprong <fokko@apache.org>
    Fokko committed Jun 7, 2020
    Configuration menu
    Copy the full SHA
    9aa1829 View commit details
    Browse the repository at this point in the history
  2. Add a test

    Fokko committed Jun 7, 2020
    Configuration menu
    Copy the full SHA
    51c3df1 View commit details
    Browse the repository at this point in the history