This commit is contained in:
Adi Lefkowitz 2021-11-08 11:55:00 +02:00
Родитель 09d9f7d1c2
Коммит 22322a2212
2 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -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",