Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/com/facebook/presto/HashAggregation.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ public class HashAggregation
private long position;
private final TupleInfo tupleInfo;

public HashAggregation(TupleInfo tupleInfo, Iterator<RunLengthEncodedBlock> keySource,
public HashAggregation(TupleInfo outputTupleInfo,
Iterator<RunLengthEncodedBlock> keySource,
SeekableIterator<ValueBlock> valueSource,
Provider<AggregationFunction> functionProvider)
{
this.groupBySource = keySource;
this.aggregationSource = valueSource;

this.functionProvider = functionProvider;
this.tupleInfo = tupleInfo;
this.tupleInfo = outputTupleInfo;
}

@Override
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/com/facebook/presto/SumAggregation.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.facebook.presto;

import static com.facebook.presto.SizeOf.SIZE_OF_LONG;

public class SumAggregation
implements AggregationFunction
{
Expand All @@ -26,8 +24,8 @@ public void add(ValueBlock values, PositionBlock relevantPositions)
@Override
public Tuple evaluate()
{
Slice slice = Slices.allocate(SIZE_OF_LONG);
slice.setLong(0, sum);
return new Tuple(slice, getTupleInfo());
return getTupleInfo().builder()
.append(sum)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.facebook.presto;

import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.PeekingIterator;
Expand All @@ -14,13 +13,11 @@
import java.util.List;
import java.util.Map;

import static com.facebook.presto.SizeOf.SIZE_OF_LONG;
import static com.facebook.presto.SizeOf.SIZE_OF_SHORT;
import static com.facebook.presto.TupleInfo.Type.FIXED_INT_64;
import static com.facebook.presto.TupleInfo.Type.VARIABLE_BINARY;
import static com.google.common.base.Charsets.UTF_8;

public class TestSumAggregation
public class TestAggregations
{
@Test
public void testPipelinedAggregation()
Expand Down