krishvishal commented on code in PR #16203: URL: https://github.com/apache/datafusion/pull/16203#discussion_r2124983434
########## datafusion/functions-nested/src/extract.rs: ########## @@ -213,6 +213,33 @@ fn array_element_inner(args: &[ArrayRef]) -> Result<ArrayRef> { } } +/// Adjusts a 1-based array index to 0-based, handling negative indices and bounds checking +fn adjusted_array_index<O: OffsetSizeTrait>(index: i64, len: O) -> Result<Option<O>> +where + i64: TryInto<O>, +{ + let index: O = index.try_into().map_err(|_| { + DataFusionError::Execution(format!("array_element got invalid index: {index}")) Review Comment: Done. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org