Skip to content

Commit

Permalink
Closes Bears-R-Us#2690 - ak.load_all glob expression update (Bears-…
Browse files Browse the repository at this point in the history
…R-Us#2692)

* Updating ak.load to support desired behavior

* Flake8 fix

* Fixing segarray read
  • Loading branch information
Ethan-DeBandi99 committed Aug 18, 2023
1 parent 859a797 commit aebb80f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions arkouda/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,8 @@ def load(
with a .parquet appended to the prefix_path.
Parquet files were previously ALWAYS stored with a ``.parquet`` extension.
This function will be deprecated when glob flags are added to read_* functions
ak.load does not support loading a single file.
For loading single HDF5 files without the _LOCALE#### suffix please use ak.read().
CSV files without the Arkouda Header are not supported.
Expand All @@ -1589,8 +1590,11 @@ def load(
#### is replaced by each locale numbers. Because filetype is inferred during processing,
the extension is not required to be a specific format.
"""
if "*" in path_prefix:
raise ValueError("Glob expressions not supported by ak.load(). "
"To read files using a glob expression, please use ak.read()")
prefix, extension = os.path.splitext(path_prefix)
globstr = f"{prefix}*{extension}"
globstr = f"{prefix}_LOCALE*{extension}"
try:
file_format = get_filetype(globstr) if file_format.lower() == "infer" else file_format
if file_format.lower() == "hdf5":
Expand Down
4 changes: 2 additions & 2 deletions arkouda/segarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,9 +1126,9 @@ def read_hdf(cls, prefix_path, dataset="segarray"):
-------
SegArray
"""
from arkouda.io import load
from arkouda.io import read_hdf

return load(prefix_path, dataset=dataset)
return read_hdf(prefix_path, datasets=dataset)

@classmethod
def load(cls, prefix_path, dataset="segarray", segment_name="segments", value_name="values"):
Expand Down

0 comments on commit aebb80f

Please sign in to comment.