From 3e98846a991ea53cf7dc98b7d7957bfd4fc494a6 Mon Sep 17 00:00:00 2001 From: Adam Perlin <adamp@nanosoft.com> Date: Wed, 1 Aug 2018 09:09:45 -0700 Subject: [PATCH] Specify how group key is handled in rename/drop spec (#524) * Specify how group key is handled in rename/drop spec --- query/docs/SPEC.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/query/docs/SPEC.md b/query/docs/SPEC.md index c4a7515205..ca8177161f 100644 --- a/query/docs/SPEC.md +++ b/query/docs/SPEC.md @@ -1086,9 +1086,10 @@ Range has the following properties: #### Rename -Rename will rename specified columns in a data table. +Rename will rename specified columns in a table. There are two variants: one which takes a map of old column names to new column names, - and one which takes a mapping function. +and one which takes a mapping function. +If a column is renamed and is part of the group key, the column name in the group key will be updated. Rename has the following properties: * `columns` object @@ -1105,8 +1106,9 @@ Rename all columns with `fn` parameter: `rename(fn: (col) => "{col}_new")` #### Drop -Drop will exclude specified columns from a returned data table. Columns to exclude can be specified either through a +Drop will exclude specified columns from a table. Columns to exclude can be specified either through a list, or a predicate function. +When a dropped column is part of the group key it will also be dropped from the key. Drop has the following properties: * `columns` array of strings @@ -1123,8 +1125,9 @@ Drop all columns matching a predicate: `drop(fn: (col) => col =~ /usage*/)` #### Keep -Keep can be thought of as the inverse of drop. It will return a table containing only columns that are specified, -ignoring all others. +Keep is the inverse of drop. It will return a table containing only columns that are specified, +ignoring all others. +Only columns in the group key that are also specified in `keep` will be kept in the resulting group key. Keep has the following properties: * `columns` array of strings