Skip to main content
Version: Java (Groovy)

retainingAttributes

The retainingAttributes method returns a table that is the same as the source table, but with only the specified attributes retained. If the supplied attributes toRetain do not result in any changes, the original object may be returned.

Syntax

retainingAttributes(toRetain)

Parameters

ParameterTypeDescription
toRetain>Collection<String>

The keys of attributes to retain.

Returns

A table that is the same as the source table, but with only the specified attributes retained.

Examples

In this example, we create an Input Table, and then create a result table with a call to retainAttributes(), which returns a new table with only the specified attributes retained.

import io.deephaven.engine.table.impl.util.AppendOnlyArrayBackedInputTable
import io.deephaven.engine.table.AttributeMap

table = newTable(
doubleCol("Doubles", 3.1, 5.45, -1.0),
stringCol("Strings", "Creating", "New", "Tables")
)

source = AppendOnlyArrayBackedInputTable.make(table)

result = source.retainingAttributes(["AddOnly"])

println source.getAttributeKeys()
println result.getAttributeKeys()