Skip to content

Commit a77953f

Browse files
authored
chore(query): improve error of project_column_ref (#18531)
* chore(query): improve error of project_column_ref * chore(query): improve error of project_column_ref * chore(query): improve error of project_column_ref * chore(query): improve error of project_column_ref * fix recursive stackoverflow * update * update * update * update * update * update
1 parent be58d88 commit a77953f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+150
-1439
lines changed

Cargo.lock

Lines changed: 5 additions & 107 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/binaries/query/cmd.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,4 @@ impl Cmd {
6464
pub enum Commands {
6565
#[command(about = "Print version and quit")]
6666
Ver,
67-
Local {
68-
#[clap(long, short = 'q', default_value_t)]
69-
query: String,
70-
#[clap(long, default_value_t)]
71-
output_format: String,
72-
#[clap(long, short = 'c')]
73-
config: String,
74-
},
7567
}

src/binaries/query/entry.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use databend_common_version::DATABEND_GIT_SHA;
3232
use databend_common_version::DATABEND_SEMVER;
3333
use databend_query::clusters::ClusterDiscovery;
3434
use databend_query::history_tables::GlobalHistoryLog;
35-
use databend_query::local;
3635
use databend_query::servers::admin::AdminService;
3736
use databend_query::servers::flight::FlightService;
3837
use databend_query::servers::metrics::MetricService;
@@ -53,31 +52,12 @@ use super::cmd::Commands;
5352
pub struct MainError;
5453

5554
pub async fn run_cmd(cmd: &Cmd) -> Result<bool, MainError> {
56-
let make_error = || "failed to run cmd";
57-
5855
match &cmd.subcommand {
5956
None => return Ok(false),
6057
Some(Commands::Ver) => {
6158
println!("version: {}", *DATABEND_SEMVER);
6259
println!("min-compatible-metasrv-version: {}", MIN_METASRV_SEMVER);
6360
}
64-
Some(Commands::Local {
65-
query,
66-
output_format,
67-
config,
68-
}) => {
69-
let mut cmd = cmd.clone();
70-
if !config.is_empty() {
71-
cmd.config_file = config.to_string();
72-
}
73-
let conf = cmd
74-
.init_inner_config(false)
75-
.await
76-
.with_context(make_error)?;
77-
local::query_local(conf, query, output_format)
78-
.await
79-
.with_context(make_error)?
80-
}
8161
}
8262

8363
Ok(true)

src/query/expression/src/evaluator.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@ impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> {
21272127
let block = DataBlock::empty_with_rows(1);
21282128
let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry);
21292129
// Since we know the expression is constant, it'll be safe to change its column index type.
2130-
let cast_expr = cast_expr.project_column_ref(|_| unreachable!());
2130+
let cast_expr = cast_expr.project_column_ref(|_| unreachable!()).unwrap();
21312131
if let Ok(Value::Scalar(scalar)) = evaluator.run(&cast_expr) {
21322132
return (
21332133
Expr::Constant(Constant {
@@ -2260,7 +2260,7 @@ impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> {
22602260
let block = DataBlock::empty_with_rows(1);
22612261
let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry);
22622262
// Since we know the expression is constant, it'll be safe to change its column index type.
2263-
let func_expr = func_expr.project_column_ref(|_| unreachable!());
2263+
let func_expr = func_expr.project_column_ref(|_| unreachable!()).unwrap();
22642264
if let Ok(Value::Scalar(scalar)) = evaluator.run(&func_expr) {
22652265
return (
22662266
Expr::Constant(Constant {
@@ -2411,7 +2411,7 @@ impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> {
24112411
let block = DataBlock::empty_with_rows(1);
24122412
let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry);
24132413
// Since we know the expression is constant, it'll be safe to change its column index type.
2414-
let func_expr = func_expr.project_column_ref(|_| unreachable!());
2414+
let func_expr = func_expr.project_column_ref(|_| unreachable!()).unwrap();
24152415
if let Ok(Value::Scalar(scalar)) = evaluator.run(&func_expr) {
24162416
return (
24172417
Expr::Constant(Constant {
@@ -2458,7 +2458,7 @@ impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> {
24582458
let block = DataBlock::empty_with_rows(1);
24592459
let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry);
24602460
// Since we know the expression is constant, it'll be safe to change its column index type.
2461-
let func_expr = func_expr.project_column_ref(|_| unreachable!());
2461+
let func_expr = func_expr.project_column_ref(|_| unreachable!()).unwrap();
24622462
if let Ok(Value::Scalar(scalar)) = evaluator.run(&func_expr) {
24632463
return (
24642464
Expr::Constant(Constant {

0 commit comments

Comments
 (0)