Uh oh!
There was an error while loading. Please reload this page.
[SPARK-23599][SQL] Add a UUID generator from Pseudo-Random Numbers - #20817
[SPARK-23599][SQL] Add a UUID generator from Pseudo-Random Numbers#20817viirya wants to merge 3 commits into
Conversation
viirya
commented
Mar 14, 2018
cc @hvanhovell |
SparkQA
commented
Mar 14, 2018
Test build #88222 has finished for PR 20817 at commit
|
kiszk
commented
Mar 14, 2018
retest this please |
SparkQA
commented
Mar 14, 2018
Test build #88224 has finished for PR 20817 at commit
|
viirya
commented
Mar 14, 2018
retest this please. |
viirya
commented
Mar 14, 2018
| val mostSigBits = (random.nextLong() & 0xFFFFFFFFFFFF0FFFL) | 0x0000000000004000L | ||
| val leastSigBits = (random.nextLong() | 0x8000000000000000L) & 0xBFFFFFFFFFFFFFFFL | ||
| new UUID(mostSigBits, leastSigBits) |
There was a problem hiding this comment.
I think we need to use a different RNG. java.util.Random only has 48 bits of state, which is less than the 122 bits we need for UUID generation. Something like PCG or a Mersenne twister would work.
There was a problem hiding this comment.
Ok. Mersenne Twister is used in the update.
SparkQA
commented
Mar 14, 2018
Test build #88231 has finished for PR 20817 at commit
|
kiszk
commented
Mar 14, 2018
@viirya umm, it may eat more memory sometime ... |
hvanhovell
commented
Mar 14, 2018
@kiszk is it taking more memory because of the test? If it does can we make the test case smaller? |
I think this test takes more memory. Unfortunately, when I reduced the size of test, the problem cannot be reproduced in my environment. |
SparkQA
commented
Mar 15, 2018
Test build #88251 has finished for PR 20817 at commit
|
SparkQA
commented
Mar 15, 2018
Test build #88259 has finished for PR 20817 at commit
|
| case class RandomUUIDGenerator(randomSeed: Long) { | ||
| private val random = new MersenneTwister(randomSeed) | ||
| def getNextUUID(): UUID = { |
There was a problem hiding this comment.
Perhaps we should also create a version that creates a UTF8String directly.
SparkQA
commented
Mar 16, 2018
Test build #88290 has finished for PR 20817 at commit
|
viirya
commented
Mar 16, 2018
retest this please. |
SparkQA
commented
Mar 16, 2018
Test build #88301 has finished for PR 20817 at commit
|
viirya
commented
Mar 19, 2018
ping @hvanhovell Is there any more comments? Thanks. |
hvanhovell
left a comment
There was a problem hiding this comment.
LGTM - merging to master. Thanks!
viirya
commented
Mar 19, 2018
@hvanhovell Thanks for merging this! I will continue to work on make use of this UUID generator in UUID expression. |
## What changes were proposed in this pull request? This patch adds a UUID generator from Pseudo-Random Numbers. We can use it later to have deterministic `UUID()` expression. ## How was this patch tested? Added unit tests. Author: Liang-Chi Hsieh <viirya@gmail.com> Closes#20817 from viirya/SPARK-23599. (cherry picked from commit 4de638c) Signed-off-by: Herman van Hovell <hvanhovell@databricks.com>
## What changes were proposed in this pull request? This patch adds a UUID generator from Pseudo-Random Numbers. We can use it later to have deterministic `UUID()` expression. ## How was this patch tested? Added unit tests. Author: Liang-Chi Hsieh <viirya@gmail.com> Closesapache#20817 from viirya/SPARK-23599. (cherry picked from commit 4de638c) Signed-off-by: Herman van Hovell <hvanhovell@databricks.com>
What changes were proposed in this pull request?
This patch adds a UUID generator from Pseudo-Random Numbers. We can use it later to have deterministic
UUID()expression.How was this patch tested?
Added unit tests.