clintropolis commented on a change in pull request #7950: Add array_slice and array_unshift function expr URL: https://github.com/apache/incubator-druid/pull/7950#discussion_r296916538
########## File path: docs/content/misc/math-expr.md ########## @@ -179,6 +179,8 @@ See javadoc of java.lang.Math for detailed explanation for each function. | `array_concat(arr1,arr2)` | concatenates 2 arrays, the resulting array type determined by the type of the first array | | `array_to_string(arr,str)` | joins all elements of arr by the delimiter specified by str | | `string_to_array(str1,str2)` | splits str1 into an array on the delimiter specified by str2 | +| `array_slice(arr,start,end)` | return the subarray of arr from the 0 based index start(inclusive) to end(exclusive), or `null` if start is less than 0 or greater then length of arr or less than end| +| `array_unshift(arr1,expr)` | adds expr to arr at the beginning, the resulting array type determined by the type of the first array | Review comment: I would be in favor of calling this function `array_prepend`, which [is what PostgreSQL calls it](https://www.postgresql.org/docs/current/functions-array.html), and also seems more symmetrical with `array_append`. Postgres switches the argument order, `array_prepend(anyelement, anyarray)`, which i guess makes sense for prepending, but isn't consistent with nearly all of the other array functions, which always specify the array being operated on first, like you've done here. I sort of think the way it is here is more consistent, but we should probably follow their lead on this part as well. ---------------------------------------------------------------- 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] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
