From cbfa90aeea15e98a3331fab0d95fcd8fa2b8789d Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Wed, 20 Dec 2023 09:35:31 -0700 Subject: [PATCH 1/2] Fix regression in regenerating protobuf source --- datafusion/proto/proto/datafusion.proto | 2 +- datafusion/proto/src/generated/pbjson.rs | 10 +++++----- datafusion/proto/src/generated/prost.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/datafusion/proto/proto/datafusion.proto b/datafusion/proto/proto/datafusion.proto index bd8053c817e7..76fe449d2fa3 100644 --- a/datafusion/proto/proto/datafusion.proto +++ b/datafusion/proto/proto/datafusion.proto @@ -409,7 +409,7 @@ message LogicalExprNode { } message Wildcard { - optional string qualifier = 1; + string qualifier = 1; } message PlaceholderNode { diff --git a/datafusion/proto/src/generated/pbjson.rs b/datafusion/proto/src/generated/pbjson.rs index 88310be0318a..0671757ad427 100644 --- a/datafusion/proto/src/generated/pbjson.rs +++ b/datafusion/proto/src/generated/pbjson.rs @@ -25797,12 +25797,12 @@ impl serde::Serialize for Wildcard { { use serde::ser::SerializeStruct; let mut len = 0; - if self.qualifier.is_some() { + if !self.qualifier.is_empty() { len += 1; } let mut struct_ser = serializer.serialize_struct("datafusion.Wildcard", len)?; - if let Some(v) = self.qualifier.as_ref() { - struct_ser.serialize_field("qualifier", v)?; + if !self.qualifier.is_empty() { + struct_ser.serialize_field("qualifier", &self.qualifier)?; } struct_ser.end() } @@ -25868,12 +25868,12 @@ impl<'de> serde::Deserialize<'de> for Wildcard { if qualifier__.is_some() { return Err(serde::de::Error::duplicate_field("qualifier")); } - qualifier__ = map_.next_value()?; + qualifier__ = Some(map_.next_value()?); } } } Ok(Wildcard { - qualifier: qualifier__, + qualifier: qualifier__.unwrap_or_default(), }) } } diff --git a/datafusion/proto/src/generated/prost.rs b/datafusion/proto/src/generated/prost.rs index 3dfd3938615f..771bd715d3c5 100644 --- a/datafusion/proto/src/generated/prost.rs +++ b/datafusion/proto/src/generated/prost.rs @@ -636,8 +636,8 @@ pub mod logical_expr_node { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Wildcard { - #[prost(string, optional, tag = "1")] - pub qualifier: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, tag = "1")] + pub qualifier: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] From 410bc50f60fde485c45a48dddc06a5fdca45acaf Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Wed, 20 Dec 2023 09:40:51 -0700 Subject: [PATCH 2/2] update serde code --- datafusion/proto/src/logical_plan/from_proto.rs | 6 +++++- datafusion/proto/src/logical_plan/to_proto.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/datafusion/proto/src/logical_plan/from_proto.rs b/datafusion/proto/src/logical_plan/from_proto.rs index 193e0947d6d9..854bfda9a861 100644 --- a/datafusion/proto/src/logical_plan/from_proto.rs +++ b/datafusion/proto/src/logical_plan/from_proto.rs @@ -1338,7 +1338,11 @@ pub fn parse_expr( in_list.negated, ))), ExprType::Wildcard(protobuf::Wildcard { qualifier }) => Ok(Expr::Wildcard { - qualifier: qualifier.clone(), + qualifier: if qualifier.is_empty() { + None + } else { + Some(qualifier.clone()) + }, }), ExprType::ScalarFunction(expr) => { let scalar_function = protobuf::ScalarFunction::try_from(expr.fun) diff --git a/datafusion/proto/src/logical_plan/to_proto.rs b/datafusion/proto/src/logical_plan/to_proto.rs index 2997d147424d..b9987ff6c727 100644 --- a/datafusion/proto/src/logical_plan/to_proto.rs +++ b/datafusion/proto/src/logical_plan/to_proto.rs @@ -1000,7 +1000,7 @@ impl TryFrom<&Expr> for protobuf::LogicalExprNode { } Expr::Wildcard { qualifier } => Self { expr_type: Some(ExprType::Wildcard(protobuf::Wildcard { - qualifier: qualifier.clone(), + qualifier: qualifier.clone().unwrap_or("".to_string()), })), }, Expr::ScalarSubquery(_)