Skip to content
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

function arguments length check not work #4885

Closed
BohuTANG opened this issue Apr 16, 2022 · 1 comment · Fixed by #4888
Closed

function arguments length check not work #4885

BohuTANG opened this issue Apr 16, 2022 · 1 comment · Fixed by #4888
Assignees
Labels
A-query Area: databend query C-bug Category: something isn't working

Comments

@BohuTANG
Copy link
Member

Summary

select if(number, 3) from numbers(10);

server panic log:

2022-04-16T08:15:08.020171Z ERROR common_tracing::panic_hook: panicked at 'index out of bounds: the len is 2 but the index is 2', common/functions/src/scalars/conditionals/if.rs:37:41 backtrace=   0: common_tracing::panic_hook::set_panic_hook::{{closure}}
             at common/tracing/src/panic_hook.rs:25:25
   1: std::panicking::rust_panic_with_hook
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:702:17
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:588:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys_common/backtrace.rs:138:18
   4: rust_begin_unwind
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:584:5
   5: core::panicking::panic_fmt
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/panicking.rs:143:14
   6: core::panicking::panic_bounds_check
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/panicking.rs:84:5
   7: common_functions::scalars::conditionals::if::IfFunction::try_create
             at common/functions/src/scalars/conditionals/if.rs:37:41
   8: core::ops::function::Fn::call
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/ops/function.rs:70:5
   9: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/alloc/src/boxed.rs:1875:9
  10: common_functions::scalars::function_adapter::FunctionAdapter::try_create
             at common/functions/src/scalars/function_adapter.rs:75:14
  11: common_functions::scalars::function_factory::FunctionFactory::get
             at common/functions/src/scalars/function_factory.rs:117:9
  12: common_planners::plan_expression_common::ExpressionDataTypeVisitor::visit_function
             at common/planners/src/plan_expression_common.rs:411:24
  13: <common_planners::plan_expression_common::ExpressionDataTypeVisitor as common_planners::plan_expression_visitor::ExpressionVisitor>::post_visit
             at common/planners/src/plan_expression_common.rs:452:56
  14: common_planners::plan_expression_visitor::ExpressionVisitor::visit
             at common/planners/src/plan_expression_visitor.rs:41:28
  15: common_planners::plan_expression::Expression::to_data_type
             at common/planners/src/plan_expression.rs:293:9
  16: common_planners::plan_expression::Expression::to_data_field
             at common/planners/src/plan_expression.rs:227:9
  17: databend_query::sql::statements::statement_select::DfQueryStatement::dry_run_exprs
             at query/src/sql/statements/statement_select.rs:324:34
  18: databend_query::sql::statements::statement_select::DfQueryStatement::verify_with_dry_run
             at query/src/sql/statements/statement_select.rs:272:19
  19: databend_query::sql::statements::statement_select::DfQueryStatement::check_and_finalize::{{closure}}
             at query/src/sql/statements/statement_select.rs:201:27
  20: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  21: <databend_query::sql::statements::statement_select::DfQueryStatement as databend_query::sql::statements::analyzer_statement::AnalyzableStatement>::analyze::{{closure}}::{{closure}}
             at query/src/sql/statements/statement_select.rs:73:67
  22: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  23: <databend_query::sql::statements::statement_select::DfQueryStatement as databend_query::sql::statements::analyzer_statement::AnalyzableStatement>::analyze::{{closure}}
             at query/src/sql/statements/statement_select.rs:61:5
  24: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  25: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/future.rs:124:9
  26: <databend_query::sql::sql_statement::DfStatement as databend_query::sql::statements::analyzer_statement::AnalyzableStatement>::analyze::{{closure}}
             at query/src/sql/statements/analyzer_statement.rs:149:52
  27: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  28: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/future.rs:124:9
  29: databend_query::sql::plan_parser::PlanParser::build_plan::{{closure}}
             at query/src/sql/plan_parser.rs:62:49
  30: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  31: databend_query::sql::plan_parser::PlanParser::parse_with_hint::{{closure}}
             at query/src/sql/plan_parser.rs:48:80
  32: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  33: databend_query::servers::mysql::mysql_interactive_worker::InteractiveWorkerBase<W>::do_query::{{closure}}::{{closure}}
             at query/src/servers/mysql/mysql_interactive_worker.rs:276:88
@BohuTANG BohuTANG added C-bug Category: something isn't working A-query Area: databend query labels Apr 16, 2022
@sundy-li
Copy link
Member

It's related to #4688 . cc @zhyass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query Area: databend query C-bug Category: something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants