Skip to content

Commit

Permalink
Try remove reset
Browse files Browse the repository at this point in the history
  • Loading branch information
timoninmaxim committed Jan 30, 2025
1 parent d76f12a commit 1cfe436
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ private ArrayRowHandler() {}
row[field] = val;
}

/** */
@Override public void resetRow(Object[] row) {
Arrays.fill(row, null);
}

/** */
@Override public Object[] copyRow(Object[] row) {
Object[] copy = new Object[row.length];
Expand All @@ -70,6 +65,8 @@ private ArrayRowHandler() {}
@Override public RowFactory<Object[]> factory(Type... types) {
int rowLen = types.length;

Object[] row = new Object[rowLen];

return new RowFactory<Object[]>() {
/** {@inheritDoc} */
@Override public RowHandler<Object[]> handler() {
Expand All @@ -78,7 +75,9 @@ private ArrayRowHandler() {}

/** {@inheritDoc} */
@Override public Object[] create() {
return new Object[rowLen];
Arrays.fill(row, null);

return row;
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ public interface RowHandler<Row> {
/** */
void set(int field, Row row, Object val);

/** Reset values all fields of the row to {@code null}. */
void resetRow(Row row);

/** Creates a copy of the row. */
Row copyRow(Row row);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ private WrapperPrototype(AggregateCall call) {
return new Function<Row, Row>() {
final RowHandler<Row> hnd = ctx.rowHandler();

final Row out = hnd.factory(ctx.getTypeFactory(), inputRowType).create();
final RowHandler.RowFactory<Row> rowFac = hnd.factory(ctx.getTypeFactory(), inputRowType);

@Override public Row apply(Row in) {
hnd.resetRow(out);
Row out = rowFac.create();

for (int i = 0; i < hnd.columnCount(in); ++i) {
Object val = hnd.get(i, in);
Expand Down

0 comments on commit 1cfe436

Please sign in to comment.