Skip to content

Commit 59eefa2

Browse files
committed
fix(sql): use internal_err for unreachable array_has arg count check
Replace `Ok(None)` with `internal_err!` in the else branch of the array_has argument destructure, since array_has always takes exactly 2 arguments and the branch is unreachable.
1 parent 5300629 commit 59eefa2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

datafusion/sql/src/unparser/dialect.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use super::{
2424
use arrow::array::timezone::Tz;
2525
use arrow::datatypes::TimeUnit;
2626
use chrono::DateTime;
27-
use datafusion_common::Result;
27+
use datafusion_common::{internal_err, Result};
2828
use datafusion_expr::Expr;
2929
use regex::Regex;
3030
use sqlparser::tokenizer::Span;
@@ -372,7 +372,10 @@ impl PostgreSqlDialect {
372372
args: &[Expr],
373373
) -> Result<Option<ast::Expr>> {
374374
let [haystack, needle] = args else {
375-
return Ok(None);
375+
return internal_err!(
376+
"array_has expected 2 arguments, got {}",
377+
args.len()
378+
);
376379
};
377380

378381
Ok(Some(ast::Expr::AnyOp {

0 commit comments

Comments
 (0)