зеркало из https://github.com/Azure/pykusto.git
array slice
This commit is contained in:
Родитель
09d9f7d1c2
Коммит
22322a2212
|
@ -42,9 +42,12 @@ class Functions:
|
|||
"""
|
||||
return _ArrayExpression(expr).array_length()
|
||||
|
||||
# def array_slice(): return
|
||||
#
|
||||
#
|
||||
def array_slice(expr: ArrayType, start: NumberType, end: NumberType) -> ArrayType:
|
||||
"""
|
||||
https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/arrayslicefunction
|
||||
"""
|
||||
return _ArrayExpression(expr)[start, end]
|
||||
|
||||
# def array_split(): return
|
||||
#
|
||||
#
|
||||
|
|
|
@ -32,6 +32,12 @@ class TestFunction(TestBase):
|
|||
Query().where(f.array_length(t.arrayField) > 4).render()
|
||||
)
|
||||
|
||||
def test_array_slice(self):
|
||||
self.assertEqual(
|
||||
" | extend sliced = (array_slice(arrayField, 1, 2))",
|
||||
Query().extend(sliced=f.array_slice(t.arrayField, 1, 2)).render()
|
||||
)
|
||||
|
||||
def test_bag_keys(self):
|
||||
self.assertEqual(
|
||||
" | where (array_length(bag_keys(mapField))) > 4",
|
||||
|
|
Загрузка…
Ссылка в новой задаче