-
Notifications
You must be signed in to change notification settings - Fork 157
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
Convert dt.isna()
to FExpr
#3444
base: main
Are you sure you want to change the base?
Conversation
The reason this build is failing may have nothing to do with this PR [2023-03-15T18:45:15.448Z] Cancelling nested steps due to timeout
[Pipeline] // node
[Pipeline] }
[2023-03-15T18:45:15.469Z] Failed in branch Build on x86_64-macos When you push more updates, the build will be re-triggered and we will see if this was just a temp glitch on Jenkins. |
db169c2
to
cf4d08d
Compare
b339fe9
to
85909ef
Compare
src/core/expr/fexpr_fillna.cc
Outdated
out += ", reverse="; | ||
out += reverse_? "True" : "False"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this indent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section is under the else
section, hence the indent so the }
aligns under else
. I have restored it to the previous form, however, i thought that was the idea behind indent, so any reader (me inclusive) can better understand the code (which section refers to if, else, etc, readability).
the if
statement is indented, with the for
loop shifted two spaces, so I only continued the form. As always, open to feedback on why this shouldnt be so. thanks @oleksiyskononenko
src/core/expr/fexpr_fillna.cc
Outdated
for (size_t i = i1; i < i2; ++i) { | ||
is_valid = col.get_element(i, &value); | ||
fill_id = is_valid? i : fill_id; | ||
indices[i] = static_cast<int32_t>(fill_id); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here as well, aligning the }
bracket under the for
src/core/expr/fexpr_fillna.cc
Outdated
} | ||
|
||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange indent too... Is it possible to set up your editor, so that it doesn't introduce these indentation changes?
src/core/expr/funary/fexpr_isna.cc
Outdated
static Column make_isna_col(Column&& col) { | ||
switch (col.stype()) { | ||
case SType::VOID: return Const_ColumnImpl::make_bool_column(col.nrows(), true); | ||
case SType::BOOL: | ||
case SType::INT8: return Column(new Isna_ColumnImpl<int8_t>(std::move(col))); | ||
case SType::INT16: return Column(new Isna_ColumnImpl<int16_t>(std::move(col))); | ||
case SType::DATE32: | ||
case SType::INT32: return Column(new Isna_ColumnImpl<int32_t>(std::move(col))); | ||
case SType::TIME64: | ||
case SType::INT64: return Column(new Isna_ColumnImpl<int64_t>(std::move(col))); | ||
case SType::FLOAT32: return Column(new Isna_ColumnImpl<float>(std::move(col))); | ||
case SType::FLOAT64: return Column(new Isna_ColumnImpl<double>(std::move(col))); | ||
case SType::STR32: | ||
case SType::STR64: return Column(new Isna_ColumnImpl<CString>(std::move(col))); | ||
default: throw RuntimeError(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to repeat the same code here and in rowcount.cc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do I go about making it generic? is there a directory to store such generic function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have proposed Isna_ColumnImpl::make_isna_column(Column&& col)
here: #3444 (comment) Seems like a relevant place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh ... i missed it ... lemme have a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll defer to U on this one @oleksiyskononenko I don't know how to implement a static method in the isna.h file and still pass the template. How would you write it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oleksiyskononenko I made a change to isna.h ... does that suffice? open to see how it can be improved, or done in the right way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's good for the moment. I will review the PR once it is green.
@samukweku As a part of this PR, let's not deprecate |
Thanks for the changes, is this PR now ready for a review? |
@oleksiyskononenko yet it is ready for a review |
tests/math/test-isna.py
Outdated
@@ -74,8 +74,10 @@ def test_isna_joined(): | |||
dt.internal.frame_integrity_check(RES) | |||
assert RES.to_list() == [[True, True, False, True, False]] * 4 | |||
|
|||
|
|||
@pytest.mark.xfail(reason="scalar NA check not supported") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, was it ever supported? If yes, we probably need to restore it. I didn't notice we had this test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I cant see the python fallback for this though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we need to restore this functionality, who knows may be it is used by some projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems all the unary functions can take a python scalar as the argument: https://github.com/h2oai/datatable/blob/main/src/core/expr/funary/pyfn.cc#L66-L93
We need to see how to implement that with the new FExpr
s.
So I propose we keep |
Not sure how you merge
This will create only one merge commit incorporating all the changes from main. |
i'm using the code from the guide: git checkout main
git fetch upstream
git merge upstream/main
git checkout samukweku/fexpr_isna
git merge main |
I guess the guide explains how to start a new branch and not how to merge existing changes onto the existing branch. |
Co-authored-by: Oleksiy <[email protected]>
Co-authored-by: Oleksiy <[email protected]>
Co-authored-by: Oleksiy <[email protected]>
57ecf16
to
8856726
Compare
@oleksiyskononenko I have made the changes. Do let me know if there are other parts that need fixing. thanks |
dt.isna()
to FExpr
tests/math/test-isna.py
Outdated
@@ -74,8 +74,10 @@ def test_isna_joined(): | |||
dt.internal.frame_integrity_check(RES) | |||
assert RES.to_list() == [[True, True, False, True, False]] * 4 | |||
|
|||
|
|||
@pytest.mark.xfail(reason="scalar NA check not supported") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems all the unary functions can take a python scalar as the argument: https://github.com/h2oai/datatable/blob/main/src/core/expr/funary/pyfn.cc#L66-L93
We need to see how to implement that with the new FExpr
s.
Co-authored-by: Oleksiy <[email protected]>
Co-authored-by: Oleksiy <[email protected]>
@oleksiyskononenko made edits to cover for non FExprs for |
3d43cf3
to
aae69c8
Compare
@oleksiyskononenko just checking in on your feedback |
WIP for #2562