mirror of https://github.com/apache/druid.git
minor optimize IndexMerger's MMappedIndexRowIterable
This commit is contained in:
parent
d531e69d1a
commit
362bea1090
|
@ -24,6 +24,7 @@ import com.google.common.base.Function;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Iterators;
|
import com.google.common.collect.Iterators;
|
||||||
|
@ -1157,6 +1158,18 @@ public class IndexMerger
|
||||||
@Override
|
@Override
|
||||||
public Iterator<Rowboat> iterator()
|
public Iterator<Rowboat> iterator()
|
||||||
{
|
{
|
||||||
|
final IntBuffer[] converterArray = FluentIterable
|
||||||
|
.from(convertedDims)
|
||||||
|
.transform(
|
||||||
|
new Function<String, IntBuffer>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public IntBuffer apply(String input)
|
||||||
|
{
|
||||||
|
return converters.get(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).toArray(IntBuffer.class);
|
||||||
return Iterators.transform(
|
return Iterators.transform(
|
||||||
index.iterator(),
|
index.iterator(),
|
||||||
new Function<Rowboat, Rowboat>()
|
new Function<Rowboat, Rowboat>()
|
||||||
|
@ -1169,7 +1182,7 @@ public class IndexMerger
|
||||||
int[][] dims = input.getDims();
|
int[][] dims = input.getDims();
|
||||||
int[][] newDims = new int[convertedDims.size()][];
|
int[][] newDims = new int[convertedDims.size()][];
|
||||||
for (int i = 0; i < convertedDims.size(); ++i) {
|
for (int i = 0; i < convertedDims.size(); ++i) {
|
||||||
IntBuffer converter = converters.get(convertedDims.get(i));
|
IntBuffer converter = converterArray[i];
|
||||||
|
|
||||||
if (converter == null) {
|
if (converter == null) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue