in spark/sql/dataframe.go [1428:1454]
func (df *dataFrameImpl) sample(ctx context.Context, withReplacement *bool, fraction float64, seed *int64) (DataFrame, error) {
if seed == nil {
defaultSeed := rand.Int64()
seed = &defaultSeed
}
if withReplacement == nil {
defaultWithReplacement := false
withReplacement = &defaultWithReplacement
}
rel := &proto.Relation{
Common: &proto.RelationCommon{
PlanId: newPlanId(),
},
RelType: &proto.Relation_Sample{
Sample: &proto.Sample{
Input: df.relation,
LowerBound: 0,
UpperBound: fraction,
WithReplacement: withReplacement,
Seed: seed,
},
},
}
return NewDataFrame(df.session, rel), nil
}