Skip to content

Commit

Permalink
Made changes as requested in pull #73
Browse files Browse the repository at this point in the history
Summary:
- Class renames
- Removed the ability to read out the results of an InlinedOperator/TupleValueSink in a generic format. We can figure out how we want to expose this information at a later time.
  • Loading branch information
erichwang committed Oct 18, 2012
1 parent 55e0865 commit 8add0ca
Show file tree
Hide file tree
Showing 15 changed files with 160 additions and 545 deletions.
@@ -1,9 +1,8 @@
package com.facebook.presto.block;

import com.facebook.presto.SizeOf;
import com.facebook.presto.operator.inlined.InlinedOperator;
import com.facebook.presto.operator.inlined.InlinedOperatorHook;
import com.facebook.presto.operator.inlined.StatsInlinedOperator;
import com.facebook.presto.operator.tap.StatsTupleValueSink;
import com.facebook.presto.operator.tap.Tap;
import com.facebook.presto.slice.Slice;
import com.facebook.presto.slice.SliceOutput;

Expand Down Expand Up @@ -59,19 +58,19 @@ public TupleStream deserialize(Slice slice)
}

// TODO: how do we expose the stats data to other components?
public StatsInlinedOperator.Stats deserializeStats(Slice slice)
public StatsTupleValueSink.Stats deserializeStats(Slice slice)
{
checkNotNull(slice, "slice is null");
int footerLength = slice.getInt(slice.length() - SizeOf.SIZE_OF_INT);
int footerOffset = slice.length() - footerLength - SizeOf.SIZE_OF_INT;
return StatsInlinedOperator.resultsAsStats(TupleStreamSerdes.deserialize(TupleStreamSerdes.Encoding.RAW.createSerde(), slice.slice(footerOffset, footerLength)));
return StatsTupleValueSink.Stats.deserialize(slice.slice(footerOffset, footerLength));
}
}

private static class StatsCollectingTupleStreamWriter
implements TupleStreamWriter
{
private final InlinedOperator statsInlinedOperator = new StatsInlinedOperator() {
private final StatsTupleValueSink statsTupleValueSink = new StatsTupleValueSink() {
@Override
public void finished()
{
Expand All @@ -91,7 +90,7 @@ private StatsCollectingTupleStreamWriter(SliceOutput sliceOutput, TupleStreamWri
public StatsCollectingTupleStreamWriter append(TupleStream tupleStream)
{
checkNotNull(tupleStream, "tupleStream is null");
delegate.append(new InlinedOperatorHook(tupleStream, statsInlinedOperator));
delegate.append(new Tap(tupleStream, statsTupleValueSink));
return this;
}

Expand All @@ -100,8 +99,7 @@ public void finish()
{
delegate.finish();
int startingIndex = sliceOutput.size();
// TODO: add a better way of serializing the stats that is less fragile
TupleStreamSerdes.serialize(TupleStreamSerdes.Encoding.RAW.createSerde(), statsInlinedOperator.getResult(), sliceOutput);
StatsTupleValueSink.Stats.serialize(statsTupleValueSink.getStats(), sliceOutput);
int endingIndex = sliceOutput.size();
checkState(endingIndex > startingIndex);
sliceOutput.writeInt(endingIndex - startingIndex);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 8add0ca

Please sign in to comment.