Skip to content

Commit

Permalink
feat: implement histogram_quantile in PromQL (#2651)
Browse files Browse the repository at this point in the history
* add to planner

Signed-off-by: Ruihang Xia <[email protected]>

* impl evaluate_array

Signed-off-by: Ruihang Xia <[email protected]>

* compute quantile

Signed-off-by: Ruihang Xia <[email protected]>

* fix clippy

Signed-off-by: Ruihang Xia <[email protected]>

* fix required input ordering

Signed-off-by: Ruihang Xia <[email protected]>

* add more tests

Signed-off-by: Ruihang Xia <[email protected]>

* todo to fixme

Signed-off-by: Ruihang Xia <[email protected]>

---------

Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia authored Oct 25, 2023
1 parent e8adaaf commit f08a35d
Show file tree
Hide file tree
Showing 7 changed files with 693 additions and 113 deletions.
6 changes: 5 additions & 1 deletion src/promql/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ pub enum Error {

#[snafu(display("Expect a metric matcher, but not found"))]
NoMetricMatcher { location: Location },

#[snafu(display("Invalid function argument for {}", fn_name))]
FunctionInvalidArgument { fn_name: String, location: Location },
}

impl ErrorExt for Error {
Expand All @@ -124,7 +127,8 @@ impl ErrorExt for Error {
| ExpectRangeSelector { .. }
| ZeroRangeSelector { .. }
| ColumnNotFound { .. }
| Deserialize { .. } => StatusCode::InvalidArguments,
| Deserialize { .. }
| FunctionInvalidArgument { .. } => StatusCode::InvalidArguments,

UnknownTable { .. }
| DataFusionPlanning { .. }
Expand Down
1 change: 1 addition & 0 deletions src/promql/src/extension_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ mod series_divide;

use datafusion::arrow::datatypes::{ArrowPrimitiveType, TimestampMillisecondType};
pub use empty_metric::{build_special_time_expr, EmptyMetric, EmptyMetricExec, EmptyMetricStream};
pub use histogram_fold::{HistogramFold, HistogramFoldExec, HistogramFoldStream};
pub use instant_manipulate::{InstantManipulate, InstantManipulateExec, InstantManipulateStream};
pub use normalize::{SeriesNormalize, SeriesNormalizeExec, SeriesNormalizeStream};
pub use planner::PromExtensionPlanner;
Expand Down
Loading

0 comments on commit f08a35d

Please sign in to comment.