/** * Adds an {@link AtomicExecution} for the {@link LoadProfileEstimator} of the described {@link OptimizationContext.OperatorContext}. * * @return this instance */ public ExecutionLineageNode addAtomicExecutionFromOperatorContext() { return this.add(this.operatorContext.getLoadProfileEstimator()); }
indexingExecutionLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.java.join.load.indexing", javaExecutor.getConfiguration() )); ExecutionLineageNode probingExecutionLineageNode = new ExecutionLineageNode(operatorContext); probingExecutionLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.java.join.load.probing", javaExecutor.getConfiguration() ));
Collection<ChannelInstance> producedChannelInstances = new LinkedList<>(); ExecutionLineageNode probingExecutionLineageNode = new ExecutionLineageNode(operatorContext); probingExecutionLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.java.cartesian.load.probing", javaExecutor.getConfiguration() )); ExecutionLineageNode indexingExecutionLineageNode = new ExecutionLineageNode(operatorContext); indexingExecutionLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.java.cartesian.load.indexing", javaExecutor.getConfiguration() ));
/** * Adds an {@link AtomicExecution} to this instance. Short-cut for {@link #add(AtomicExecution)}. * * @param loadProfileEstimator for which the {@link AtomicExecution} should be added * @return this instance */ public ExecutionLineageNode add(LoadProfileEstimator loadProfileEstimator) { return this.add(new AtomicExecution(loadProfileEstimator)); }
indexingExecutionLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.java.intersect.load.indexing", javaExecutor.getConfiguration() )); ExecutionLineageNode probingExecutionLineageNode = new ExecutionLineageNode(operatorContext); probingExecutionLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.java.intersect.load.probing", javaExecutor.getConfiguration() ));
@Override public Tuple<Collection<ExecutionLineageNode>, Collection<ChannelInstance>> evaluate( ChannelInstance[] inputs, ChannelInstance[] outputs, JavaExecutor javaExecutor, OptimizationContext.OperatorContext operatorContext) { assert inputs.length == this.getNumInputs(); assert outputs.length == this.getNumOutputs(); String url = this.getInputUrl().trim(); FileSystem fs = FileSystems.getFileSystem(url).orElseThrow( () -> new RheemException(String.format("Cannot access file system of %s.", url)) ); try { final InputStream inputStream = fs.open(url); Stream<String> lines = new BufferedReader(new InputStreamReader(inputStream)).lines(); ((StreamChannel.Instance) outputs[0]).accept(lines); } catch (IOException e) { throw new RheemException(String.format("Reading %s failed.", url), e); } ExecutionLineageNode prepareLineageNode = new ExecutionLineageNode(operatorContext); prepareLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.java.textfilesource.load.prepare", javaExecutor.getConfiguration() )); ExecutionLineageNode mainLineageNode = new ExecutionLineageNode(operatorContext); mainLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.java.textfilesource.load.main", javaExecutor.getConfiguration() )); outputs[0].getLineage().addPredecessor(mainLineageNode); return prepareLineageNode.collectAndMark(); }
@Override public Tuple<Collection<ExecutionLineageNode>, Collection<ChannelInstance>> evaluate( ChannelInstance[] inputs, ChannelInstance[] outputs, SparkExecutor sparkExecutor, OptimizationContext.OperatorContext operatorContext) { assert inputs.length == this.getNumInputs(); assert outputs.length == this.getNumOutputs(); RddChannel.Instance output = (RddChannel.Instance) outputs[0]; final JavaRDD<String> rdd = sparkExecutor.sc.textFile(this.getInputUrl()); this.name(rdd); output.accept(rdd, sparkExecutor); ExecutionLineageNode prepareLineageNode = new ExecutionLineageNode(operatorContext); prepareLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.spark.textfilesource.load.prepare", sparkExecutor.getConfiguration() )); ExecutionLineageNode mainLineageNode = new ExecutionLineageNode(operatorContext); mainLineageNode.add(LoadProfileEstimators.createFromSpecification( "rheem.spark.textfilesource.load.main", sparkExecutor.getConfiguration() )); output.getLineage().addPredecessor(mainLineageNode); return prepareLineageNode.collectAndMark(); }