Skip to content

Commit 6a7268f

Browse files
authored
docs: DOC-1091: Rollup topic should mention that only Strings and primitives are allowed types for rollup by (#7542)
https://deephaven.atlassian.net/browse/DOC-1091
1 parent a545e07 commit 6a7268f

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed
Lines changed: 3 additions & 0 deletions
Loading

docs/groovy/how-to-guides/rollup-table.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,33 @@ result = source.rollup(aggList, "Group", "Subgroup")
113113

114114
![Creating a rollup table](../assets/how-to/new-rollup.gif)
115115

116+
Note that rollup tables can only be created from String or primitive columns. Attempting to use a non-primitive type such as `LocalDate` or a Timestamp as a rollup column results in an error:
117+
118+
```groovy skip-test
119+
import io.deephaven.api.agg.Aggregation
120+
121+
t = newTable(
122+
stringCol("Sym", "AAPL", "AAPL", "GOOGL", "GOOGL", "AAPL"),
123+
doubleCol("Last", 150.25, 151.50, 920.75, 922.10, 152.00),
124+
intCol("Size", 100, 200, 50, 150, 300),
125+
instantCol("ExchangeTimestamp",
126+
parseInstant("2017-08-25T09:30:00 UTC"),
127+
parseInstant("2017-08-25T10:15:00 UTC"),
128+
parseInstant("2017-08-25T11:45:00 UTC"),
129+
parseInstant("2017-08-25T14:20:00 UTC"),
130+
parseInstant("2017-08-25T15:50:00 UTC")
131+
)
132+
)
133+
134+
t = t.update("LocalExchangeTimestampDate=toLocalDate(ExchangeTimestamp, timeZone(`UTC`))")
135+
136+
aggList = [Aggregation.AggAvg("Last", "Size")]
137+
138+
tRollup = t.rollup(aggList, "LocalExchangeTimestampDate")
139+
```
140+
141+
![An error message stating that Deephaven can't parse the LOCAL_DATE data type](../assets/how-to/cant-parse-local-date.png)
142+
116143
## Related documentation
117144

118145
- [How to create a hierarchical tree table](./tree-table.md)
Lines changed: 3 additions & 0 deletions
Loading

docs/python/how-to-guides/rollup-table.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,43 @@ result = source.rollup(aggs=agg_list, by=by_list)
117117

118118
![Creating a rollup table](../assets/how-to/new-rollup.gif)
119119

120+
Note that rollup tables can only be created from String or primitive columns. Attempting to use a non-primitive type such as `LocalDate` or a Timestamp as a rollup column results in an error:
121+
122+
```python skip-test
123+
from deephaven import new_table, agg
124+
from deephaven.column import string_col, int_col, double_col, datetime_col
125+
from deephaven.time import to_j_instant
126+
127+
t = new_table(
128+
[
129+
datetime_col(
130+
"ExchangeTimestamp",
131+
[
132+
to_j_instant("2017-08-25T09:30:00 UTC"),
133+
to_j_instant("2017-08-25T10:15:00 UTC"),
134+
to_j_instant("2017-08-25T11:45:00 UTC"),
135+
to_j_instant("2017-08-25T14:20:00 UTC"),
136+
to_j_instant("2017-08-25T15:50:00 UTC"),
137+
],
138+
),
139+
string_col("Sym", ["AAPL", "AAPL", "GOOGL", "GOOGL", "AAPL"]),
140+
double_col("Last", [150.25, 151.50, 920.75, 922.10, 152.00]),
141+
int_col("Size", [100, 200, 50, 150, 300]),
142+
]
143+
)
144+
145+
t = t.update(
146+
"LocalExchangeTimestampDate=toLocalDate(ExchangeTimestamp, timeZone(`UTC`))"
147+
)
148+
149+
agg_list = [agg.avg(cols=["Last", "Size"])]
150+
by_list = ["LocalExchangeTimestampDate"]
151+
152+
t_rollup = t.rollup(aggs=agg_list, by=by_list, include_constituents=True)
153+
```
154+
155+
![An error message stating that Deephaven can't parse the LOCAL_DATE data type](../assets/how-to/cant-parse-local-date.png)
156+
120157
## Related documentation
121158

122159
- [How to create a hierarchical tree table](./tree-table.md)

0 commit comments

Comments
 (0)