Skip to content

Commit

Permalink
Cleaned up Python sort syntax. (#1663)
Browse files Browse the repository at this point in the history
* Cleaned up Python sort syntax.

* Reaned asList to as_list

Co-authored-by: Jake Mulford <jakemulf@gmail.com>

Co-authored-by: Jake Mulford <jakemulf@gmail.com>
  • Loading branch information
chipkent and jakemulf authored Dec 8, 2021
1 parent 5e17bed commit 4b18d35
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
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

0 comments on commit 4b18d35

Please sign in to comment.