-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tql): add initial support for start,stop,step as sql functions (#…
…3507) * feat(tql): add initial support for start,stop,step as sql functions * fix(tql): remove unwraps, adjust fmt * fix(tql): address taplo issue * feat(tql): update parse_tql_query logic * fix(tql): change query parsing logic to use parser instead of delimiter * fix(tql): add timestamp function support, add sqlness tests * fix(tql): add lookback optional param for tql eval * fix(tql): adjust tests for now() function * fix(tql): introduce the tqlerror to differentiate failures on parsing, evaluation and simplification stages * fix(tql): add tests for explain/analyze * feat(tql): add lookback support for explain/analyze, update tests * feat(tql): add more sqlness tests * chore(tql): extract common logic for eval, analyze and explain into a single function * feat(tql): address CR points * feat(tql): use snafu for tql errors, add more docs * feat(tql): address CR points
- Loading branch information
Showing
13 changed files
with
822 additions
and
184 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2023 Greptime Team | ||
// | ||
// Licensed 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. | ||
|
||
use common_macro::stack_trace_debug; | ||
use datafusion_common::DataFusionError; | ||
use snafu::{Location, Snafu}; | ||
use sqlparser::parser::ParserError; | ||
|
||
/// TQL parser & evaluation errors. | ||
#[derive(Snafu)] | ||
#[snafu(visibility(pub))] | ||
#[stack_trace_debug] | ||
pub enum TQLError { | ||
#[snafu(display("Failed to parse TQL expression"))] | ||
Parser { | ||
#[snafu(source)] | ||
error: ParserError, | ||
location: Location, | ||
}, | ||
|
||
#[snafu(display("Failed to convert to logical TQL expression"))] | ||
ConvertToLogicalExpression { | ||
#[snafu(source)] | ||
error: DataFusionError, | ||
location: Location, | ||
}, | ||
|
||
#[snafu(display("Failed to simplify TQL expression"))] | ||
Simplification { | ||
#[snafu(source)] | ||
error: DataFusionError, | ||
location: Location, | ||
}, | ||
|
||
#[snafu(display("Failed to evaluate TQL expression: {}", msg))] | ||
Evaluation { msg: String }, | ||
} |
Oops, something went wrong.