Skip to content

[SPARK-8826] [SQL] Fix ClassCastException in GeneratedAggregate #7225

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

Closed
wants to merge 1 commit into from

Conversation

navis
Copy link
Contributor

@navis navis commented Jul 5, 2015

When codegen is disabled, ClassCastException is thrown in some cases.

@SparkQA
Copy link

SparkQA commented Jul 5, 2015

Test build #36543 has finished for PR 7225 at commit 9badf54.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class InterpretedProjection(expressions: Seq[Expression], mutableRow: Boolean = false)
    • case class Hex(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class UnHex(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class ShiftLeft(left: Expression, right: Expression)
    • case class ShiftRight(left: Expression, right: Expression)
    • case class ShiftRightUnsigned(left: Expression, right: Expression)
    • case class Levenshtein(left: Expression, right: Expression) extends BinaryExpression

inputSchema: Seq[Attribute],
mutableRow: Boolean = false) = {
this(expressions.map(BindReferences.bindReference(_, inputSchema)), mutableRow)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change? If you want to use mutable row in projection, you can use InterpretedMutableProjection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but InterpretedProjection and InterpretedMutableProjection has different semantic on returning object. It would be same thing if call setTarget() before each apply() call but I wanted keep it simple without incurring another problem.

@SparkQA
Copy link

SparkQA commented Jul 5, 2015

Test build #36545 has finished for PR 7225 at commit 5f6a18c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class InterpretedProjection(expressions: Seq[Expression], mutableRow: Boolean = false)
    • case class Hex(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class UnHex(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class ShiftLeft(left: Expression, right: Expression)
    • case class ShiftRight(left: Expression, right: Expression)
    • case class ShiftRightUnsigned(left: Expression, right: Expression)


test("SPARK-8826 Fix ClassCastException in GeneratedAggregate") {

// when codegen = false, CCE is thrown if group-by expression is empty or unsafe is disabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't the use of GeneratedAggregate imply that codegen must be enabled?

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically, I'm wondering if this is a bug. If this problem only occurs when mis-using GeneratedAggregate, then I think we should resolve this by adding an assertion / precondition check to GeneratedAggregate to ensure that codgen is enabled.

Copy link
Contributor

Choose a reason for hiding this comment

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

@navis, can you comment on this?

@JoshRosen
Copy link
Contributor

I've closed the JIRA issue as "invalid" since GeneratedAggregate will never be used when codegen is disabled. As a result, do you mind closing this issue? Thanks!

@JoshRosen
Copy link
Contributor

Bump; can you please close this pull request? Thanks!

@navis navis closed this Aug 21, 2015
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.

4 participants