-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Support for filter filtering of int type values #7636
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c30f948
Merge pull request #1 from apache/master
YczYanchengzhe dc4b7a8
Support for filter filtering of int type values
035ad0f
Merge branch 'master' into SupportInt
wu-sheng 74b9906
Support for filter filtering of int type values
84854e2
Merge remote-tracking branch 'upstream/master'
YczYanchengzhe 32a0197
Merge branch 'master' of github.com:YczYanchengzhe/skywalking into Su…
YczYanchengzhe 474a8c8
fix ci error
YczYanchengzhe 64635e4
fix ci error
YczYanchengzhe 60827a6
fix ci error
YczYanchengzhe 40aeb40
Merge branch 'master' into SupportInt
wu-sheng a7447af
Optimization
YczYanchengzhe e8df3f8
Merge remote-tracking branch 'origin/SupportInt' into SupportInt
YczYanchengzhe db443db
1. Number doesn't include float
YczYanchengzhe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...n/java/org/apache/skywalking/oap/server/core/analysis/metrics/expression/NumberMatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.skywalking.oap.server.core.analysis.metrics.expression; | ||
|
||
import org.apache.skywalking.oap.server.core.analysis.metrics.annotation.FilterMatcher; | ||
|
||
@FilterMatcher | ||
public class NumberMatch { | ||
|
||
public boolean match(int left, int right) { | ||
return left == right; | ||
} | ||
|
||
public boolean match(long left, long right) { | ||
return left == right; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...va/org/apache/skywalking/oap/server/core/analysis/metrics/expression/NumberMatchTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.skywalking.oap.server.core.analysis.metrics.expression; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.assertFalse; | ||
|
||
public class NumberMatchTest { | ||
|
||
@Test | ||
public void integerShouldEqual() { | ||
Integer a = 334; | ||
Integer b = 334; | ||
boolean match = new NumberMatch().match(a, b); | ||
assertTrue(match); | ||
|
||
a = -123; | ||
b = -123; | ||
match = new NumberMatch().match(a, b); | ||
assertTrue(match); | ||
|
||
a = -122; | ||
b = -123; | ||
match = new NumberMatch().match(a, b); | ||
assertFalse(match); | ||
|
||
a = -123; | ||
b = -122; | ||
match = new NumberMatch().match(a, b); | ||
assertFalse(match); | ||
} | ||
|
||
@Test | ||
public void intShouldEqual() { | ||
int a = 334; | ||
int b = 334; | ||
boolean match = new NumberMatch().match(a, b); | ||
assertTrue(match); | ||
|
||
a = -123; | ||
b = -123; | ||
match = new NumberMatch().match(a, b); | ||
assertTrue(match); | ||
|
||
a = -122; | ||
b = -123; | ||
match = new NumberMatch().match(a, b); | ||
assertFalse(match); | ||
|
||
a = -123; | ||
b = -122; | ||
match = new NumberMatch().match(a, b); | ||
assertFalse(match); | ||
} | ||
|
||
@Test | ||
public void longShouldEqual() { | ||
long a = 21474836478L; | ||
long b = 21474836478L; | ||
boolean match = new NumberMatch().match(a, b); | ||
assertTrue(match); | ||
|
||
a = -21474836478L; | ||
b = -21474836479L; | ||
match = new NumberMatch().match(a, b); | ||
assertFalse(match); | ||
|
||
Long c = -123L; | ||
Long d = -123L; | ||
match = new NumberMatch().match(c, d); | ||
assertTrue(match); | ||
|
||
c = -21474836478L; | ||
d = -21474836479L; | ||
match = new NumberMatch().match(c, d); | ||
assertFalse(match); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
From these tests, the original marcher should already support numeric types, just need to wrap primitives such as
int
to boxed typeIntegrr
or add method signatures with primitive typesThere 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 reason as #7636 (comment). And discussed at #7517
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.
Am I trying below whether adding the method signature can be directly 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.
There is a question about what the regression tests need to do every time you modify the oap part of the code
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.
What is this? A question or something?
There is no guidance or standards about this, because this is rarely to change, and has been changed for a long time.
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.
For this problem kezhenxu94 raised a better solution I m trying
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.
As kezhenxu94 said this can be solved by simply the matching rules support numbers in stringmatch I think this is a better solution and is the class name restored to EqualMatch, I think EqualMatch is more reasonable in design and functionality
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.
whether it is working or not, is not important at all. If you want to more method, consider int and long. But you would not compare number, especially double and float. Because simply in Java
1.01 == 1.01
is not guaranteed.