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

fix [GreaterThan,LessThan,Equals] HavingSpecs #1855

Merged
merged 1 commit into from
Oct 27, 2015

Conversation

himanshug
Copy link
Contributor

return Longs.compare(l, value.longValue());
} else if (metricValueObj instanceof String) {
String metricValueStr = (String) metricValueObj;
if (!metricValueStr.contains(".")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1E10 is a valid float representation, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, fixed.

@drcrallen
Copy link
Contributor

Is there any performance degradation due to the extra checks?

@himanshug
Copy link
Contributor Author

@drcrallen haven't done any perf testing but it appears that checks are hard to avoid in this situation to fix the bug.

@himanshug himanshug added the Bug label Oct 24, 2015
@drcrallen
Copy link
Contributor

@himanshug I looked at the way groupBy queries work and I think you are correct. Since they are row-based instead of column-based the filtering methods used elsewhere don't immediately apply.

return Longs.compare(l, value.longValue());
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we throw an exception if the type is something else unknown?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would be backwards incompatible. So, I am defaulting to floats in the unknown case.

@fjy
Copy link
Contributor

fjy commented Oct 26, 2015

👍

@fjy fjy added this to the 0.9.0 milestone Oct 26, 2015
assertFalse(spec.eval(getTestRow(100.56f)));
assertFalse(spec.eval(getTestRow(90.53f)));
assertTrue(spec.eval(getTestRow(101.34f)));
assertTrue(spec.eval(getTestRow(Long.MAX_VALUE)));
}

private MapBasedInputRow makeRow(long ts, String dim, int value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be used anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

*/
class HavingSpecMetricComparator
{
private static final Pattern LONG_PAT = Pattern.compile("[-|+]?\\d+");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this package protected so you can test it explicitly?

specifically I would like to see a test for matching against 3456.3 or similar

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And other general use cases :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

drcrallen added a commit that referenced this pull request Oct 27, 2015
fix [GreaterThan,LessThan,Equals] HavingSpecs
@drcrallen drcrallen merged commit 060402a into apache:master Oct 27, 2015
@drcrallen
Copy link
Contributor

@himanshug can you cherry-pick a backport PR into the 0.8.2 branch?

@himanshug
Copy link
Contributor Author

@drcrallen done

drcrallen added a commit that referenced this pull request Oct 28, 2015
@himanshug himanshug deleted the fix_having_specs branch December 5, 2015 17:14
seoeun25 pushed a commit to seoeun25/incubator-druid that referenced this pull request Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants