Skip to content

issue 148 - add array sort asc#149

Open
DaniellePoleg wants to merge 2 commits intomasterfrom
issue148_add_array_sort_asc
Open

issue 148 - add array sort asc#149
DaniellePoleg wants to merge 2 commits intomasterfrom
issue148_add_array_sort_asc

Conversation

@DaniellePoleg
Copy link
Collaborator

No description provided.

return _ArrayExpression(KQL(f'array_slice({_to_kql(array)}, {_to_kql(start)}, {_to_kql(end)})'))

@staticmethod
def array_sort_asc(array1: ArrayType, nulls_last: BooleanType = None, *more_arrays: ArrayType) -> _ArrayExpression:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the order of the variables is a bit confusing, due to the mismatch between KQL and python.
My suggestion is to use instead:
def array_sort_asc(to_sort: Union[ArrayType, List[ArrayType]], nulls_last: BooleanType = None) -> _ArrayExpression:...

and then handle to_sort according to type.
WDYT?
also @ymost

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little known Python 3 feature: you can put a keyword argument after a varargs argument, and then it becomes a keyword-only argument.
So we can do this:
def array_sort_asc(*arrays: ArrayType, nulls_last: BooleanType = True) -> _ArrayExpression:
The only down side is that the user will be forced to use keyword notation (e.g. nulls_last=False ).
Also note that per the Kusto default, our default should be 'True'.

@ymost ymost linked an issue Jul 28, 2021 that may be closed by this pull request
@ymost ymost added the enhancement New feature or request label Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add function array_sort_asc

3 participants