Skip to content

Commit

Permalink
fixup! Migrate ToUnixtimeFunc to implement invoke_batch
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Oct 29, 2024
1 parent b3d8d15 commit 04c8611
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions datafusion/functions/src/datetime/to_unixtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
// specific language governing permissions and limitations
// under the License.

use arrow::datatypes::{DataType, TimeUnit};
use std::any::Any;
use std::sync::OnceLock;
use criterion::BatchSize;
use super::to_timestamp::ToTimestampSecondsFunc;
use crate::datetime::common::*;
use arrow::datatypes::{DataType, TimeUnit};
use criterion::BatchSize;
use datafusion_common::{exec_err, Result};
use datafusion_expr::scalar_doc_sections::DOC_SECTION_DATETIME;
use datafusion_expr::{
ColumnarValue, Documentation, ScalarUDFImpl, Signature, Volatility,
};
use std::any::Any;
use std::sync::OnceLock;

#[derive(Debug)]
pub struct ToUnixtimeFunc {
Expand Down Expand Up @@ -63,7 +63,11 @@ impl ScalarUDFImpl for ToUnixtimeFunc {
Ok(DataType::Int64)
}

fn invoke_batch(&self, args: &[ColumnarValue], batch_size: usize) -> Result<ColumnarValue> {
fn invoke_batch(
&self,
args: &[ColumnarValue],
batch_size: usize,
) -> Result<ColumnarValue> {
if args.is_empty() {
return exec_err!("to_unixtime function requires 1 or more arguments, got 0");
}
Expand Down

0 comments on commit 04c8611

Please sign in to comment.