/** * Copies an instance (exclusive of broadcasts). * * @param that that should be copied */ public JavaReservoirSampleOperator(SampleOperator<Type> that) { super(that); assert that.getSampleMethod() == Methods.RESERVOIR || that.getSampleMethod() == Methods.ANY; }
/** * Copies an instance (exclusive of broadcasts). * * @param that that should be copied */ public SparkRandomPartitionSampleOperator(SampleOperator<Type> that) { super(that); assert that.getSampleMethod() == Methods.RANDOM || that.getSampleMethod() == Methods.ANY; }
/** * Copies an instance (exclusive of broadcasts). * * @param that that should be copied */ public SparkShufflePartitionSampleOperator(SampleOperator<Type> that) { super(that); assert that.getSampleMethod() == Methods.SHUFFLE_PARTITION_FIRST || that.getSampleMethod() == Methods.ANY; }
/** * Copies an instance (exclusive of broadcasts). * * @param that that should be copied */ public SparkBernoulliSampleOperator(SampleOperator<Type> that) { super(that); assert that.getSampleMethod() == Methods.BERNOULLI || that.getSampleMethod() == Methods.ANY; }
/** * Copies an instance (exclusive of broadcasts). * * @param that that should be copied */ public SampleOperator(SampleOperator<Type> that) { super(that); this.sampleSizeFunction = that.sampleSizeFunction; this.seedFunction = that.seedFunction; this.sampleMethod = that.getSampleMethod(); this.datasetSize = that.getDatasetSize(); }
private SubplanPattern createSubplanPattern() { final OperatorPattern operatorPattern = new OperatorPattern<>( "sample", new SampleOperator<>(0, DataSetType.none(), null, 0L), false ).withAdditionalTest(op -> op.getSampleMethod() == SampleOperator.Methods.RANDOM || op.getSampleMethod() == SampleOperator.Methods.SHUFFLE_PARTITION_FIRST || op.getSampleMethod() == SampleOperator.Methods.BERNOULLI || op.getSampleMethod() == SampleOperator.Methods.ANY ); //TODO: check if the zero here affects execution return SubplanPattern.createSingleton(operatorPattern); }
private SubplanPattern createSubplanPattern() { final OperatorPattern operatorPattern = new OperatorPattern<>( "sample", new SampleOperator<>(0, DataSetType.none(), null, 0L), false ).withAdditionalTest(op -> op.getSampleMethod() == SampleOperator.Methods.RANDOM || op.getSampleMethod() == SampleOperator.Methods.RESERVOIR || op.getSampleMethod() == SampleOperator.Methods.ANY ); return SubplanPattern.createSingleton(operatorPattern); }
private ReplacementSubplanFactory createReplacementSubplanFactory() { return new ReplacementSubplanFactory.OfSingleOperators<SampleOperator>( (matchedOperator, epoch) -> { switch (matchedOperator.getSampleMethod()) { case ANY: case RANDOM: return new JavaRandomSampleOperator<>(matchedOperator).at(epoch); case RESERVOIR: return new JavaReservoirSampleOperator<>(matchedOperator).at(epoch); default: throw new RheemException(String.format( "%s sample method is not yet supported in Java platform.", matchedOperator.getSampleMethod() )); } } ); } }
private ReplacementSubplanFactory createReplacementSubplanFactory() { return new ReplacementSubplanFactory.OfSingleOperators<SampleOperator>( (matchedOperator, epoch) -> { switch (matchedOperator.getSampleMethod()) { case RANDOM: return new SparkRandomPartitionSampleOperator<>(matchedOperator); case ANY: case SHUFFLE_PARTITION_FIRST: return new SparkShufflePartitionSampleOperator<>(matchedOperator); case BERNOULLI: return new SparkBernoulliSampleOperator<>(matchedOperator); default: throw new RheemException(String.format( "%s sample method is not yet supported in Sample platform.", matchedOperator.getSampleMethod() )); } } ); } }