Skip to content

Commit

Permalink
Make column_to_numpy_array private (#5256)
Browse files Browse the repository at this point in the history
* Make column_to_numpy_array private

* Respond to review comments
  • Loading branch information
jmao-denver committed Mar 15, 2024
1 parent 45325e8 commit 1c8c11f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
17 changes: 14 additions & 3 deletions py/server/deephaven/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,19 @@ def _to_column_name(name: str) -> str:
return re.sub(r"\s+", "_", tmp_name)


def column_to_numpy_array(col_def: Column, j_array: jpy.JType) -> np.ndarray:
""" Produces a numpy array from the given Java array and the Table column definition."""
def _column_to_numpy_array(col_def: Column, j_array: jpy.JType) -> np.ndarray:
""" Produces a numpy array from the given Java array and the Table column definition.
Args:
col_def (Column): the column definition
j_array (jpy.JType): the Java array
Returns:
np.ndarray
Raises:
DHError
"""
try:
return _j_array_to_numpy_array(col_def.data_type, j_array, conv_null=False, type_promotion=False)
except DHError:
Expand All @@ -49,7 +60,7 @@ def _columns_to_2d_numpy_array(col_def: Column, j_arrays: List[jpy.JType]) -> np
else:
np_arrays = []
for j_array in j_arrays:
np_arrays.append(column_to_numpy_array(col_def=col_def, j_array=j_array))
np_arrays.append(_column_to_numpy_array(col_def=col_def, j_array=j_array))
return np.stack(np_arrays, axis=1)
except DHError:
raise
Expand Down
4 changes: 2 additions & 2 deletions py/server/deephaven/table_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from deephaven._wrapper import JObjectWrapper
from deephaven.column import Column
from deephaven.jcompat import to_sequence
from deephaven.numpy import column_to_numpy_array
from deephaven.numpy import _column_to_numpy_array
from deephaven.table import Table
from deephaven.update_graph import UpdateGraph

Expand Down Expand Up @@ -51,7 +51,7 @@ def _changes_to_numpy(table: Table, cols: Union[str, List[str]], row_set, chunk_

col_dict = {}
for i, col_def in enumerate(col_defs):
np_array = column_to_numpy_array(col_def, j_array[i])
np_array = _column_to_numpy_array(col_def, j_array[i])
col_dict[col_def.name] = np_array

yield col_dict
Expand Down

0 comments on commit 1c8c11f

Please sign in to comment.