Codota Logo
FileChannel$Instance.getSinglePath
Code IndexAdd Codota to your IDE (free)

How to use
getSinglePath
method
in
org.qcri.rheem.basic.channels.FileChannel$Instance

Best Java code snippets using org.qcri.rheem.basic.channels.FileChannel$Instance.getSinglePath (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: org.qcri.rheem/rheem-basic

  @Override
  public void doDispose() throws RheemException {
    Actions.doSafe(() -> {
      logger.info("Deleting file channel instances {}.", this.paths);
      final String path = this.getSinglePath();
      final Optional<FileSystem> fileSystemOptional = FileSystems.getFileSystem(path);
      fileSystemOptional.ifPresent(fs -> {
        try {
          fs.delete(path, true);
        } catch (IOException e) {
          throw new UncheckedIOException(e);
        }
      });
    });
  }
}
origin: org.qcri.rheem/rheem-spark

@Override
public Tuple<Collection<ExecutionLineageNode>, Collection<ChannelInstance>> evaluate(
    ChannelInstance[] inputs,
    ChannelInstance[] outputs,
    SparkExecutor sparkExecutor,
    OptimizationContext.OperatorContext operatorContext) {
  final String sourcePath;
  if (this.sourcePath != null) {
    assert inputs.length == 0;
    sourcePath = this.sourcePath;
  } else {
    FileChannel.Instance input = (FileChannel.Instance) inputs[0];
    sourcePath = input.getSinglePath();
  }
  RddChannel.Instance output = (RddChannel.Instance) outputs[0];
  final String actualInputPath = FileSystems.findActualSingleInputPath(sourcePath);
  final JavaRDD<String> linesRdd = sparkExecutor.sc.textFile(actualInputPath);
  this.name(linesRdd);
  final JavaRDD<T> dataQuantaRdd = linesRdd
      .map(line -> {
        // TODO: Important. Enrich type informations to create the correct parser!
        int tabPos = line.indexOf('\t');
        return (T) new Tuple2<>(
            Integer.valueOf(line.substring(0, tabPos)),
            Float.valueOf(line.substring(tabPos + 1)));
      });
  this.name(dataQuantaRdd);
  output.accept(dataQuantaRdd, sparkExecutor);
  return ExecutionOperator.modelLazyExecution(inputs, outputs, operatorContext);
}
origin: org.qcri.rheem/rheem-java

@Override
public Tuple<Collection<ExecutionLineageNode>, Collection<ChannelInstance>> evaluate(
    ChannelInstance[] inputs,
    ChannelInstance[] outputs,
    JavaExecutor javaExecutor,
    OptimizationContext.OperatorContext operatorContext) {
  assert outputs.length == this.getNumOutputs();
  SequenceFileIterator sequenceFileIterator;
  final String path;
  if (this.sourcePath == null) {
    final FileChannel.Instance input = (FileChannel.Instance) inputs[0];
    path = input.getSinglePath();
  } else {
    assert inputs.length == 0;
    path = this.sourcePath;
  }
  try {
    final String actualInputPath = FileSystems.findActualSingleInputPath(path);
    sequenceFileIterator = new SequenceFileIterator<>(actualInputPath);
    Stream<?> sequenceFileStream =
        StreamSupport.stream(Spliterators.spliteratorUnknownSize(sequenceFileIterator, 0), false);
    ((StreamChannel.Instance) outputs[0]).accept(sequenceFileStream);
  } catch (IOException e) {
    throw new RheemException(String.format("%s failed to read from %s.", this, path), e);
  }
  return ExecutionOperator.modelEagerExecution(inputs, outputs, operatorContext);
}
origin: org.qcri.rheem/rheem-java

@Override
public Tuple<Collection<ExecutionLineageNode>, Collection<ChannelInstance>> evaluate(
    ChannelInstance[] inputs,
    ChannelInstance[] outputs,
    JavaExecutor javaExecutor,
    OptimizationContext.OperatorContext operatorContext) {
  assert outputs.length == this.getNumOutputs();
  final String path;
  if (this.sourcePath == null) {
    final FileChannel.Instance input = (FileChannel.Instance) inputs[0];
    path = input.getSinglePath();
  } else {
    assert inputs.length == 0;
    path = this.sourcePath;
  }
  final String actualInputPath = FileSystems.findActualSingleInputPath(path);
  Stream<T> stream = this.createStream(actualInputPath);
  ((StreamChannel.Instance) outputs[0]).accept(stream);
  return ExecutionOperator.modelLazyExecution(inputs, outputs, operatorContext);
}
origin: org.qcri.rheem/rheem-spark

@Override
public Tuple<Collection<ExecutionLineageNode>, Collection<ChannelInstance>> evaluate(
    ChannelInstance[] inputs,
    ChannelInstance[] outputs,
    SparkExecutor sparkExecutor,
    OptimizationContext.OperatorContext operatorContext) {
  final String sourcePath;
  if (this.sourcePath != null) {
    assert inputs.length == 0;
    sourcePath = this.sourcePath;
  } else {
    FileChannel.Instance input = (FileChannel.Instance) inputs[0];
    sourcePath = input.getSinglePath();
  }
  RddChannel.Instance output = (RddChannel.Instance) outputs[0];
  final String actualInputPath = FileSystems.findActualSingleInputPath(sourcePath);
  final JavaRDD<Object> rdd = sparkExecutor.sc.objectFile(actualInputPath);
  this.name(rdd);
  output.accept(rdd, sparkExecutor);
  return ExecutionOperator.modelLazyExecution(inputs, outputs, operatorContext);
}
origin: org.qcri.rheem/rheem-graphchi

final String inputPath = inputFileChannelInstance.getSinglePath();
final String actualInputPath = FileSystems.findActualSingleInputPath(inputPath);
final FileSystem inputFs = FileSystems.getFileSystem(inputPath).orElseThrow(
org.qcri.rheem.basic.channelsFileChannel$InstancegetSinglePath

Javadoc

If there is only a single element on #getPaths(), retrieves it. Otherwise, fails.

Popular methods of FileChannel$Instance

  • addGivenOrTempPath
  • <init>
    Creates a new instance.
  • addPath
  • generateTempPath
  • getLineage
  • wasProduced

Popular in Java

  • Updating database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • requestLocationUpdates (LocationManager)
  • notifyDataSetChanged (ArrayAdapter)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • JTextField (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now