Skip to content

Conversation

@mgaido91
Copy link
Contributor

@mgaido91 mgaido91 commented Nov 5, 2018

What changes were proposed in this pull request?

#21848 introduces an optimization which causes wrong behavior with AssertNotNull and AssertTrue. This PR makes the two mentioned expressions as non-deterministic in order to avoid skipping evaluating them.

How was this patch tested?

added UT

@mgaido91
Copy link
Contributor Author

mgaido91 commented Nov 5, 2018

@SparkQA
Copy link

SparkQA commented Nov 5, 2018

Test build #98472 has finished for PR 22947 at commit 332db30.

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


override def nullable: Boolean = true

override lazy val deterministic: Boolean = false
Copy link
Member

@viirya viirya Nov 5, 2018

Choose a reason for hiding this comment

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

hmm, this two expressions are very commonly used in other expressions' children. Making them non-deterministic will make such expressions as non-deterministic too, e.g., encoders. It might have big impact.

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, that's true. The change may be big indeed. I am open to other proposals, as creating a new sideEffect flag in the Expression.

Copy link
Member

Choose a reason for hiding this comment

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

Because of this, I'm leaning towards creating a new flag instead of making them non-deterministic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, thanks you all the comments. I'll try and add a new flag. I'll update the PR as soon as I have a solution for that. Probably it will take some time, though, as I will have to recheck all the usage of determistic.... Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gatorsmile thanks for your comment. I think the main issue with making this non-determistic is that we have basically to skip the sanity check at

case o if o.expressions.exists(!_.deterministic) &&
, because we have AssertNotNull is a lot of other different locations. Another option may be to special case AssertNotNull and avoid that check for it... What do you think?

Copy link
Contributor Author

@mgaido91 mgaido91 Nov 15, 2018

Choose a reason for hiding this comment

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

any comment on this @gatorsmile @maryannxue ?

@SparkQA
Copy link

SparkQA commented Nov 5, 2018

Test build #98476 has finished for PR 22947 at commit 895e095.

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

@SparkQA
Copy link

SparkQA commented Nov 5, 2018

Test build #98477 has finished for PR 22947 at commit 4bd7c2d.

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

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

Thank you for pinging me, @mgaido91 .

As I'm the one who raised the issue about that optimizer and AssertX, I'm not sure about making this as non-deterministic. The reason is simply it's not logically correct.

I'll review this back after Jenkins passes.

@SparkQA
Copy link

SparkQA commented Nov 7, 2018

Test build #98560 has finished for PR 22947 at commit 1caa284.

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

@mgaido91
Copy link
Contributor Author

any more comments on this?

@github-actions
Copy link

github-actions bot commented Jan 5, 2020

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.

If you'd like to revive this PR, please reopen it!

@github-actions github-actions bot added the Stale label Jan 5, 2020
@github-actions github-actions bot closed this Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants