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

Make column_to_numpy_array private #5256

Merged
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
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
Loading