Skip to content

Conversation

@viirya
Copy link
Member

@viirya viirya commented Sep 27, 2018

What changes were proposed in this pull request?

The specified test in OpenHashMapSuite to test large items is somehow flaky to throw OOM.
By considering the original work #6763 that added this test, the test can be against OpenHashSetSuite. And by doing this should be to save memory because OpenHashMap allocates two more arrays when growing the map/set.

How was this patch tested?

Existing tests.

@viirya
Copy link
Member Author

viirya commented Sep 27, 2018

cc @dongjoon-hyun @cloud-fan

@viirya viirya changed the title [SPARK-25542][SQL][Test] Move flaky test in OpenHashMapSuite to OpenHashSetSuite [SPARK-25542][SQL][Test] Move flaky test in OpenHashMapSuite to OpenHashSetSuite and make it against OpenHashSet Sep 27, 2018
@cloud-fan
Copy link
Contributor

LGTM

@SparkQA
Copy link

SparkQA commented Sep 27, 2018

Test build #96688 has finished for PR 22569 at commit 39a77d6.

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

@viirya
Copy link
Member Author

viirya commented Sep 27, 2018

retest this please.

val pos1 = set.addWithoutResize(i) & OpenHashSet.POSITION_MASK
val pos2 = set.getPos(i)
assert(pos1 == pos2)
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: Is it better to add the following to check each value after adding all, too?

for (i <- 0 until cnt) {
  assert(set.contains(i))
}

Copy link
Member Author

Choose a reason for hiding this comment

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

If we want to add the check, we can also add it inside the loop. Another loop seems unnecessary to me.

Copy link
Member

Choose a reason for hiding this comment

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

My intention was to verify whether small values (e.g. 0, 1, 2, 3) are still valid after several resizings.

Copy link
Member Author

@viirya viirya Sep 28, 2018

Choose a reason for hiding this comment

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

I see. I think that is not what this wants test and there are other tests to make sure it works. If you insist I can add it too.

Copy link
Member

Choose a reason for hiding this comment

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

The original test performed a check by using map.iterator.count(). But, this is not a strong preference.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, the original test performed the count check to see how many values are invalid. They are invalid values because the index is wrong due to wrong position mask in OpenHashSet.

This rewritten test tests directly the index of OpenHashSet.

@kiszk
Copy link
Member

kiszk commented Sep 27, 2018

LGTM except one minor comment

assert(set.contains(i))

val pos1 = set.addWithoutResize(i) & OpenHashSet.POSITION_MASK
val pos2 = set.getPos(i)
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for doing this, @viirya .

Shall we switch the line 267 and 266 because set.addWithoutResize(i) has side-effects like changing the underlying structure. Although the situation will not happen because we called addWithoutResize inside add at line 263. But, we had better get the comparison target value from the read-only function first.

@dongjoon-hyun
Copy link
Member

Also, please fix the tag in the PR title from [SQL] to [CORE].

@SparkQA
Copy link

SparkQA commented Sep 27, 2018

Test build #96697 has finished for PR 22569 at commit 39a77d6.

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

@SparkQA
Copy link

SparkQA commented Sep 27, 2018

Test build #96701 has finished for PR 22569 at commit dca4e5c.

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

@viirya viirya changed the title [SPARK-25542][SQL][Test] Move flaky test in OpenHashMapSuite to OpenHashSetSuite and make it against OpenHashSet [SPARK-25542][Core][Test] Move flaky test in OpenHashMapSuite to OpenHashSetSuite and make it against OpenHashSet Sep 27, 2018
@SparkQA
Copy link

SparkQA commented Sep 28, 2018

Test build #96726 has finished for PR 22569 at commit 22bfa80.

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

@viirya
Copy link
Member Author

viirya commented Sep 28, 2018

retest this please.

@SparkQA
Copy link

SparkQA commented Sep 28, 2018

Test build #96733 has finished for PR 22569 at commit 22bfa80.

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

@viirya
Copy link
Member Author

viirya commented Sep 28, 2018

retest this please.

@SparkQA
Copy link

SparkQA commented Sep 28, 2018

Test build #96738 has finished for PR 22569 at commit 22bfa80.

  • This patch passes all 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.

+1, LGTM. Thank you again.

@dongjoon-hyun
Copy link
Member

Merged to master/branch-2.4.

asfgit pushed a commit that referenced this pull request Sep 28, 2018
…HashSetSuite and make it against OpenHashSet

## What changes were proposed in this pull request?

The specified test in OpenHashMapSuite to test large items is somehow flaky to throw OOM.
By considering the original work #6763 that added this test, the test can be against OpenHashSetSuite. And by doing this should be to save memory because OpenHashMap allocates two more arrays when growing the map/set.

## How was this patch tested?

Existing tests.

Closes #22569 from viirya/SPARK-25542.

Authored-by: Liang-Chi Hsieh <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit b7d8034)
Signed-off-by: Dongjoon Hyun <[email protected]>
@asfgit asfgit closed this in b7d8034 Sep 28, 2018
daspalrahul pushed a commit to daspalrahul/spark that referenced this pull request Sep 29, 2018
…HashSetSuite and make it against OpenHashSet

## What changes were proposed in this pull request?

The specified test in OpenHashMapSuite to test large items is somehow flaky to throw OOM.
By considering the original work apache#6763 that added this test, the test can be against OpenHashSetSuite. And by doing this should be to save memory because OpenHashMap allocates two more arrays when growing the map/set.

## How was this patch tested?

Existing tests.

Closes apache#22569 from viirya/SPARK-25542.

Authored-by: Liang-Chi Hsieh <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
…HashSetSuite and make it against OpenHashSet

## What changes were proposed in this pull request?

The specified test in OpenHashMapSuite to test large items is somehow flaky to throw OOM.
By considering the original work apache#6763 that added this test, the test can be against OpenHashSetSuite. And by doing this should be to save memory because OpenHashMap allocates two more arrays when growing the map/set.

## How was this patch tested?

Existing tests.

Closes apache#22569 from viirya/SPARK-25542.

Authored-by: Liang-Chi Hsieh <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
@viirya viirya deleted the SPARK-25542 branch December 27, 2023 18:35
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.

5 participants