Skip to content

Commit

Permalink
Remove instanceof checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dlmarion committed Oct 24, 2023
1 parent b45aa4a commit 0957d10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.apache.accumulo.core.client.rfile;

import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -348,13 +347,10 @@ public Iterator<Entry<Key,Value>> iterator() {

for (int i = 0; i < sources.length; i++) {
// TODO may have been a bug with multiple files and caching in older version...
InputStream inputStream = sources[i].getInputStream();
if (!(inputStream instanceof FSDataInputStream)) {
throw new IllegalArgumentException("Input stream " + i + " is not a FSDataInputStream");
}
CachableBuilder cb = new CachableBuilder()
.input((FSDataInputStream) inputStream, "source-" + i).length(sources[i].getLength())
.conf(opts.in.getConf()).cacheProvider(cacheProvider).cryptoService(cryptoService);
.input((FSDataInputStream) sources[i].getInputStream(), "source-" + i)
.length(sources[i].getLength()).conf(opts.in.getConf()).cacheProvider(cacheProvider)
.cryptoService(cryptoService);
readers.add(RFile.getReader(cb, sources[i].getRange()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.DataInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.UncheckedIOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -179,12 +178,9 @@ private static SummaryReader load(CachableBlockFile.Reader bcReader,
public static SummaryReader load(Configuration conf, RFileSource source, String cacheId,
Predicate<SummarizerConfiguration> summarySelector, SummarizerFactory factory,
CryptoService cryptoService) throws IOException {
InputStream input = source.getInputStream();
if (!(input instanceof FSDataInputStream)) {
throw new IllegalArgumentException("Input stream is not a FSDataInputStream");
}
CachableBuilder cb = new CachableBuilder().input((FSDataInputStream) input, cacheId)
.length(source.getLength()).conf(conf).cryptoService(cryptoService);
CachableBuilder cb =
new CachableBuilder().input((FSDataInputStream) source.getInputStream(), cacheId)
.length(source.getLength()).conf(conf).cryptoService(cryptoService);
return load(new CachableBlockFile.Reader(cb), summarySelector, factory);
}

Expand Down

0 comments on commit 0957d10

Please sign in to comment.