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-18632][SQL] AggregateFunction should not implement ImplicitCastInputTypes #16066

Closed
wants to merge 5 commits into from

Conversation

hvanhovell
Copy link
Contributor

What changes were proposed in this pull request?

AggregateFunction currently implements ImplicitCastInputTypes (which enables implicit input type casting). There are actually quite a few situations in which we don't need this, or require more control over our input. A recent example is the aggregate for CountMinSketch which should only take string, binary or integral types inputs.

This PR removes ImplicitCastInputTypes from the AggregateFunction and makes a case-by-case decision on what kind of input validation we should use.

How was this patch tested?

Refactoring only. Existing tests.

@hvanhovell
Copy link
Contributor Author

cc @rxin

defaultCheck
} else if (!ignoreNullsExpr.foldable) {
TypeCheckFailure(
s"The second argument of Last must be a boolean literal, but got: $ignoreNullsExpr")
Copy link
Contributor

Choose a reason for hiding this comment

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

ignoreNullsExpr.toSQL?

@rxin
Copy link
Contributor

rxin commented Nov 29, 2016

LGTM other than that tiny comment.

@rxin
Copy link
Contributor

rxin commented Nov 29, 2016

LGTM

@SparkQA
Copy link

SparkQA commented Nov 29, 2016

Test build #69349 has finished for PR 16066 at commit 9a722cf.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • case class Average(child: Expression) extends DeclarativeAggregate with ImplicitCastInputTypes
  • abstract class CentralMomentAgg(child: Expression)
  • case class Corr(x: Expression, y: Expression)
  • abstract class Covariance(x: Expression, y: Expression)
  • case class First(child: Expression, ignoreNullsExpr: Expression)
  • case class Last(child: Expression, ignoreNullsExpr: Expression)
  • case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCastInputTypes
  • sealed abstract class AggregateFunction extends Expression

@SparkQA
Copy link

SparkQA commented Nov 30, 2016

Test build #69358 has finished for PR 16066 at commit 3ba68de.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 30, 2016

Test build #69356 has finished for PR 16066 at commit 1246792.

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

@SparkQA
Copy link

SparkQA commented Nov 30, 2016

Test build #69367 has finished for PR 16066 at commit 5f8e3d0.

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

@rxin
Copy link
Contributor

rxin commented Nov 30, 2016

Merging in master.

@asfgit asfgit closed this in af9789a Nov 30, 2016
robert3005 pushed a commit to palantir/spark that referenced this pull request Dec 2, 2016
…tInputTypes

## What changes were proposed in this pull request?
`AggregateFunction` currently implements `ImplicitCastInputTypes` (which enables implicit input type casting). There are actually quite a few situations in which we don't need this, or require more control over our input. A recent example is the aggregate for `CountMinSketch` which should only take string, binary or integral types inputs.

This PR removes `ImplicitCastInputTypes` from the `AggregateFunction` and makes a case-by-case decision on what kind of input validation we should use.

## How was this patch tested?
Refactoring only. Existing tests.

Author: Herman van Hovell <[email protected]>

Closes apache#16066 from hvanhovell/SPARK-18632.
uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
…tInputTypes

## What changes were proposed in this pull request?
`AggregateFunction` currently implements `ImplicitCastInputTypes` (which enables implicit input type casting). There are actually quite a few situations in which we don't need this, or require more control over our input. A recent example is the aggregate for `CountMinSketch` which should only take string, binary or integral types inputs.

This PR removes `ImplicitCastInputTypes` from the `AggregateFunction` and makes a case-by-case decision on what kind of input validation we should use.

## How was this patch tested?
Refactoring only. Existing tests.

Author: Herman van Hovell <[email protected]>

Closes apache#16066 from hvanhovell/SPARK-18632.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants