Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaned up Python sort syntax. #1663

Merged
merged 2 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Integrations/python/deephaven/TableManipulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# None until the first successful _defineSymbols() call
Aggregation = None #: Class to supply helpers for constructing aggregations
ColumnName = None #: Class to represent a column name
ColumnRenderersBuilder = None #: Class to build and parse the directive for Table.COLUMN_RENDERERS_ATTRIBUTE (io.deephaven.engine.util.ColumnRenderersBuilder).
DistinctFormatter = None #: Class to create distinct and unique coloration for each unique input value (io.deephaven.engine.util.ColorUtil$DistinctFormatter).
DownsampledWhereFilter = None #: Class to downsample time series data by calculating the bin intervals for values, and then using upperBin and lastBy to select the last row for each bin (io.deephaven.engine.table.impl.select.DownsampledWhereFilter).
Expand All @@ -33,12 +34,13 @@ def _defineSymbols():
if not jpy.has_jvm():
raise SystemError("No java functionality can be used until the JVM has been initialized through the jpy module")

global Aggregation, ColumnRenderersBuilder, DistinctFormatter, DownsampledWhereFilter, DynamicTableWriter, \
global Aggregation, ColumnName, ColumnRenderersBuilder, DistinctFormatter, DownsampledWhereFilter, DynamicTableWriter, \
LayoutHintBuilder, Replayer, SmartKey, SortColumn, TotalsTableBuilder

if Aggregation is None:
# This will raise an exception if the desired object is not the classpath
Aggregation = jpy.get_type('io.deephaven.api.agg.Aggregation')
ColumnName = jpy.get_type("io.deephaven.api.ColumnName")
ColumnRenderersBuilder = jpy.get_type('io.deephaven.engine.util.ColumnRenderersBuilder')
DistinctFormatter = jpy.get_type('io.deephaven.engine.util.ColorUtil$DistinctFormatter')
DownsampledWhereFilter = jpy.get_type('io.deephaven.engine.table.impl.select.DownsampledWhereFilter')
Expand Down
16 changes: 11 additions & 5 deletions Integrations/python/deephaven/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* from conversion_utils import convertToJavaArray, convertToJavaList, convertToJavaArrayList,
convertToJavaHashSet, convertToJavaHashMap

* from TableManipulation import Aggregation, ColumnRenderersBuilder, DistinctFormatter,
* from TableManipulation import Aggregation, ColumnName, ColumnRenderersBuilder, DistinctFormatter,
DownsampledWhereFilter, DynamicTableWriter, LayoutHintBuilder,
Replayer, SmartKey, SortColumn, TotalsTableBuilder, WindowCheck

Expand All @@ -55,7 +55,7 @@
"convertToJavaArray", "convertToJavaList", "convertToJavaArrayList", "convertToJavaHashSet",
"convertToJavaHashMap", # from conversion_utils

'Aggregation', 'ColumnRenderersBuilder', 'DistinctFormatter', 'DownsampledWhereFilter', 'DynamicTableWriter',
'Aggregation', 'ColumnName', 'ColumnRenderersBuilder', 'DistinctFormatter', 'DownsampledWhereFilter', 'DynamicTableWriter',
'LayoutHintBuilder', 'Replayer', 'SmartKey', 'SortColumn', 'TotalsTableBuilder', 'WindowCheck', # from TableManipulation

"cals", "af", "dtu", "figw", "mavg", "plt", "pt", "ttools", "tloggers", # subpackages with abbreviated names
Expand Down Expand Up @@ -97,7 +97,7 @@

from .csv import read as read_csv
from .csv import write as write_csv

from .conversion_utils import convertToJavaList as as_list

# NB: this must be defined BEFORE importing .jvm_init or .start_jvm (circular import)
def initialize():
Expand All @@ -124,9 +124,9 @@ def initialize():

import deephaven.TableManipulation
deephaven.TableManipulation._defineSymbols()
global Aggregation, ColumnRenderersBuilder, DistinctFormatter, DownsampledWhereFilter, DynamicTableWriter, \
global Aggregation, ColumnName, ColumnRenderersBuilder, DistinctFormatter, DownsampledWhereFilter, DynamicTableWriter, \
LayoutHintBuilder, Replayer, SmartKey, SortColumn, TotalsTableBuilder
from deephaven.TableManipulation import Aggregation, ColumnRenderersBuilder, DistinctFormatter, \
from deephaven.TableManipulation import Aggregation, ColumnName, ColumnRenderersBuilder, DistinctFormatter, \
DownsampledWhereFilter, DynamicTableWriter, LayoutHintBuilder, Replayer, SmartKey, \
SortColumn, TotalsTableBuilder

Expand Down Expand Up @@ -415,6 +415,12 @@ def doLocked(f, lock_type="shared"):


def combo_agg(agg_list):
"""
Combines aggregations.

:param agg_list: list of aggregations
:return: combined aggregations
"""
_JArrayList = jpy.get_type("java.util.ArrayList")
j_agg_list = _JArrayList(len(agg_list))
for agg in agg_list:
Expand Down