Skip to content

Conversation

@yaooqinn
Copy link
Member

What changes were proposed in this pull request?

Now the min/max/sum/avg are support for intervals, we should also enable it in RelationalGroupedDataset

Why are the changes needed?

API consistency improvement

Does this PR introduce any user-facing change?

yes, Dataset support min/max/sum/avg(mean) on intervals

How was this patch tested?

add ut

@yaooqinn
Copy link
Member Author

cc @cloud-fan @maropu @HyukjinKwon @wangyum, thanks for reviewing.

colNames.map { colName =>
val namedExpr = df.resolve(colName)
if (!namedExpr.dataType.isInstanceOf[NumericType]) {
if (!TypeCollection.NumericAndInterval.acceptsType(namedExpr.dataType)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the comment to make it more general one?

* Types that include numeric types and interval type. They are only used in unary_minus,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your suggestion. Please check 。

schema.fields.filter{ f =>
TypeCollection.NumericAndInterval.acceptsType(f.dataType)
}.map { n =>
queryExecution.analyzed.resolveQuoted(n.name, sparkSession.sessionState.analyzer.resolver).get
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can do

queryExecution.analyzed.output.filter { attr =>
  TypeCollection.NumericAndInterval.acceptsType(attr.dataType)
}

@SparkQA
Copy link

SparkQA commented Nov 26, 2019

Test build #114462 has finished for PR 26681 at commit 4b353df.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 26, 2019

Test build #114469 has finished for PR 26681 at commit f93cd9f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 26, 2019

Test build #114472 has finished for PR 26681 at commit 73b217a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 27, 2019

Test build #114499 has finished for PR 26681 at commit fe84ae8.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 27, 2019

Test build #114519 has finished for PR 26681 at commit 69667c2.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • public class GetLocalDirsForExecutors extends BlockTransferMessage
  • public class LocalDirsForExecutors extends BlockTransferMessage
  • sealed trait ViewType
  • case class CreateViewStatement(

@SparkQA
Copy link

SparkQA commented Dec 2, 2019

Test build #114731 has finished for PR 26681 at commit 6dca7b1.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • trait OperationHelper
  • class HiveThriftServer2AppStatusStore(
  • class HiveThriftServer2HistoryServerPlugin extends AppHistoryServerPlugin

@maropu
Copy link
Member

maropu commented Dec 2, 2019

cc: @cloud-fan @dongjoon-hyun

@cloud-fan cloud-fan closed this in 39291cf Dec 3, 2019
@cloud-fan
Copy link
Contributor

thanks, merging to master!

@yaooqinn yaooqinn deleted the SPARK-30048 branch December 3, 2019 11:35
attilapiros pushed a commit to attilapiros/spark that referenced this pull request Dec 6, 2019
…lationalGroupedDataset

### What changes were proposed in this pull request?

Now the min/max/sum/avg are support for intervals, we should also enable it in RelationalGroupedDataset

### Why are the changes needed?

API consistency improvement

### Does this PR introduce any user-facing change?

yes, Dataset support min/max/sum/avg(mean) on intervals
### How was this patch tested?

add ut

Closes apache#26681 from yaooqinn/SPARK-30048.

Authored-by: Kent Yao <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
cloud-fan pushed a commit that referenced this pull request Jan 19, 2020
### What changes were proposed in this pull request?

As we are not going to follow ANSI to implement year-month and day-time interval types, it is weird to compare the year-month part to the day-time part for our current implementation of interval type now.

Additionally, the current ordering logic comes from PostgreSQL where the implementation of the interval is messy. And we are not aiming PostgreSQL compliance at all.

THIS PR will revert #26681 and #26337

### Why are the changes needed?

make interval type more future-proofing

### Does this PR introduce any user-facing change?

there are new in 3.0, so no

### How was this patch tested?

existing uts shall work

Closes #27262 from yaooqinn/SPARK-30551.

Authored-by: Kent Yao <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants