Skip to content

Commit

Permalink
Add additional scalar value null construction
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Oct 23, 2022
1 parent ebcc6a0 commit d754b94
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 12 additions & 0 deletions datafusion/common/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,9 @@ impl TryFrom<&DataType> for ScalarValue {
}
DataType::Utf8 => ScalarValue::Utf8(None),
DataType::LargeUtf8 => ScalarValue::LargeUtf8(None),
DataType::Binary => ScalarValue::Binary(None),
DataType::FixedSizeBinary(len) => ScalarValue::FixedSizeBinary(*len, None),
DataType::LargeBinary => ScalarValue::LargeBinary(None),
DataType::Date32 => ScalarValue::Date32(None),
DataType::Date64 => ScalarValue::Date64(None),
DataType::Time64(TimeUnit::Nanosecond) => ScalarValue::Time64(None),
Expand All @@ -2284,6 +2287,15 @@ impl TryFrom<&DataType> for ScalarValue {
DataType::Timestamp(TimeUnit::Nanosecond, tz_opt) => {
ScalarValue::TimestampNanosecond(None, tz_opt.clone())
}
DataType::Interval(IntervalUnit::YearMonth) => {
ScalarValue::IntervalYearMonth(None)
}
DataType::Interval(IntervalUnit::DayTime) => {
ScalarValue::IntervalDayTime(None)
}
DataType::Interval(IntervalUnit::MonthDayNano) => {
ScalarValue::IntervalMonthDayNano(None)
}
DataType::Dictionary(index_type, value_type) => ScalarValue::Dictionary(
index_type.clone(),
Box::new(value_type.as_ref().try_into()?),
Expand Down
8 changes: 0 additions & 8 deletions datafusion/proto/src/from_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1246,14 +1246,6 @@ fn vec_to_array<T, const N: usize>(v: Vec<T>) -> [T; N] {
})
}

fn unwrap_timezone(proto_value: &str) -> Option<String> {
if proto_value.is_empty() {
None
} else {
Some(proto_value.to_string())
}
}

pub fn from_proto_binary_op(op: &str) -> Result<Operator, Error> {
match op {
"And" => Ok(Operator::And),
Expand Down

0 comments on commit d754b94

Please sign in to comment.