Uh oh!
There was an error while loading. Please reload this page.
[SPARK-31735][SQL] Include date/timestamp in the summary report - #28554
[SPARK-31735][SQL] Include date/timestamp in the summary report#28554Fokko wants to merge 2 commits into
Conversation
dongjoon-hyun
commented
May 16, 2020
ok to test |
| } | ||
| val selectedCols = ds.logicalPlan.output | ||
| .filter(a => a.dataType.isInstanceOf[NumericType] || a.dataType.isInstanceOf[StringType]) |
There was a problem hiding this comment.
Can we keep this whitelist style instead of allowing all, @Fokko ? You can add the missing type here.
There was a problem hiding this comment.
Sure, I've just updated the list.
There was a problem hiding this comment.
Thank you, @Fokko . Could you update the PR title and description accordingly?
There was a problem hiding this comment.
I've updated both the PR and commit, please let me know if this works for you
There was a problem hiding this comment.
Shall we remove Even something less common such as arrays are sortable: and its example in the PR description?
SparkQA
commented
May 17, 2020
Test build #122735 has finished for PR 28554 at commit
|
SparkQA
commented
May 17, 2020
Test build #122756 has finished for PR 28554 at commit
|
dongjoon-hyun
commented
May 17, 2020
And, if you don't mind, could you add a UT for this to prevent a future regression? |
SparkQA
commented
May 18, 2020
Test build #122760 has finished for PR 28554 at commit
|
| .filter(a => a.dataType.isInstanceOf[NumericType] || a.dataType.isInstanceOf[StringType]) | ||
| .filter(a => a.dataType.isInstanceOf[NumericType] | ||
| || a.dataType.isInstanceOf[StringType] | ||
| || a.dataType.isInstanceOf[DateType] |
There was a problem hiding this comment.
Yes, let's write a UT. Does it work BTW? Looks at least mean and date type won't work here.
There was a problem hiding this comment.
I'm working on getting the test suite running on my machine, so I need some time. I don't think that the mean will be the issue, this is just the element in the middle of the sorted collection, however, the stddev will be tricky. For the StringType this is just null.
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>I finally have some to pick this up. Looks like there is some funky behavior. Doing an average on a string just return |
SparkQA
commented
Jun 7, 2020
Test build #123602 has finished for PR 28554 at commit
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
For example, dates are missing from the export:
Even something less common such as arrays are sortable:
Signed-off-by: Fokko Driesprong fokko@apache.org
What changes were proposed in this pull request?
Not filtering the columns to compute statistics on.
Why are the changes needed?
Something as simple as DateTypes are not showing up in the output.
Does this PR introduce any user-facing change?
Might be, as their output will change of the summary if they have columns that aren't part of the summary right now.
How was this patch tested?
Existing tests.