-
Notifications
You must be signed in to change notification settings - Fork 455
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
[query] Fix quantile() argument not being passed through #2780
Changes from 6 commits
c525180
ff755dc
0897d9f
4adff54
352fc2a
952ab17
127200b
9815297
6373c85
c5b23bb
a15c2c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -90,27 +90,35 @@ func NewAggregationOperator(expr *promql.AggregateExpr) (parser.Params, error) { | |||||
Without: expr.Without, | ||||||
} | ||||||
|
||||||
op := getAggOpType(opType) | ||||||
if op == common.UnknownOpType { | ||||||
switch op := getAggOpType(opType); op { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 127200b#diff-fc8829d2c3cb3722ece0dc21d2fb4c8b2cf03230f5b641113b7413faf1660fa7L93-R94 , though |
||||||
case common.UnknownOpType: | ||||||
return nil, fmt.Errorf("operator not supported: %s", opType) | ||||||
} | ||||||
|
||||||
if op == aggregation.BottomKType || op == aggregation.TopKType { | ||||||
case aggregation.BottomKType, aggregation.TopKType: | ||||||
val, err := resolveScalarArgument(expr.Param) | ||||||
if err != nil { | ||||||
return nil, err | ||||||
} | ||||||
|
||||||
nodeInformation.Parameter = val | ||||||
return aggregation.NewTakeOp(op, nodeInformation) | ||||||
} | ||||||
|
||||||
if op == aggregation.CountValuesType { | ||||||
case aggregation.CountValuesType: | ||||||
nodeInformation.StringParameter = expr.Param.String() | ||||||
return aggregation.NewCountValuesOp(op, nodeInformation) | ||||||
} | ||||||
|
||||||
return aggregation.NewAggregationOp(op, nodeInformation) | ||||||
case aggregation.QuantileType: | ||||||
linasm marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
val, err := resolveScalarArgument(expr.Param) | ||||||
if err != nil { | ||||||
return nil, err | ||||||
} | ||||||
|
||||||
nodeInformation.Parameter = val | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May be worth adding a test for this; may be a bit complex though since it would need to generate the op, get the node, then create a mock block and run it against functions (since we can't really inspect this otherwise; maybe add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've discussed this with @linasm and reached a similar conclusion about it being not very straightforward. For now, the tests in |
||||||
return aggregation.NewAggregationOp(op, nodeInformation) | ||||||
|
||||||
default: | ||||||
return aggregation.NewAggregationOp(op, nodeInformation) | ||||||
} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit; Don't think you need the default case or the special return here if you move the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
} | ||||||
|
||||||
func getAggOpType(opType promql.ItemType) string { | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,13 +286,12 @@ load 10s | |
data{test="uneven samples",point="c"} 4 | ||
foo .8 | ||
|
||
# FAILING issue #8 (quantile) | ||
#eval instant at 1m quantile without(point)(0.8, data) | ||
# {test="two samples"} 0.8 | ||
# {test="three samples"} 1.6 | ||
# {test="uneven samples"} 2.8 | ||
eval instant at 1m quantile without(point)(0.8, data) | ||
{test="two samples"} 0.8 | ||
{test="three samples"} 1.6 | ||
{test="uneven samples"} 2.8 | ||
|
||
# Bug #5276. | ||
# FAILING issue #56. scalar() inside aggregate function arguments kills the server | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is meant by killing the server? Did this change make the failure in this case worse than it was before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that
|
||
#eval instant at 1m quantile without(point)(scalar(foo), data) | ||
# {test="two samples"} 0.8 | ||
# {test="three samples"} 1.6 | ||
|
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.
Nit: this
switch
has multi-linecase
blocks, would be a bit easier on the eyes if they were separated with empty lines.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.
0897d9f#diff-fc8829d2c3cb3722ece0dc21d2fb4c8b2cf03230f5b641113b7413faf1660fa7R96-R118