ozankabak commented on code in PR #5322: URL: https://github.com/apache/arrow-datafusion/pull/5322#discussion_r1120426868
########## datafusion/common/src/scalar.rs: ########## @@ -1019,6 +1019,29 @@ impl ScalarValue { Self::List(scalars, Box::new(Field::new("item", child_type, true))) } + // Create a zero value in the given type. + pub fn new_zero(datatype: &DataType) -> Result<ScalarValue> { + assert!(datatype.is_primitive()); + Ok(match datatype { + DataType::Boolean => ScalarValue::Boolean(Some(false)), + DataType::Int8 => ScalarValue::Int8(Some(0)), + DataType::Int16 => ScalarValue::Int16(Some(0)), + DataType::Int32 => ScalarValue::Int32(Some(0)), + DataType::Int64 => ScalarValue::Int64(Some(0)), + DataType::UInt8 => ScalarValue::UInt8(Some(0)), + DataType::UInt16 => ScalarValue::UInt16(Some(0)), + DataType::UInt32 => ScalarValue::UInt32(Some(0)), + DataType::UInt64 => ScalarValue::UInt64(Some(0)), + DataType::Float32 => ScalarValue::UInt64(Some(0)), Review Comment: Right, that's a typo -- just sent a commit to fix it as well as the new merge conflicts. -- 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...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org