Skip to content

Commit bcf8a96

Browse files
committed
fix(spark): update return field nullability in DatePartFunc
1 parent bc1b808 commit bcf8a96

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

datafusion/functions/src/datetime/date_part.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ impl ScalarUDFImpl for DatePartFunc {
149149

150150
fn return_field_from_args(&self, args: ReturnFieldArgs) -> Result<FieldRef> {
151151
let [field, _] = take_function_args(self.name(), args.scalar_arguments)?;
152+
let nullable = args.arg_fields[1].is_nullable();
152153

153154
field
154155
.and_then(|sv| {
@@ -157,9 +158,9 @@ impl ScalarUDFImpl for DatePartFunc {
157158
.filter(|s| !s.is_empty())
158159
.map(|part| {
159160
if is_epoch(part) {
160-
Field::new(self.name(), DataType::Float64, true)
161+
Field::new(self.name(), DataType::Float64, nullable)
161162
} else {
162-
Field::new(self.name(), DataType::Int32, true)
163+
Field::new(self.name(), DataType::Int32, nullable)
163164
}
164165
})
165166
})

0 commit comments

Comments
 (0)