sthetland commented on a change in pull request #11254:
URL: https://github.com/apache/druid/pull/11254#discussion_r644180490



##########
File path: docs/misc/math-expr.md
##########
@@ -50,7 +50,7 @@ Expressions can contain variables. Variable names may contain 
letters, digits, '
 
 For logical operators, a number is true if and only if it is positive (0 or 
negative value means false). For string type, it's the evaluation result of 
'Boolean.valueOf(string)'.
 
-[Multi-value string dimensions](../querying/multi-value-dimensions.md) are 
supported and may be treated as either scalar or array typed values. When 
treated as a scalar type, an expression will automatically be transformed to 
apply the scalar operation across all values of the multi-valued type, to mimic 
Druid's native behavior. Values that result in arrays will be coerced back into 
the native Druid string type for aggregation. Druid aggregations on multi-value 
string dimensions on the individual values, _not_ the 'array', behaving similar 
to the `UNNEST` operator available in many SQL dialects. However, by using the 
`array_to_string` function, aggregations may be done on a stringified version 
of the complete array, allowing the complete row to be preserved. Using 
`string_to_array` in an expression post-aggregator, allows transforming the 
stringified dimension back into the true native array type.
+[Multi-value string dimensions](../querying/multi-value-dimensions.md) are 
supported and may be treated as either scalar or array typed values. When 
treated as a scalar type, an expression will automatically be transformed to 
apply the scalar operation across all values of the multi-valued type, to mimic 
Druid's native behavior. Values that result in arrays will be coerced back into 
the native Druid string type for aggregation. Druid aggregations on multi-value 
string dimensions act on the individual values, _not_ the 'array', behaving 
similar to the `UNNEST` operator available in many SQL dialects. However, by 
using the `array_to_string` function, aggregations may be done on a stringified 
version of the complete array, allowing the complete row to be preserved. Using 
`string_to_array` in an expression post-aggregator, allows transforming the 
stringified dimension back into the true native array type.

Review comment:
       Incorporating your suggestion @clintropolis  and adding my ¢2: 
   
   ```suggestion
   [Multi-value string dimensions](../querying/multi-value-dimensions.md) are 
supported and may be treated as either scalar or array typed values, as 
follows:  
   * When treated as a scalar type, the expression is automatically transformed 
so that the scalar operation is applied across all values of the multi-valued 
type, mimicking Druid's native behavior. 
   * Values that result in arrays are coerced back into the native Druid string 
type for grouping and aggregation. Grouping on multi-value string dimensions in 
Druid will group by the individual values, not the 'array', resulting in 
behavior similar to the UNNEST operator available in many SQL dialects. 
Alternatively, you can use the `array_to_string` function to perform the 
aggregation on a _stringified_ version of the complete array, preserving the 
complete row. Using `string_to_array` in an expression post-aggregator 
transforms the stringified dimension back into the true native array type.
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to