io.deephaven.engine.table.impl.sources.aggregate.LongAggregateColumnSource 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.LongVector;
import io.deephaven.engine.table.impl.vector.LongVectorColumnWrapper;
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 long columns.
*/
public final class LongAggregateColumnSource extends BaseAggregateColumnSource {
LongAggregateColumnSource(@NotNull final ColumnSource aggregatedSource,
@NotNull final ColumnSource extends RowSet> groupRowSetSource) {
super(LongVector.class, aggregatedSource, groupRowSetSource);
}
@Override
public LongVector get(final long rowKey) {
if (rowKey == RowSequence.NULL_ROW_KEY) {
return null;
}
return new LongVectorColumnWrapper(aggregatedSource, groupRowSetSource.get(rowKey));
}
@Override
public LongVector getPrev(final long rowKey) {
if (rowKey == RowSequence.NULL_ROW_KEY) {
return null;
}
return new LongVectorColumnWrapper(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 LongVectorColumnWrapper(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 LongVectorColumnWrapper(aggregatedSourcePrev, groupRowSetToUse));
}
typedDestination.setSize(size);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy