Custom Columns
Manage Custom Columns
Manage Custom Columns is a feature that enables you to quickly add new columns and manipulate other columns directly within the table interface in Deephaven.
For example, in the table of stock trades shown below there are five columns including Date, Timestamp, Sym (Symbol), Price, and Quantity. However, there is no column showing the total value of each individual trade (i.e., Price x Quantity). The user could go back and rewrite the query to create the new column. However, adding a new column to calculate the value could also be done using Manage Custom Columns.
To create a new custom column to hold that calculation, right-click on any column name in a table, and then click Manage Custom Columns. The Column Builder interface will appear (See below).
Type the name of the new column in the field on the left titled Column Name. (Note: Column names cannot contain spaces.) The Column Formula field is used to hold the formula you want to use to create the data in the column rows.
The example below is a calculation to determine the total value of each trade, so it uses "Total" as the value in the Column Name field and "Price*Quantity" (using an asterisk for the multiplication symbol) as the value in the Column Formula field.
No other custom columns are needed in this example. However, other columns and their respective formulas can be added by clicking the + button on the left side of the dialog window. To remove a custom column, click the X button to the left of the column name. To change the order of the new custom columns, click the up or down buttons to the right the Column Formula field.
Custom column formulas that have no syntax issues can still cause errors when actually applied to the view's dataset. If this happens, the underlying worker will crash and require a restart. The most common case is a NullPointerException, which can occur when for example a row contains a null value for Symbol in Symbol.contains(`SPX`) .
When you are done creating new custom columns, click Update Columns to add the new column(s) to the displayed table, as shown below
Custom columns created in this manner can be edited or removed by right-clicking again on any column header and selecting Manage Custom Columns.
New column(s) created in this manner are only temporarily added to the table displayed in your immediate workspace. If you close Deephaven and restart it later, the new column will no longer be part of the table. If you would like the new column to persist in the table, click Save at the top of the Deephaven interface. This will save your current workspace, including the definition and layout of any custom columns.
Note that creating a Custom Column can potentially break a persistent query if the tables are ticking. Setting the property SystemicObjectTracker.enabled
to true
enables systemic object tracking. This can be done via property files or using extra JVM arguments of a persistent query.
Clear All Custom Columns
If the table contains one or more columns created by the process outlined in Manage Custom Columns, selecting this option will delete all of those custom columns. If there are no custom columns in the table, this option will be grayed out in the menu.
Last Updated: 16 February 2021 18:07 -04:00 UTC Deephaven v.1.20200928 (See other versions)
Deephaven Documentation Copyright 2016-2020 Deephaven Data Labs, LLC All Rights Reserved