'RollupTable' object has no attribute 'format_columns'
Description
I would like to apply a formatting to a rollup, but it fails as not supported
Steps to reproduce
from deephaven import empty_table, time_table, agg
agg_list = [agg.avg(cols=["MyLong", "MyDouble"])]
by_list = ["MyChar"]
simple_ticking = time_table("00:00:01").update([
"MyString=new String(`a`+i)",
"MyInt=new Integer(i)",
"MyLong=new Long(i)",
"MyDouble=new Double(i+i/10)",
"MyFloat=new Float(i+i/10)",
"MyBoolean=new Boolean(i%2==0)",
"MyChar= new Character((char) ((i%26)+97))",
"MyShort=new Short(Integer.toString(i%32767))",
"MyByte= new java.lang.Byte(Integer.toString(i%127))"])\
.rollup(aggs=agg_list, by=by_list, include_constituents=True)\
.format_columns(["MyChar = MyLong > 2 ? BLUE : NO_FORMATTING"])
Expected results
A table with column formatting.
Actual results
Type: <class 'AttributeError'>
Value: 'RollupTable' object has no attribute 'format_columns'
Line: 17
Namespace: <module>
File: <string>
Traceback (most recent call last):
File "<string>", line 17, in <module>
at org.jpy.PyLib.executeCode(PyLib.java:-2)
at org.jpy.PyObject.executeCode(PyObject.java:138)
at io.deephaven.engine.util.PythonEvaluatorJpy.evalScript(PythonEvaluatorJpy.java:73)
at io.deephaven.integrations.python.PythonDeephavenSession.lambda$evaluate$1(PythonDeephavenSession.java:183)
at io.deephaven.util.locks.FunctionalLock.doLockedInterruptibly(FunctionalLock.java:50)
at io.deephaven.integrations.python.PythonDeephavenSession.evaluate(PythonDeephavenSession.java:182)
at io.deephaven.engine.util.AbstractScriptSession.lambda$evaluateScript$1(AbstractScriptSession.java:145)
at io.deephaven.engine.context.ExecutionContext.lambda$apply$0(ExecutionContext.java:129)
at io.deephaven.engine.context.ExecutionContext.apply(ExecutionContext.java:140)
at io.deephaven.engine.context.ExecutionContext.apply(ExecutionContext.java:128)
at io.deephaven.engine.util.AbstractScriptSession.evaluateScript(AbstractScriptSession.java:145)
at io.deephaven.engine.util.DelegatingScriptSession.evaluateScript(DelegatingScriptSession.java:87)
at io.deephaven.engine.util.ScriptSession.evaluateScript(ScriptSession.java:113)
at io.deephaven.server.console.ConsoleServiceGrpcImpl.lambda$executeCommand$7(ConsoleServiceGrpcImpl.java:168)
at io.deephaven.server.session.SessionState$ExportBuilder.lambda$submit$2(SessionState.java:1348)
at io.deephaven.server.session.SessionState$ExportObject.doExport(SessionState.java:891)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at io.deephaven.server.runner.DeephavenApiServerModule$ThreadFactory.lambda$newThread$0(DeephavenApiServerModule.java:162)
at org.jpy.PyLib.callAndReturnObject(PyLib.java:-2)
at org.jpy.PyObject.call(PyObject.java:449)
at io.deephaven.server.console.python.DebuggingInitializer.lambda$createInitializer$0(DebuggingInitializer.java:30)
at java.lang.Thread.run(Thread.java:833)
Versions Engine Version: 0.22.0 Web UI Version: 0.30.0 Java Version: 17.0.6 Barrage Version: 0.5.0
@rcaudy @mkraice1 There is now an Enterprise ticket associated with this issue. Has this been triaged yet?
Format columns doesn't make sense to add to on a rollup table:
- A given rollup column can consist of two types if constituents are enabled, and in those cases, the existing format_columns() api that we find on Table will be ambiguous.
- For this reason, there is no Java RollupTable.formatColumns(...) method that the Python API can delegate to.
- Additionally, there is already a Java and Python API that handles this case separately from the table api, see below for references.
API reference for node ops recorder creation and the format_columns call that exists on that that will function as you expect: https://deephaven.io/core/pydoc/code/deephaven.table.html#deephaven.table.RollupTable.node_operation_recorder https://deephaven.io/core/pydoc/code/deephaven.table.html#deephaven.table.Table.format_columns
Note also that this is not the only call that is "missing" from the RollupTable type, but is present in the docs using the node options recorder - much like "sort" and "filter", you want to apply those specifically to either constituents or the aggregation nodes, but not both.
Example usage, from the server-side Python api tests: https://github.com/deephaven/deephaven-core/blob/16c55acd84d389c9eea194ae9bbf89834907563b/py/server/tests/test_rollup_tree_table.py#L38-L48
Additionally, as DHC formatting is moving to deephaven-ui, this belongs in that layer instead of the engine/server?
Let us know if this existing functionality is sufficient, or if we need another set of calls to cover a specific use case.