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-22187][SS] Update unsaferow format for saved state in flatMapGroupsWithState to allow timeouts with deleted state #21739

Closed
wants to merge 11 commits into from

Conversation

tdas
Copy link
Contributor

@tdas tdas commented Jul 9, 2018

What changes were proposed in this pull request?

Currently, the group state of user-defined-type is encoded as top-level columns in the UnsafeRows stores in the state store. The timeout timestamp is also saved as (when needed) as the last top-level column. Since the group state is serialized to top-level columns, you cannot save "null" as a value of state (setting null in all the top-level columns is not equivalent). So we don't let the user set the timeout without initializing the state for a key. Based on user experience, this leads to confusion.

This PR is to change the row format such that the state is saved as nested columns. This would allow the state to be set to null, and avoid these confusing corner cases. However, queries recovering from existing checkpoint will use the previous format to maintain compatibility with existing production queries.

How was this patch tested?

Refactored existing end-to-end tests and added new tests for explicitly testing obj-to-row conversion for both state formats.

@@ -43,7 +43,7 @@ case class ObjectType(cls: Class[_]) extends DataType {

def asNullable: DataType = this

override def simpleString: String = cls.getName
override def simpleString: String = s"Object[${cls.getName}]"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is to make it differentiate between IntegerType and ObjectType with int in it. Both show up in the simpleStreaing as int.

@SparkQA
Copy link

SparkQA commented Jul 9, 2018

Test build #92766 has finished for PR 21739 at commit 9525484.

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

@SparkQA
Copy link

SparkQA commented Jul 10, 2018

Test build #92790 has finished for PR 21739 at commit c9f600b.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@tdas tdas changed the title [SPARK-22187][SS] Update unsaferow format for saved state such that we can set timeouts when state is null [SPARK-22187][SS] Update unsaferow format for saved state in flatMapGroupsWithState to allow timeouts with deleted state Jul 11, 2018
@tdas
Copy link
Contributor Author

tdas commented Jul 11, 2018

jenkins retest this please

@SparkQA
Copy link

SparkQA commented Jul 11, 2018

Test build #92836 has finished for PR 21739 at commit c9f600b.

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

}


private class StateManagerImplV2(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add docs explaining the state format

@SparkQA
Copy link

SparkQA commented Jul 11, 2018

Test build #92853 has finished for PR 21739 at commit 3abb5e2.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 11, 2018

Test build #92845 has finished for PR 21739 at commit 05e3acf.

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

@SparkQA
Copy link

SparkQA commented Jul 11, 2018

Test build #92846 has finished for PR 21739 at commit dcf9616.

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

@tdas
Copy link
Contributor Author

tdas commented Jul 11, 2018

@zsxwing

@zsxwing
Copy link
Member

zsxwing commented Jul 12, 2018

LGTM

@SparkQA
Copy link

SparkQA commented Jul 19, 2018

Test build #93258 has finished for PR 21739 at commit c262e87.

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

@zsxwing
Copy link
Member

zsxwing commented Jul 19, 2018

LGTM again

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