io.deephaven.engine.table.impl.sources.aggregate.ByteAggregateColumnSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-table Show documentation
Show all versions of deephaven-engine-table Show documentation
Engine Table: Implementation and closely-coupled utilities
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
/*
* ---------------------------------------------------------------------------------------------------------------------
* AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY - for any changes edit CharAggregateColumnSource and regenerate
* ---------------------------------------------------------------------------------------------------------------------
*/
package io.deephaven.engine.table.impl.sources.aggregate;
import io.deephaven.engine.rowset.RowSequence;
import io.deephaven.vector.ByteVector;
import io.deephaven.engine.table.impl.vector.ByteVectorColumnWrapper;
import io.deephaven.engine.table.ColumnSource;
import io.deephaven.chunk.attributes.Values;
import io.deephaven.chunk.ObjectChunk;
import io.deephaven.chunk.WritableChunk;
import io.deephaven.chunk.WritableObjectChunk;
import io.deephaven.engine.rowset.RowSet;
import org.jetbrains.annotations.NotNull;
/**
* {@link ColumnSource} implementation for aggregation result byte columns.
*/
public final class ByteAggregateColumnSource extends BaseAggregateColumnSource {
ByteAggregateColumnSource(@NotNull final ColumnSource aggregatedSource,
@NotNull final ColumnSource extends RowSet> groupRowSetSource) {
super(ByteVector.class, aggregatedSource, groupRowSetSource);
}
@Override
public ByteVector get(final long rowKey) {
if (rowKey == RowSequence.NULL_ROW_KEY) {
return null;
}
return new ByteVectorColumnWrapper(aggregatedSource, groupRowSetSource.get(rowKey));
}
@Override
public ByteVector getPrev(final long rowKey) {
if (rowKey == RowSequence.NULL_ROW_KEY) {
return null;
}
return new ByteVectorColumnWrapper(aggregatedSourcePrev, getPrevGroupRowSet(rowKey));
}
@Override
public void fillChunk(
@NotNull final FillContext context,
@NotNull final WritableChunk super Values> destination,
@NotNull final RowSequence rowSequence) {
final ObjectChunk groupRowSetChunk = groupRowSetSource
.getChunk(((AggregateFillContext) context).groupRowSetGetContext, rowSequence).asObjectChunk();
final WritableObjectChunk typedDestination = destination.asWritableObjectChunk();
final int size = rowSequence.intSize();
for (int di = 0; di < size; ++di) {
typedDestination.set(di, new ByteVectorColumnWrapper(aggregatedSource, groupRowSetChunk.get(di)));
}
typedDestination.setSize(size);
}
@Override
public void fillPrevChunk(
@NotNull final FillContext context,
@NotNull final WritableChunk super Values> destination,
@NotNull final RowSequence rowSequence) {
final ObjectChunk groupRowSetPrevChunk = groupRowSetSource
.getPrevChunk(((AggregateFillContext) context).groupRowSetGetContext, rowSequence).asObjectChunk();
final WritableObjectChunk typedDestination = destination.asWritableObjectChunk();
final int size = rowSequence.intSize();
for (int di = 0; di < size; ++di) {
final RowSet groupRowSetPrev = groupRowSetPrevChunk.get(di);
final RowSet groupRowSetToUse = groupRowSetPrev.isTracking()
? groupRowSetPrev.trackingCast().prev()
: groupRowSetPrev;
typedDestination.set(di, new ByteVectorColumnWrapper(aggregatedSourcePrev, groupRowSetToUse));
}
typedDestination.setSize(size);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy