-
Notifications
You must be signed in to change notification settings - Fork 140
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
Adds support to missing data for where clause #302
Conversation
Changed the C offsenses of travis CI Fixes Travis CI error : Favor unless over if
f8d00eb
to
dad9925
Compare
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.
Tests, please?
(And, side note: I'd advise you not to rush fixing each and every issue in a single day. Better to work on something relatively large, to understand our code quality expectations and processes. We greatly appreciate your effort, though!)
Tests, as in using Travis CI or |
@athityakumar I've meant specs -- there are ton of them & you can run them locally by just |
@athityakumar I suggest you first go through the CONTRIBUTING file and understand our processes properly before submitting PRs. We're all volunteers and it saves our time if you abide by some formal processes. |
Also, submitting a PR without tests is not acceptable. Especially if you want to apply for GSOC. |
lib/daru/core/query.rb
Outdated
@@ -39,7 +39,7 @@ def inspect | |||
|
|||
class << self | |||
def apply_scalar_operator operator, data, other | |||
BoolArray.new data.map { |d| !!d.send(operator, other) } | |||
BoolArray.new data.map { |d| !!d.send(operator, other) unless d.nil? } |
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.
Missing data is not just nil
. What if the Vector
contains strings combined with a Float::NaN
? This will fail in that case.
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.
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.
@v0dro Float::NaN
I think are only used in numerical domain. I don't think they ever occur with strings or any other object except numbers.
@v0dro : Thanks for mentioning about the |
13e8865
to
54462e3
Compare
54462e3
to
b114c5b
Compare
@v0dro @zverok : The PR is ready for another review. Updates -(1) Thanks for the Any changes required? |
spec/core/query_spec.rb
Outdated
names: ['sameer', 'john', 'james', 'omisha', 'priyanka', 'shravan'] | ||
number: [1,2,3,4,5,6,nil], | ||
sym: [:one, :two, :three, :four, :five, :six, :seven], | ||
names: ['sameer', 'john', 'james', 'omisha', 'priyanka', 'shravan', Float::NAN.to_s] |
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 Float::NAN.to_s
should be considered as a missing value?
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.
That was meant to be Float::NAN
missing type as mentioned here. I will change that in the next commit, along with other changes. 😄
spec/core/query_spec.rb
Outdated
names: [Float::NAN.to_s] | ||
}, index: Daru::Index.new([6]) | ||
) | ||
expect(@df.where(@df[:sym].eq(:seven))).to eq(answer) |
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.
There is an old saying "Don't believe test you've never seen failing". It means: you should first make sure this test is failing without your patch, then apply the patch, then check test is green.
Hint: it doesn't check anything (on current daru master it will work).
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.
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.
Yep, think so.
@zverok : I've added the specific test that would have failed on the current master branch version of |
Yes, part of the specs are just old and written without much attention. We want to have them rewritten in modern style with time, yet it was not done yet. |
spec/core/query_spec.rb
Outdated
let(:dv1) { Daru::Vector.new([1,11,32,Float::NAN,nil]) } | ||
let(:dv2) { Daru::Vector.new([1,11]) } | ||
it "handles empty data" do | ||
expect(dv1.where(dv1.lt(14))).to eq(dv2) |
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 am not sure you need to create separate dv
, expect(dv1.where(dv1.lt(14))).to eq(Daru::Vector.new([1,11]))
should be enough.
a53d3f5
to
a52aabe
Compare
a52aabe
to
8aa5414
Compare
Fixes issue #246. Sample output for the building pass is shown below.
Ping @v0dro @zverok @lokeshh - Please review this PR when you're free. 😄