Skip to content

Commit

Permalink
GH-15947: fixed skipped columns for normal import_file path.
Browse files Browse the repository at this point in the history
  • Loading branch information
wendycwong committed Apr 18, 2024
1 parent f1b5cba commit c25e378
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion h2o-py/h2o/h2o.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ def parse_setup(raw_frames, destination_frame=None, header=0, separator=None, co
if column_names is not None:
if not isinstance(column_names, list): raise ValueError("col_names should be a list")
if (skipped_columns is not None) and len(skipped_columns)>0:
if (len(column_names)-len(skipped_columns)) != parse_column_len:
if ((len(column_names)-len(skipped_columns)) != parse_column_len) and (len(column_names) != parse_column_len):
raise ValueError(
"length of col_names should be equal to the number of columns parsed: %d vs %d"
% (len(column_names), parse_column_len))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,9 @@ def H2OFrame_from_H2OFrame():


def H2OFrame_skipped_columns_is_BUGGY():
try:
h2o.H2OFrame(data, skipped_columns=[1])
assert False, "skipped_columns handling may be fixed now" # parse_setup is absolutely weird, with only half parameters passed to build the ParseSetup, and then a bunch of logic done locally, that's why it's buggy: see issue https://github.com/h2oai/h2o-3/issues/15947
except ValueError as e:
assert "length of col_names should be equal to the number of columns parsed: 4 vs 3" in str(e)
f1 = h2o.H2OFrame(data, skipped_columns=[1])
f2 = h2o.H2OFrame(data)
assert f1.ncol == (f2.ncol-1), "expected number of columns: {0}, actual column numbers: {1}".format(f1.ncol, (f2.ncol-1))


pu.run_tests([
Expand Down

0 comments on commit c25e378

Please sign in to comment.