Uh oh!
There was an error while loading. Please reload this page.
[SPARK-19800][SS][WIP] Implement one kind of streaming sampling - reservoir sampling - #17141
[SPARK-19800][SS][WIP] Implement one kind of streaming sampling - reservoir sampling#17141uncleGen wants to merge 6 commits into
Conversation
srowen
commented
Mar 2, 2017
Why does this need to be in Spark? |
SparkQA
commented
Mar 2, 2017
Test build #73778 has finished for PR 17141 at commit
|
@srowen There are some unsupported |
uncleGen
commented
Mar 3, 2017
| private val enc = Encoders.STRING.asInstanceOf[ExpressionEncoder[String]] | ||
| private val NUM_RECORDS_IN_PARTITION = enc.toRow("NUM_RECORDS_IN_PARTITION") | ||
| .asInstanceOf[UnsafeRow] | ||
There was a problem hiding this comment.
NUM_RECORDS_IN_PARTITION calculate the total number of records in current partiton, and update at the end of sample.
| UnsafeProjection.create(withSumFieldTypes).apply(InternalRow.fromSeq( | ||
| new JoinedRow(kv._2, numRecordsTillNow) | ||
| .toSeq(withSumFieldTypes))) | ||
| }), {}) |
There was a problem hiding this comment.
Here, we transfer the row to (row, numRecordsTillNow), and numRecordsTillNow is used to calculate the weight of item.
| .map(update => { | ||
| UnsafeProjection.create(withSumFieldTypes).apply(InternalRow.fromSeq( | ||
| new JoinedRow(update.value, numRecordsTillNow) | ||
| .toSeq(withSumFieldTypes))) |
| .apply(InternalRow.fromSeq(row.toSeq(fieldTypes))) | ||
| ).iterator | ||
| }) | ||
| } |
There was a problem hiding this comment.
here, we do once global weight reservoir sampling.
| store.put(replacementIdx, r.asInstanceOf[UnsafeRow]) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
In partiton, we just need to do once normal (without weight) reservoir sampling.
| .groupBy("value").count() | ||
| assert(df.count() == 3, "") | ||
| } | ||
| } |
There was a problem hiding this comment.
new unit test needs to be improved.
uncleGen
commented
Mar 7, 2017
SparkQA
commented
Mar 9, 2017
Test build #74238 has finished for PR 17141 at commit
|
SparkQA
commented
Mar 20, 2017
Test build #74841 has finished for PR 17141 at commit
|
SparkQA
commented
Mar 20, 2017
Test build #74843 has finished for PR 17141 at commit
|
jiangxb1987
commented
May 24, 2017
# What changes were proposed in this pull request? This PR proposes to close stale PRs, mostly the same instances with apache#18017Closesapache#11459Closesapache#13833Closesapache#13720Closesapache#12506Closesapache#12456Closesapache#12252Closesapache#17689Closesapache#17791Closesapache#18163Closesapache#17640Closesapache#17926Closesapache#18163Closesapache#12506Closesapache#18044Closesapache#14036Closesapache#15831Closesapache#14461Closesapache#17638Closesapache#18222 Added: Closesapache#18045Closesapache#18061Closesapache#18010Closesapache#18041Closesapache#18124Closesapache#18130Closesapache#12217 Added: Closesapache#16291Closesapache#17480Closesapache#14995 Added: Closesapache#12835Closesapache#17141 ## How was this patch tested? N/A Author: hyukjinkwon <gurwls223@gmail.com> Closesapache#18223 from HyukjinKwon/close-stale-prs.
What changes were proposed in this pull request?
This pr adds a special streaming sample operator to support
sample. It adds a new evolving operatorreservoir, and introduce an new logical planReservoirSampleand two physical planStreamingReservoirSampleExecandReservoirSampleExec.The following cases are supported:
Not supported cases:
Followups:
reservoirintosampleoperatorHow was this patch tested?
add new unit tests.