Closed stanbrub closed 1 year ago
The reason for this issue is that aggAllBy
-style aggregations drop formatting columns, but headBy
and tailBy
are actually implemented (sub-optimally) as the composition of multiple operations.
See io.deephaven.engine.table.impl.QueryTable#headOrTailBy
for the implementation, but the gist of it is that it's writing down a set of update expressions for all columns naively (before the formatting columns are dropped), and then doing:
return groupBy(groupByColumns).updateView(updates).ungroup().updateView(casting);
The appropriate solution is to drop the formatting columns (see Table#dropColumnFormats
) before computing the update or cast expressions, or to filter formatting columns (see io.deephaven.engine.util.ColumnFormatting#isFormattingColumn
) during that computation.
@malhotrashivam pointed out that the reporter is actually hitting a separate bug in aggAllBy
, which is preventing hitting the bug I explained in my previous comment.
We're going to:
aggAllBy
to actually do what it intends.headOrTailBy
to explicitly building group
aggregations so that it can group the formatting columns and preserve them.
Chaining operations after _formatcolumns works for some operations but not _headby. We need to decide if we are going to support chaining on _formatcolumns or only allow it on a leaf table. If not allowed, errors should be explicit. If allowed, column formatting should be carried along through subsequent tables. (Easier said than done.)
Run the following code snippet (Tested in Deephaven 0.28.0+)
You will get an exception like the following:
If you use head_by(1, ['Strings']) or head_by(1, ['Doubles','Strings']), you get essentially the same error