Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import org.apache.spark.sql.execution.metric.{SQLMetric, SQLMetrics}
import org.apache.spark.sql.internal.{SQLConf, StaticSQLConf}
import org.apache.spark.sql.types.{LongType, StructType}
import org.apache.spark.sql.vectorized.ColumnarBatch
import org.apache.spark.util.ThreadUtils
import org.apache.spark.util.{ThreadUtils, Utils}
import org.apache.spark.util.random.{BernoulliCellSampler, PoissonSampler}

/** Physical plan for Project. */
Expand Down Expand Up @@ -482,7 +482,7 @@ case class SampleExec(
seed: Option[Long],
child: SparkPlan) extends UnaryExecNode with CodegenSupport {

val resolvedSeed: Long = seed.getOrElse((math.random() * 1000).toLong)
val resolvedSeed: Long = seed.getOrElse(Utils.random.nextLong())

override def output: Seq[Attribute] = child.output

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,10 +897,7 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
sample.lowerBound,
sample.upperBound,
sample.withReplacement,
// TODO(SPARK-56573): The * 1000 limits the seed to only 1000 distinct values.
// Kept here for consistency with SampleExec.resolvedSeed; will be fixed
// across all call sites in SPARK-56573.
sample.seed.getOrElse((math.random() * 1000).toLong),
sample.seed.getOrElse(Utils.random.nextLong()),
sampleMethod = sample.sampleMethod)
val pushed = PushDownUtils.pushTableSample(sHolder.builder, tableSample)
if (pushed) {
Expand Down