зеркало из https://github.com/Azure/pykusto.git
Add max_if and min_if, change functions package to static functions, update project settings,
This commit is contained in:
Родитель
0e06616790
Коммит
ccd570eddf
|
@ -2,15 +2,28 @@
|
|||
<dictionary name="pykusto">
|
||||
<words>
|
||||
<w>acos</w>
|
||||
<w>asin</w>
|
||||
<w>atan</w>
|
||||
<w>avgif</w>
|
||||
<w>buildschema</w>
|
||||
<w>countif</w>
|
||||
<w>countof</w>
|
||||
<w>dataframe</w>
|
||||
<w>dayofmonth</w>
|
||||
<w>dayofyear</w>
|
||||
<w>dcount</w>
|
||||
<w>dcountif</w>
|
||||
<w>delim</w>
|
||||
<w>endofday</w>
|
||||
<w>endofmonth</w>
|
||||
<w>endofweek</w>
|
||||
<w>endofyear</w>
|
||||
<w>extractjson</w>
|
||||
<w>getmonth</w>
|
||||
<w>getschema</w>
|
||||
<w>getyear</w>
|
||||
<w>hourofday</w>
|
||||
<w>indexof</w>
|
||||
<w>isempty</w>
|
||||
<w>isfinite</w>
|
||||
<w>isinf</w>
|
||||
|
@ -19,19 +32,41 @@
|
|||
<w>isutf</w>
|
||||
<w>kusto</w>
|
||||
<w>loggamma</w>
|
||||
<w>maxif</w>
|
||||
<w>minif</w>
|
||||
<w>monthofyear</w>
|
||||
<w>percentrank</w>
|
||||
<w>pykusto</w>
|
||||
<w>sqrt</w>
|
||||
<w>startofday</w>
|
||||
<w>startofmonth</w>
|
||||
<w>startofweek</w>
|
||||
<w>startofyear</w>
|
||||
<w>strcat</w>
|
||||
<w>strcmp</w>
|
||||
<w>strlen</w>
|
||||
<w>strrep</w>
|
||||
<w>subexpr</w>
|
||||
<w>tdigest</w>
|
||||
<w>timespan</w>
|
||||
<w>toarray</w>
|
||||
<w>tobool</w>
|
||||
<w>toboolean</w>
|
||||
<w>todatetime</w>
|
||||
<w>todecimal</w>
|
||||
<w>todouble</w>
|
||||
<w>todynamic</w>
|
||||
<w>toguid</w>
|
||||
<w>tohex</w>
|
||||
<w>toint</w>
|
||||
<w>tolong</w>
|
||||
<w>tolower</w>
|
||||
<w>toreal</w>
|
||||
<w>totimespan</w>
|
||||
<w>toupper</w>
|
||||
<w>urlquery</w>
|
||||
<w>weekofyear</w>
|
||||
<w>welch</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
|
@ -17,5 +17,12 @@
|
|||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="N813" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
|
@ -0,0 +1,24 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run coverage" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="pykusto" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="false" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/venv/Scripts/pytest.exe" />
|
||||
<option name="PARAMETERS" value="--cov=pykusto --cov-fail-under=100" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
|
@ -1,15 +1,15 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run tests" type="tests" factoryName="Unittests">
|
||||
<configuration default="false" name="Run tests" type="tests" factoryName="py.test">
|
||||
<module name="pykusto" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
|
||||
<option name="WORKING_DIRECTORY" value="" />
|
||||
<option name="IS_MODULE_SDK" value="false" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="_new_pattern" value="""" />
|
||||
<option name="_new_keywords" value="""" />
|
||||
<option name="_new_parameters" value="""" />
|
||||
<option name="_new_additionalArguments" value="""" />
|
||||
<option name="_new_target" value=""$PROJECT_DIR$/test"" />
|
||||
<option name="_new_targetType" value=""PATH"" />
|
||||
|
|
1674
pykusto/functions.py
1674
pykusto/functions.py
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
2
setup.py
2
setup.py
|
@ -17,6 +17,8 @@ setup(
|
|||
'pandas>=0.24.1,<=1.0.3', # azure-kusto-data requires 0.24.1
|
||||
],
|
||||
tests_require=[
|
||||
'pytest',
|
||||
'pytest-cov',
|
||||
'flake8',
|
||||
'pandas>=0.25.0', # Tests use DataFrame constructor options introduced in 0.25.0
|
||||
],
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from pykusto import functions as f
|
||||
from pykusto.expressions import column_generator as col
|
||||
from pykusto.functions import Functions as f
|
||||
from pykusto.logger import logger
|
||||
from pykusto.query import Query
|
||||
from test.test_base import TestBase
|
||||
from test.test_base import test_table as t
|
||||
|
||||
|
||||
# TODO dcount_hll
|
||||
|
||||
class TestFunction(TestBase):
|
||||
def test_acos(self):
|
||||
self.assertEqual(
|
||||
|
@ -136,6 +134,7 @@ class TestFunction(TestBase):
|
|||
Query().where(f.format_datetime(t.dateField, 'yy-MM-dd [HH:mm:ss]') == '2019-07-23 00:00:00').render()
|
||||
)
|
||||
|
||||
# noinspection SpellCheckingInspection
|
||||
def test_format_timespan(self):
|
||||
self.assertEqual(
|
||||
' | where (format_timespan(timespanField, "h:m:s.fffffff")) == "2:3:4.1234500"',
|
||||
|
@ -694,6 +693,18 @@ class TestFunction(TestBase):
|
|||
Query().summarize(f.min(t.numField)).render()
|
||||
)
|
||||
|
||||
def test_max_if(self):
|
||||
self.assertEqual(
|
||||
" | summarize maxif(numField, boolField)",
|
||||
Query().summarize(f.max_if(t.numField, t.boolField)).render()
|
||||
)
|
||||
|
||||
def test_min_if(self):
|
||||
self.assertEqual(
|
||||
" | summarize minif(numField, boolField)",
|
||||
Query().summarize(f.min_if(t.numField, t.boolField)).render()
|
||||
)
|
||||
|
||||
def test_percentile(self):
|
||||
self.assertEqual(
|
||||
" | summarize percentiles(numField, 5)",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import pandas as pd
|
||||
|
||||
from pykusto import functions as f
|
||||
from pykusto.client import PyKustoClient
|
||||
from pykusto.expressions import column_generator as col
|
||||
from pykusto.functions import Functions as f
|
||||
from pykusto.query import Query, Order, Nulls, JoinKind, JoinException, BagExpansion, Distribution
|
||||
from pykusto.type_utils import KustoType
|
||||
from test.test_base import TestBase, mock_databases_response, MockKustoClient, mock_response
|
||||
|
|
Загрузка…
Ссылка в новой задаче