risingwave_pb/
catalog.serde.rs

1use crate::catalog::*;
2impl serde::Serialize for ColIndexMapping {
3    #[allow(deprecated)]
4    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5    where
6        S: serde::Serializer,
7    {
8        use serde::ser::SerializeStruct;
9        let mut len = 0;
10        if self.target_size != 0 {
11            len += 1;
12        }
13        if !self.map.is_empty() {
14            len += 1;
15        }
16        let mut struct_ser = serializer.serialize_struct("catalog.ColIndexMapping", len)?;
17        if self.target_size != 0 {
18            #[allow(clippy::needless_borrow)]
19            #[allow(clippy::needless_borrows_for_generic_args)]
20            struct_ser.serialize_field("targetSize", ToString::to_string(&self.target_size).as_str())?;
21        }
22        if !self.map.is_empty() {
23            struct_ser.serialize_field("map", &self.map.iter().map(ToString::to_string).collect::<Vec<_>>())?;
24        }
25        struct_ser.end()
26    }
27}
28impl<'de> serde::Deserialize<'de> for ColIndexMapping {
29    #[allow(deprecated)]
30    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
31    where
32        D: serde::Deserializer<'de>,
33    {
34        const FIELDS: &[&str] = &[
35            "target_size",
36            "targetSize",
37            "map",
38        ];
39
40        #[allow(clippy::enum_variant_names)]
41        enum GeneratedField {
42            TargetSize,
43            Map,
44        }
45        impl<'de> serde::Deserialize<'de> for GeneratedField {
46            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
47            where
48                D: serde::Deserializer<'de>,
49            {
50                struct GeneratedVisitor;
51
52                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
53                    type Value = GeneratedField;
54
55                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
56                        write!(formatter, "expected one of: {:?}", &FIELDS)
57                    }
58
59                    #[allow(unused_variables)]
60                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
61                    where
62                        E: serde::de::Error,
63                    {
64                        match value {
65                            "targetSize" | "target_size" => Ok(GeneratedField::TargetSize),
66                            "map" => Ok(GeneratedField::Map),
67                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
68                        }
69                    }
70                }
71                deserializer.deserialize_identifier(GeneratedVisitor)
72            }
73        }
74        struct GeneratedVisitor;
75        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
76            type Value = ColIndexMapping;
77
78            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
79                formatter.write_str("struct catalog.ColIndexMapping")
80            }
81
82            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ColIndexMapping, V::Error>
83                where
84                    V: serde::de::MapAccess<'de>,
85            {
86                let mut target_size__ = None;
87                let mut map__ = None;
88                while let Some(k) = map_.next_key()? {
89                    match k {
90                        GeneratedField::TargetSize => {
91                            if target_size__.is_some() {
92                                return Err(serde::de::Error::duplicate_field("targetSize"));
93                            }
94                            target_size__ = 
95                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
96                            ;
97                        }
98                        GeneratedField::Map => {
99                            if map__.is_some() {
100                                return Err(serde::de::Error::duplicate_field("map"));
101                            }
102                            map__ = 
103                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
104                                    .into_iter().map(|x| x.0).collect())
105                            ;
106                        }
107                    }
108                }
109                Ok(ColIndexMapping {
110                    target_size: target_size__.unwrap_or_default(),
111                    map: map__.unwrap_or_default(),
112                })
113            }
114        }
115        deserializer.deserialize_struct("catalog.ColIndexMapping", FIELDS, GeneratedVisitor)
116    }
117}
118impl serde::Serialize for Comment {
119    #[allow(deprecated)]
120    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
121    where
122        S: serde::Serializer,
123    {
124        use serde::ser::SerializeStruct;
125        let mut len = 0;
126        if self.table_id != 0 {
127            len += 1;
128        }
129        if self.schema_id != 0 {
130            len += 1;
131        }
132        if self.database_id != 0 {
133            len += 1;
134        }
135        if self.column_index.is_some() {
136            len += 1;
137        }
138        if self.description.is_some() {
139            len += 1;
140        }
141        let mut struct_ser = serializer.serialize_struct("catalog.Comment", len)?;
142        if self.table_id != 0 {
143            struct_ser.serialize_field("tableId", &self.table_id)?;
144        }
145        if self.schema_id != 0 {
146            struct_ser.serialize_field("schemaId", &self.schema_id)?;
147        }
148        if self.database_id != 0 {
149            struct_ser.serialize_field("databaseId", &self.database_id)?;
150        }
151        if let Some(v) = self.column_index.as_ref() {
152            struct_ser.serialize_field("columnIndex", v)?;
153        }
154        if let Some(v) = self.description.as_ref() {
155            struct_ser.serialize_field("description", v)?;
156        }
157        struct_ser.end()
158    }
159}
160impl<'de> serde::Deserialize<'de> for Comment {
161    #[allow(deprecated)]
162    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
163    where
164        D: serde::Deserializer<'de>,
165    {
166        const FIELDS: &[&str] = &[
167            "table_id",
168            "tableId",
169            "schema_id",
170            "schemaId",
171            "database_id",
172            "databaseId",
173            "column_index",
174            "columnIndex",
175            "description",
176        ];
177
178        #[allow(clippy::enum_variant_names)]
179        enum GeneratedField {
180            TableId,
181            SchemaId,
182            DatabaseId,
183            ColumnIndex,
184            Description,
185        }
186        impl<'de> serde::Deserialize<'de> for GeneratedField {
187            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
188            where
189                D: serde::Deserializer<'de>,
190            {
191                struct GeneratedVisitor;
192
193                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
194                    type Value = GeneratedField;
195
196                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
197                        write!(formatter, "expected one of: {:?}", &FIELDS)
198                    }
199
200                    #[allow(unused_variables)]
201                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
202                    where
203                        E: serde::de::Error,
204                    {
205                        match value {
206                            "tableId" | "table_id" => Ok(GeneratedField::TableId),
207                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
208                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
209                            "columnIndex" | "column_index" => Ok(GeneratedField::ColumnIndex),
210                            "description" => Ok(GeneratedField::Description),
211                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
212                        }
213                    }
214                }
215                deserializer.deserialize_identifier(GeneratedVisitor)
216            }
217        }
218        struct GeneratedVisitor;
219        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
220            type Value = Comment;
221
222            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
223                formatter.write_str("struct catalog.Comment")
224            }
225
226            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Comment, V::Error>
227                where
228                    V: serde::de::MapAccess<'de>,
229            {
230                let mut table_id__ = None;
231                let mut schema_id__ = None;
232                let mut database_id__ = None;
233                let mut column_index__ = None;
234                let mut description__ = None;
235                while let Some(k) = map_.next_key()? {
236                    match k {
237                        GeneratedField::TableId => {
238                            if table_id__.is_some() {
239                                return Err(serde::de::Error::duplicate_field("tableId"));
240                            }
241                            table_id__ = 
242                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
243                            ;
244                        }
245                        GeneratedField::SchemaId => {
246                            if schema_id__.is_some() {
247                                return Err(serde::de::Error::duplicate_field("schemaId"));
248                            }
249                            schema_id__ = 
250                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
251                            ;
252                        }
253                        GeneratedField::DatabaseId => {
254                            if database_id__.is_some() {
255                                return Err(serde::de::Error::duplicate_field("databaseId"));
256                            }
257                            database_id__ = 
258                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
259                            ;
260                        }
261                        GeneratedField::ColumnIndex => {
262                            if column_index__.is_some() {
263                                return Err(serde::de::Error::duplicate_field("columnIndex"));
264                            }
265                            column_index__ = 
266                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
267                            ;
268                        }
269                        GeneratedField::Description => {
270                            if description__.is_some() {
271                                return Err(serde::de::Error::duplicate_field("description"));
272                            }
273                            description__ = map_.next_value()?;
274                        }
275                    }
276                }
277                Ok(Comment {
278                    table_id: table_id__.unwrap_or_default(),
279                    schema_id: schema_id__.unwrap_or_default(),
280                    database_id: database_id__.unwrap_or_default(),
281                    column_index: column_index__,
282                    description: description__,
283                })
284            }
285        }
286        deserializer.deserialize_struct("catalog.Comment", FIELDS, GeneratedVisitor)
287    }
288}
289impl serde::Serialize for Connection {
290    #[allow(deprecated)]
291    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
292    where
293        S: serde::Serializer,
294    {
295        use serde::ser::SerializeStruct;
296        let mut len = 0;
297        if self.id != 0 {
298            len += 1;
299        }
300        if self.schema_id != 0 {
301            len += 1;
302        }
303        if self.database_id != 0 {
304            len += 1;
305        }
306        if !self.name.is_empty() {
307            len += 1;
308        }
309        if self.owner != 0 {
310            len += 1;
311        }
312        if self.info.is_some() {
313            len += 1;
314        }
315        let mut struct_ser = serializer.serialize_struct("catalog.Connection", len)?;
316        if self.id != 0 {
317            struct_ser.serialize_field("id", &self.id)?;
318        }
319        if self.schema_id != 0 {
320            struct_ser.serialize_field("schemaId", &self.schema_id)?;
321        }
322        if self.database_id != 0 {
323            struct_ser.serialize_field("databaseId", &self.database_id)?;
324        }
325        if !self.name.is_empty() {
326            struct_ser.serialize_field("name", &self.name)?;
327        }
328        if self.owner != 0 {
329            struct_ser.serialize_field("owner", &self.owner)?;
330        }
331        if let Some(v) = self.info.as_ref() {
332            match v {
333                connection::Info::PrivateLinkService(v) => {
334                    struct_ser.serialize_field("privateLinkService", v)?;
335                }
336                connection::Info::ConnectionParams(v) => {
337                    struct_ser.serialize_field("connectionParams", v)?;
338                }
339            }
340        }
341        struct_ser.end()
342    }
343}
344impl<'de> serde::Deserialize<'de> for Connection {
345    #[allow(deprecated)]
346    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
347    where
348        D: serde::Deserializer<'de>,
349    {
350        const FIELDS: &[&str] = &[
351            "id",
352            "schema_id",
353            "schemaId",
354            "database_id",
355            "databaseId",
356            "name",
357            "owner",
358            "private_link_service",
359            "privateLinkService",
360            "connection_params",
361            "connectionParams",
362        ];
363
364        #[allow(clippy::enum_variant_names)]
365        enum GeneratedField {
366            Id,
367            SchemaId,
368            DatabaseId,
369            Name,
370            Owner,
371            PrivateLinkService,
372            ConnectionParams,
373        }
374        impl<'de> serde::Deserialize<'de> for GeneratedField {
375            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
376            where
377                D: serde::Deserializer<'de>,
378            {
379                struct GeneratedVisitor;
380
381                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
382                    type Value = GeneratedField;
383
384                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
385                        write!(formatter, "expected one of: {:?}", &FIELDS)
386                    }
387
388                    #[allow(unused_variables)]
389                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
390                    where
391                        E: serde::de::Error,
392                    {
393                        match value {
394                            "id" => Ok(GeneratedField::Id),
395                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
396                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
397                            "name" => Ok(GeneratedField::Name),
398                            "owner" => Ok(GeneratedField::Owner),
399                            "privateLinkService" | "private_link_service" => Ok(GeneratedField::PrivateLinkService),
400                            "connectionParams" | "connection_params" => Ok(GeneratedField::ConnectionParams),
401                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
402                        }
403                    }
404                }
405                deserializer.deserialize_identifier(GeneratedVisitor)
406            }
407        }
408        struct GeneratedVisitor;
409        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
410            type Value = Connection;
411
412            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
413                formatter.write_str("struct catalog.Connection")
414            }
415
416            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Connection, V::Error>
417                where
418                    V: serde::de::MapAccess<'de>,
419            {
420                let mut id__ = None;
421                let mut schema_id__ = None;
422                let mut database_id__ = None;
423                let mut name__ = None;
424                let mut owner__ = None;
425                let mut info__ = None;
426                while let Some(k) = map_.next_key()? {
427                    match k {
428                        GeneratedField::Id => {
429                            if id__.is_some() {
430                                return Err(serde::de::Error::duplicate_field("id"));
431                            }
432                            id__ = 
433                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
434                            ;
435                        }
436                        GeneratedField::SchemaId => {
437                            if schema_id__.is_some() {
438                                return Err(serde::de::Error::duplicate_field("schemaId"));
439                            }
440                            schema_id__ = 
441                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
442                            ;
443                        }
444                        GeneratedField::DatabaseId => {
445                            if database_id__.is_some() {
446                                return Err(serde::de::Error::duplicate_field("databaseId"));
447                            }
448                            database_id__ = 
449                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
450                            ;
451                        }
452                        GeneratedField::Name => {
453                            if name__.is_some() {
454                                return Err(serde::de::Error::duplicate_field("name"));
455                            }
456                            name__ = Some(map_.next_value()?);
457                        }
458                        GeneratedField::Owner => {
459                            if owner__.is_some() {
460                                return Err(serde::de::Error::duplicate_field("owner"));
461                            }
462                            owner__ = 
463                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
464                            ;
465                        }
466                        GeneratedField::PrivateLinkService => {
467                            if info__.is_some() {
468                                return Err(serde::de::Error::duplicate_field("privateLinkService"));
469                            }
470                            info__ = map_.next_value::<::std::option::Option<_>>()?.map(connection::Info::PrivateLinkService)
471;
472                        }
473                        GeneratedField::ConnectionParams => {
474                            if info__.is_some() {
475                                return Err(serde::de::Error::duplicate_field("connectionParams"));
476                            }
477                            info__ = map_.next_value::<::std::option::Option<_>>()?.map(connection::Info::ConnectionParams)
478;
479                        }
480                    }
481                }
482                Ok(Connection {
483                    id: id__.unwrap_or_default(),
484                    schema_id: schema_id__.unwrap_or_default(),
485                    database_id: database_id__.unwrap_or_default(),
486                    name: name__.unwrap_or_default(),
487                    owner: owner__.unwrap_or_default(),
488                    info: info__,
489                })
490            }
491        }
492        deserializer.deserialize_struct("catalog.Connection", FIELDS, GeneratedVisitor)
493    }
494}
495impl serde::Serialize for connection::PrivateLinkService {
496    #[allow(deprecated)]
497    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
498    where
499        S: serde::Serializer,
500    {
501        use serde::ser::SerializeStruct;
502        let mut len = 0;
503        if self.provider != 0 {
504            len += 1;
505        }
506        if !self.service_name.is_empty() {
507            len += 1;
508        }
509        if !self.endpoint_id.is_empty() {
510            len += 1;
511        }
512        if !self.dns_entries.is_empty() {
513            len += 1;
514        }
515        if !self.endpoint_dns_name.is_empty() {
516            len += 1;
517        }
518        let mut struct_ser = serializer.serialize_struct("catalog.Connection.PrivateLinkService", len)?;
519        if self.provider != 0 {
520            let v = connection::private_link_service::PrivateLinkProvider::try_from(self.provider)
521                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.provider)))?;
522            struct_ser.serialize_field("provider", &v)?;
523        }
524        if !self.service_name.is_empty() {
525            struct_ser.serialize_field("serviceName", &self.service_name)?;
526        }
527        if !self.endpoint_id.is_empty() {
528            struct_ser.serialize_field("endpointId", &self.endpoint_id)?;
529        }
530        if !self.dns_entries.is_empty() {
531            struct_ser.serialize_field("dnsEntries", &self.dns_entries)?;
532        }
533        if !self.endpoint_dns_name.is_empty() {
534            struct_ser.serialize_field("endpointDnsName", &self.endpoint_dns_name)?;
535        }
536        struct_ser.end()
537    }
538}
539impl<'de> serde::Deserialize<'de> for connection::PrivateLinkService {
540    #[allow(deprecated)]
541    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
542    where
543        D: serde::Deserializer<'de>,
544    {
545        const FIELDS: &[&str] = &[
546            "provider",
547            "service_name",
548            "serviceName",
549            "endpoint_id",
550            "endpointId",
551            "dns_entries",
552            "dnsEntries",
553            "endpoint_dns_name",
554            "endpointDnsName",
555        ];
556
557        #[allow(clippy::enum_variant_names)]
558        enum GeneratedField {
559            Provider,
560            ServiceName,
561            EndpointId,
562            DnsEntries,
563            EndpointDnsName,
564        }
565        impl<'de> serde::Deserialize<'de> for GeneratedField {
566            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
567            where
568                D: serde::Deserializer<'de>,
569            {
570                struct GeneratedVisitor;
571
572                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
573                    type Value = GeneratedField;
574
575                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
576                        write!(formatter, "expected one of: {:?}", &FIELDS)
577                    }
578
579                    #[allow(unused_variables)]
580                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
581                    where
582                        E: serde::de::Error,
583                    {
584                        match value {
585                            "provider" => Ok(GeneratedField::Provider),
586                            "serviceName" | "service_name" => Ok(GeneratedField::ServiceName),
587                            "endpointId" | "endpoint_id" => Ok(GeneratedField::EndpointId),
588                            "dnsEntries" | "dns_entries" => Ok(GeneratedField::DnsEntries),
589                            "endpointDnsName" | "endpoint_dns_name" => Ok(GeneratedField::EndpointDnsName),
590                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
591                        }
592                    }
593                }
594                deserializer.deserialize_identifier(GeneratedVisitor)
595            }
596        }
597        struct GeneratedVisitor;
598        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
599            type Value = connection::PrivateLinkService;
600
601            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
602                formatter.write_str("struct catalog.Connection.PrivateLinkService")
603            }
604
605            fn visit_map<V>(self, mut map_: V) -> std::result::Result<connection::PrivateLinkService, V::Error>
606                where
607                    V: serde::de::MapAccess<'de>,
608            {
609                let mut provider__ = None;
610                let mut service_name__ = None;
611                let mut endpoint_id__ = None;
612                let mut dns_entries__ = None;
613                let mut endpoint_dns_name__ = None;
614                while let Some(k) = map_.next_key()? {
615                    match k {
616                        GeneratedField::Provider => {
617                            if provider__.is_some() {
618                                return Err(serde::de::Error::duplicate_field("provider"));
619                            }
620                            provider__ = Some(map_.next_value::<connection::private_link_service::PrivateLinkProvider>()? as i32);
621                        }
622                        GeneratedField::ServiceName => {
623                            if service_name__.is_some() {
624                                return Err(serde::de::Error::duplicate_field("serviceName"));
625                            }
626                            service_name__ = Some(map_.next_value()?);
627                        }
628                        GeneratedField::EndpointId => {
629                            if endpoint_id__.is_some() {
630                                return Err(serde::de::Error::duplicate_field("endpointId"));
631                            }
632                            endpoint_id__ = Some(map_.next_value()?);
633                        }
634                        GeneratedField::DnsEntries => {
635                            if dns_entries__.is_some() {
636                                return Err(serde::de::Error::duplicate_field("dnsEntries"));
637                            }
638                            dns_entries__ = Some(
639                                map_.next_value::<std::collections::HashMap<_, _>>()?
640                            );
641                        }
642                        GeneratedField::EndpointDnsName => {
643                            if endpoint_dns_name__.is_some() {
644                                return Err(serde::de::Error::duplicate_field("endpointDnsName"));
645                            }
646                            endpoint_dns_name__ = Some(map_.next_value()?);
647                        }
648                    }
649                }
650                Ok(connection::PrivateLinkService {
651                    provider: provider__.unwrap_or_default(),
652                    service_name: service_name__.unwrap_or_default(),
653                    endpoint_id: endpoint_id__.unwrap_or_default(),
654                    dns_entries: dns_entries__.unwrap_or_default(),
655                    endpoint_dns_name: endpoint_dns_name__.unwrap_or_default(),
656                })
657            }
658        }
659        deserializer.deserialize_struct("catalog.Connection.PrivateLinkService", FIELDS, GeneratedVisitor)
660    }
661}
662impl serde::Serialize for connection::private_link_service::PrivateLinkProvider {
663    #[allow(deprecated)]
664    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
665    where
666        S: serde::Serializer,
667    {
668        let variant = match self {
669            Self::Unspecified => "UNSPECIFIED",
670            Self::Mock => "MOCK",
671            Self::Aws => "AWS",
672        };
673        serializer.serialize_str(variant)
674    }
675}
676impl<'de> serde::Deserialize<'de> for connection::private_link_service::PrivateLinkProvider {
677    #[allow(deprecated)]
678    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
679    where
680        D: serde::Deserializer<'de>,
681    {
682        const FIELDS: &[&str] = &[
683            "UNSPECIFIED",
684            "MOCK",
685            "AWS",
686        ];
687
688        struct GeneratedVisitor;
689
690        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
691            type Value = connection::private_link_service::PrivateLinkProvider;
692
693            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
694                write!(formatter, "expected one of: {:?}", &FIELDS)
695            }
696
697            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
698            where
699                E: serde::de::Error,
700            {
701                i32::try_from(v)
702                    .ok()
703                    .and_then(|x| x.try_into().ok())
704                    .ok_or_else(|| {
705                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
706                    })
707            }
708
709            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
710            where
711                E: serde::de::Error,
712            {
713                i32::try_from(v)
714                    .ok()
715                    .and_then(|x| x.try_into().ok())
716                    .ok_or_else(|| {
717                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
718                    })
719            }
720
721            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
722            where
723                E: serde::de::Error,
724            {
725                match value {
726                    "UNSPECIFIED" => Ok(connection::private_link_service::PrivateLinkProvider::Unspecified),
727                    "MOCK" => Ok(connection::private_link_service::PrivateLinkProvider::Mock),
728                    "AWS" => Ok(connection::private_link_service::PrivateLinkProvider::Aws),
729                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
730                }
731            }
732        }
733        deserializer.deserialize_any(GeneratedVisitor)
734    }
735}
736impl serde::Serialize for ConnectionParams {
737    #[allow(deprecated)]
738    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
739    where
740        S: serde::Serializer,
741    {
742        use serde::ser::SerializeStruct;
743        let mut len = 0;
744        if self.connection_type != 0 {
745            len += 1;
746        }
747        if !self.properties.is_empty() {
748            len += 1;
749        }
750        if !self.secret_refs.is_empty() {
751            len += 1;
752        }
753        let mut struct_ser = serializer.serialize_struct("catalog.ConnectionParams", len)?;
754        if self.connection_type != 0 {
755            let v = connection_params::ConnectionType::try_from(self.connection_type)
756                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.connection_type)))?;
757            struct_ser.serialize_field("connectionType", &v)?;
758        }
759        if !self.properties.is_empty() {
760            struct_ser.serialize_field("properties", &self.properties)?;
761        }
762        if !self.secret_refs.is_empty() {
763            struct_ser.serialize_field("secretRefs", &self.secret_refs)?;
764        }
765        struct_ser.end()
766    }
767}
768impl<'de> serde::Deserialize<'de> for ConnectionParams {
769    #[allow(deprecated)]
770    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
771    where
772        D: serde::Deserializer<'de>,
773    {
774        const FIELDS: &[&str] = &[
775            "connection_type",
776            "connectionType",
777            "properties",
778            "secret_refs",
779            "secretRefs",
780        ];
781
782        #[allow(clippy::enum_variant_names)]
783        enum GeneratedField {
784            ConnectionType,
785            Properties,
786            SecretRefs,
787        }
788        impl<'de> serde::Deserialize<'de> for GeneratedField {
789            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
790            where
791                D: serde::Deserializer<'de>,
792            {
793                struct GeneratedVisitor;
794
795                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
796                    type Value = GeneratedField;
797
798                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
799                        write!(formatter, "expected one of: {:?}", &FIELDS)
800                    }
801
802                    #[allow(unused_variables)]
803                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
804                    where
805                        E: serde::de::Error,
806                    {
807                        match value {
808                            "connectionType" | "connection_type" => Ok(GeneratedField::ConnectionType),
809                            "properties" => Ok(GeneratedField::Properties),
810                            "secretRefs" | "secret_refs" => Ok(GeneratedField::SecretRefs),
811                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
812                        }
813                    }
814                }
815                deserializer.deserialize_identifier(GeneratedVisitor)
816            }
817        }
818        struct GeneratedVisitor;
819        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
820            type Value = ConnectionParams;
821
822            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
823                formatter.write_str("struct catalog.ConnectionParams")
824            }
825
826            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ConnectionParams, V::Error>
827                where
828                    V: serde::de::MapAccess<'de>,
829            {
830                let mut connection_type__ = None;
831                let mut properties__ = None;
832                let mut secret_refs__ = None;
833                while let Some(k) = map_.next_key()? {
834                    match k {
835                        GeneratedField::ConnectionType => {
836                            if connection_type__.is_some() {
837                                return Err(serde::de::Error::duplicate_field("connectionType"));
838                            }
839                            connection_type__ = Some(map_.next_value::<connection_params::ConnectionType>()? as i32);
840                        }
841                        GeneratedField::Properties => {
842                            if properties__.is_some() {
843                                return Err(serde::de::Error::duplicate_field("properties"));
844                            }
845                            properties__ = Some(
846                                map_.next_value::<std::collections::HashMap<_, _>>()?
847                            );
848                        }
849                        GeneratedField::SecretRefs => {
850                            if secret_refs__.is_some() {
851                                return Err(serde::de::Error::duplicate_field("secretRefs"));
852                            }
853                            secret_refs__ = Some(
854                                map_.next_value::<std::collections::HashMap<_, _>>()?
855                            );
856                        }
857                    }
858                }
859                Ok(ConnectionParams {
860                    connection_type: connection_type__.unwrap_or_default(),
861                    properties: properties__.unwrap_or_default(),
862                    secret_refs: secret_refs__.unwrap_or_default(),
863                })
864            }
865        }
866        deserializer.deserialize_struct("catalog.ConnectionParams", FIELDS, GeneratedVisitor)
867    }
868}
869impl serde::Serialize for connection_params::ConnectionType {
870    #[allow(deprecated)]
871    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
872    where
873        S: serde::Serializer,
874    {
875        let variant = match self {
876            Self::Unspecified => "CONNECTION_TYPE_UNSPECIFIED",
877            Self::Kafka => "CONNECTION_TYPE_KAFKA",
878            Self::Iceberg => "CONNECTION_TYPE_ICEBERG",
879            Self::SchemaRegistry => "CONNECTION_TYPE_SCHEMA_REGISTRY",
880            Self::Elasticsearch => "CONNECTION_TYPE_ELASTICSEARCH",
881        };
882        serializer.serialize_str(variant)
883    }
884}
885impl<'de> serde::Deserialize<'de> for connection_params::ConnectionType {
886    #[allow(deprecated)]
887    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
888    where
889        D: serde::Deserializer<'de>,
890    {
891        const FIELDS: &[&str] = &[
892            "CONNECTION_TYPE_UNSPECIFIED",
893            "CONNECTION_TYPE_KAFKA",
894            "CONNECTION_TYPE_ICEBERG",
895            "CONNECTION_TYPE_SCHEMA_REGISTRY",
896            "CONNECTION_TYPE_ELASTICSEARCH",
897        ];
898
899        struct GeneratedVisitor;
900
901        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
902            type Value = connection_params::ConnectionType;
903
904            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
905                write!(formatter, "expected one of: {:?}", &FIELDS)
906            }
907
908            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
909            where
910                E: serde::de::Error,
911            {
912                i32::try_from(v)
913                    .ok()
914                    .and_then(|x| x.try_into().ok())
915                    .ok_or_else(|| {
916                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
917                    })
918            }
919
920            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
921            where
922                E: serde::de::Error,
923            {
924                i32::try_from(v)
925                    .ok()
926                    .and_then(|x| x.try_into().ok())
927                    .ok_or_else(|| {
928                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
929                    })
930            }
931
932            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
933            where
934                E: serde::de::Error,
935            {
936                match value {
937                    "CONNECTION_TYPE_UNSPECIFIED" => Ok(connection_params::ConnectionType::Unspecified),
938                    "CONNECTION_TYPE_KAFKA" => Ok(connection_params::ConnectionType::Kafka),
939                    "CONNECTION_TYPE_ICEBERG" => Ok(connection_params::ConnectionType::Iceberg),
940                    "CONNECTION_TYPE_SCHEMA_REGISTRY" => Ok(connection_params::ConnectionType::SchemaRegistry),
941                    "CONNECTION_TYPE_ELASTICSEARCH" => Ok(connection_params::ConnectionType::Elasticsearch),
942                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
943                }
944            }
945        }
946        deserializer.deserialize_any(GeneratedVisitor)
947    }
948}
949impl serde::Serialize for CreateType {
950    #[allow(deprecated)]
951    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
952    where
953        S: serde::Serializer,
954    {
955        let variant = match self {
956            Self::Unspecified => "CREATE_TYPE_UNSPECIFIED",
957            Self::Background => "CREATE_TYPE_BACKGROUND",
958            Self::Foreground => "CREATE_TYPE_FOREGROUND",
959        };
960        serializer.serialize_str(variant)
961    }
962}
963impl<'de> serde::Deserialize<'de> for CreateType {
964    #[allow(deprecated)]
965    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
966    where
967        D: serde::Deserializer<'de>,
968    {
969        const FIELDS: &[&str] = &[
970            "CREATE_TYPE_UNSPECIFIED",
971            "CREATE_TYPE_BACKGROUND",
972            "CREATE_TYPE_FOREGROUND",
973        ];
974
975        struct GeneratedVisitor;
976
977        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
978            type Value = CreateType;
979
980            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
981                write!(formatter, "expected one of: {:?}", &FIELDS)
982            }
983
984            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
985            where
986                E: serde::de::Error,
987            {
988                i32::try_from(v)
989                    .ok()
990                    .and_then(|x| x.try_into().ok())
991                    .ok_or_else(|| {
992                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
993                    })
994            }
995
996            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
997            where
998                E: serde::de::Error,
999            {
1000                i32::try_from(v)
1001                    .ok()
1002                    .and_then(|x| x.try_into().ok())
1003                    .ok_or_else(|| {
1004                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
1005                    })
1006            }
1007
1008            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1009            where
1010                E: serde::de::Error,
1011            {
1012                match value {
1013                    "CREATE_TYPE_UNSPECIFIED" => Ok(CreateType::Unspecified),
1014                    "CREATE_TYPE_BACKGROUND" => Ok(CreateType::Background),
1015                    "CREATE_TYPE_FOREGROUND" => Ok(CreateType::Foreground),
1016                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
1017                }
1018            }
1019        }
1020        deserializer.deserialize_any(GeneratedVisitor)
1021    }
1022}
1023impl serde::Serialize for Database {
1024    #[allow(deprecated)]
1025    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1026    where
1027        S: serde::Serializer,
1028    {
1029        use serde::ser::SerializeStruct;
1030        let mut len = 0;
1031        if self.id != 0 {
1032            len += 1;
1033        }
1034        if !self.name.is_empty() {
1035            len += 1;
1036        }
1037        if self.owner != 0 {
1038            len += 1;
1039        }
1040        if !self.resource_group.is_empty() {
1041            len += 1;
1042        }
1043        let mut struct_ser = serializer.serialize_struct("catalog.Database", len)?;
1044        if self.id != 0 {
1045            struct_ser.serialize_field("id", &self.id)?;
1046        }
1047        if !self.name.is_empty() {
1048            struct_ser.serialize_field("name", &self.name)?;
1049        }
1050        if self.owner != 0 {
1051            struct_ser.serialize_field("owner", &self.owner)?;
1052        }
1053        if !self.resource_group.is_empty() {
1054            struct_ser.serialize_field("resourceGroup", &self.resource_group)?;
1055        }
1056        struct_ser.end()
1057    }
1058}
1059impl<'de> serde::Deserialize<'de> for Database {
1060    #[allow(deprecated)]
1061    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1062    where
1063        D: serde::Deserializer<'de>,
1064    {
1065        const FIELDS: &[&str] = &[
1066            "id",
1067            "name",
1068            "owner",
1069            "resource_group",
1070            "resourceGroup",
1071        ];
1072
1073        #[allow(clippy::enum_variant_names)]
1074        enum GeneratedField {
1075            Id,
1076            Name,
1077            Owner,
1078            ResourceGroup,
1079        }
1080        impl<'de> serde::Deserialize<'de> for GeneratedField {
1081            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1082            where
1083                D: serde::Deserializer<'de>,
1084            {
1085                struct GeneratedVisitor;
1086
1087                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1088                    type Value = GeneratedField;
1089
1090                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1091                        write!(formatter, "expected one of: {:?}", &FIELDS)
1092                    }
1093
1094                    #[allow(unused_variables)]
1095                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1096                    where
1097                        E: serde::de::Error,
1098                    {
1099                        match value {
1100                            "id" => Ok(GeneratedField::Id),
1101                            "name" => Ok(GeneratedField::Name),
1102                            "owner" => Ok(GeneratedField::Owner),
1103                            "resourceGroup" | "resource_group" => Ok(GeneratedField::ResourceGroup),
1104                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1105                        }
1106                    }
1107                }
1108                deserializer.deserialize_identifier(GeneratedVisitor)
1109            }
1110        }
1111        struct GeneratedVisitor;
1112        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1113            type Value = Database;
1114
1115            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1116                formatter.write_str("struct catalog.Database")
1117            }
1118
1119            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Database, V::Error>
1120                where
1121                    V: serde::de::MapAccess<'de>,
1122            {
1123                let mut id__ = None;
1124                let mut name__ = None;
1125                let mut owner__ = None;
1126                let mut resource_group__ = None;
1127                while let Some(k) = map_.next_key()? {
1128                    match k {
1129                        GeneratedField::Id => {
1130                            if id__.is_some() {
1131                                return Err(serde::de::Error::duplicate_field("id"));
1132                            }
1133                            id__ = 
1134                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1135                            ;
1136                        }
1137                        GeneratedField::Name => {
1138                            if name__.is_some() {
1139                                return Err(serde::de::Error::duplicate_field("name"));
1140                            }
1141                            name__ = Some(map_.next_value()?);
1142                        }
1143                        GeneratedField::Owner => {
1144                            if owner__.is_some() {
1145                                return Err(serde::de::Error::duplicate_field("owner"));
1146                            }
1147                            owner__ = 
1148                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1149                            ;
1150                        }
1151                        GeneratedField::ResourceGroup => {
1152                            if resource_group__.is_some() {
1153                                return Err(serde::de::Error::duplicate_field("resourceGroup"));
1154                            }
1155                            resource_group__ = Some(map_.next_value()?);
1156                        }
1157                    }
1158                }
1159                Ok(Database {
1160                    id: id__.unwrap_or_default(),
1161                    name: name__.unwrap_or_default(),
1162                    owner: owner__.unwrap_or_default(),
1163                    resource_group: resource_group__.unwrap_or_default(),
1164                })
1165            }
1166        }
1167        deserializer.deserialize_struct("catalog.Database", FIELDS, GeneratedVisitor)
1168    }
1169}
1170impl serde::Serialize for Function {
1171    #[allow(deprecated)]
1172    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1173    where
1174        S: serde::Serializer,
1175    {
1176        use serde::ser::SerializeStruct;
1177        let mut len = 0;
1178        if self.id != 0 {
1179            len += 1;
1180        }
1181        if self.schema_id != 0 {
1182            len += 1;
1183        }
1184        if self.database_id != 0 {
1185            len += 1;
1186        }
1187        if !self.name.is_empty() {
1188            len += 1;
1189        }
1190        if self.owner != 0 {
1191            len += 1;
1192        }
1193        if !self.arg_names.is_empty() {
1194            len += 1;
1195        }
1196        if !self.arg_types.is_empty() {
1197            len += 1;
1198        }
1199        if self.return_type.is_some() {
1200            len += 1;
1201        }
1202        if !self.language.is_empty() {
1203            len += 1;
1204        }
1205        if self.link.is_some() {
1206            len += 1;
1207        }
1208        if self.name_in_runtime.is_some() {
1209            len += 1;
1210        }
1211        if self.body.is_some() {
1212            len += 1;
1213        }
1214        if self.compressed_binary.is_some() {
1215            len += 1;
1216        }
1217        if self.always_retry_on_network_error {
1218            len += 1;
1219        }
1220        if self.runtime.is_some() {
1221            len += 1;
1222        }
1223        if self.is_async.is_some() {
1224            len += 1;
1225        }
1226        if self.is_batched.is_some() {
1227            len += 1;
1228        }
1229        if self.kind.is_some() {
1230            len += 1;
1231        }
1232        let mut struct_ser = serializer.serialize_struct("catalog.Function", len)?;
1233        if self.id != 0 {
1234            struct_ser.serialize_field("id", &self.id)?;
1235        }
1236        if self.schema_id != 0 {
1237            struct_ser.serialize_field("schemaId", &self.schema_id)?;
1238        }
1239        if self.database_id != 0 {
1240            struct_ser.serialize_field("databaseId", &self.database_id)?;
1241        }
1242        if !self.name.is_empty() {
1243            struct_ser.serialize_field("name", &self.name)?;
1244        }
1245        if self.owner != 0 {
1246            struct_ser.serialize_field("owner", &self.owner)?;
1247        }
1248        if !self.arg_names.is_empty() {
1249            struct_ser.serialize_field("argNames", &self.arg_names)?;
1250        }
1251        if !self.arg_types.is_empty() {
1252            struct_ser.serialize_field("argTypes", &self.arg_types)?;
1253        }
1254        if let Some(v) = self.return_type.as_ref() {
1255            struct_ser.serialize_field("returnType", v)?;
1256        }
1257        if !self.language.is_empty() {
1258            struct_ser.serialize_field("language", &self.language)?;
1259        }
1260        if let Some(v) = self.link.as_ref() {
1261            struct_ser.serialize_field("link", v)?;
1262        }
1263        if let Some(v) = self.name_in_runtime.as_ref() {
1264            struct_ser.serialize_field("nameInRuntime", v)?;
1265        }
1266        if let Some(v) = self.body.as_ref() {
1267            struct_ser.serialize_field("body", v)?;
1268        }
1269        if let Some(v) = self.compressed_binary.as_ref() {
1270            #[allow(clippy::needless_borrow)]
1271            #[allow(clippy::needless_borrows_for_generic_args)]
1272            struct_ser.serialize_field("compressedBinary", pbjson::private::base64::encode(&v).as_str())?;
1273        }
1274        if self.always_retry_on_network_error {
1275            struct_ser.serialize_field("alwaysRetryOnNetworkError", &self.always_retry_on_network_error)?;
1276        }
1277        if let Some(v) = self.runtime.as_ref() {
1278            struct_ser.serialize_field("runtime", v)?;
1279        }
1280        if let Some(v) = self.is_async.as_ref() {
1281            struct_ser.serialize_field("isAsync", v)?;
1282        }
1283        if let Some(v) = self.is_batched.as_ref() {
1284            struct_ser.serialize_field("isBatched", v)?;
1285        }
1286        if let Some(v) = self.kind.as_ref() {
1287            match v {
1288                function::Kind::Scalar(v) => {
1289                    struct_ser.serialize_field("scalar", v)?;
1290                }
1291                function::Kind::Table(v) => {
1292                    struct_ser.serialize_field("table", v)?;
1293                }
1294                function::Kind::Aggregate(v) => {
1295                    struct_ser.serialize_field("aggregate", v)?;
1296                }
1297            }
1298        }
1299        struct_ser.end()
1300    }
1301}
1302impl<'de> serde::Deserialize<'de> for Function {
1303    #[allow(deprecated)]
1304    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1305    where
1306        D: serde::Deserializer<'de>,
1307    {
1308        const FIELDS: &[&str] = &[
1309            "id",
1310            "schema_id",
1311            "schemaId",
1312            "database_id",
1313            "databaseId",
1314            "name",
1315            "owner",
1316            "arg_names",
1317            "argNames",
1318            "arg_types",
1319            "argTypes",
1320            "return_type",
1321            "returnType",
1322            "language",
1323            "link",
1324            "name_in_runtime",
1325            "nameInRuntime",
1326            "body",
1327            "compressed_binary",
1328            "compressedBinary",
1329            "always_retry_on_network_error",
1330            "alwaysRetryOnNetworkError",
1331            "runtime",
1332            "is_async",
1333            "isAsync",
1334            "is_batched",
1335            "isBatched",
1336            "scalar",
1337            "table",
1338            "aggregate",
1339        ];
1340
1341        #[allow(clippy::enum_variant_names)]
1342        enum GeneratedField {
1343            Id,
1344            SchemaId,
1345            DatabaseId,
1346            Name,
1347            Owner,
1348            ArgNames,
1349            ArgTypes,
1350            ReturnType,
1351            Language,
1352            Link,
1353            NameInRuntime,
1354            Body,
1355            CompressedBinary,
1356            AlwaysRetryOnNetworkError,
1357            Runtime,
1358            IsAsync,
1359            IsBatched,
1360            Scalar,
1361            Table,
1362            Aggregate,
1363        }
1364        impl<'de> serde::Deserialize<'de> for GeneratedField {
1365            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1366            where
1367                D: serde::Deserializer<'de>,
1368            {
1369                struct GeneratedVisitor;
1370
1371                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1372                    type Value = GeneratedField;
1373
1374                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1375                        write!(formatter, "expected one of: {:?}", &FIELDS)
1376                    }
1377
1378                    #[allow(unused_variables)]
1379                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1380                    where
1381                        E: serde::de::Error,
1382                    {
1383                        match value {
1384                            "id" => Ok(GeneratedField::Id),
1385                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
1386                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
1387                            "name" => Ok(GeneratedField::Name),
1388                            "owner" => Ok(GeneratedField::Owner),
1389                            "argNames" | "arg_names" => Ok(GeneratedField::ArgNames),
1390                            "argTypes" | "arg_types" => Ok(GeneratedField::ArgTypes),
1391                            "returnType" | "return_type" => Ok(GeneratedField::ReturnType),
1392                            "language" => Ok(GeneratedField::Language),
1393                            "link" => Ok(GeneratedField::Link),
1394                            "nameInRuntime" | "name_in_runtime" => Ok(GeneratedField::NameInRuntime),
1395                            "body" => Ok(GeneratedField::Body),
1396                            "compressedBinary" | "compressed_binary" => Ok(GeneratedField::CompressedBinary),
1397                            "alwaysRetryOnNetworkError" | "always_retry_on_network_error" => Ok(GeneratedField::AlwaysRetryOnNetworkError),
1398                            "runtime" => Ok(GeneratedField::Runtime),
1399                            "isAsync" | "is_async" => Ok(GeneratedField::IsAsync),
1400                            "isBatched" | "is_batched" => Ok(GeneratedField::IsBatched),
1401                            "scalar" => Ok(GeneratedField::Scalar),
1402                            "table" => Ok(GeneratedField::Table),
1403                            "aggregate" => Ok(GeneratedField::Aggregate),
1404                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
1405                        }
1406                    }
1407                }
1408                deserializer.deserialize_identifier(GeneratedVisitor)
1409            }
1410        }
1411        struct GeneratedVisitor;
1412        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1413            type Value = Function;
1414
1415            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1416                formatter.write_str("struct catalog.Function")
1417            }
1418
1419            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Function, V::Error>
1420                where
1421                    V: serde::de::MapAccess<'de>,
1422            {
1423                let mut id__ = None;
1424                let mut schema_id__ = None;
1425                let mut database_id__ = None;
1426                let mut name__ = None;
1427                let mut owner__ = None;
1428                let mut arg_names__ = None;
1429                let mut arg_types__ = None;
1430                let mut return_type__ = None;
1431                let mut language__ = None;
1432                let mut link__ = None;
1433                let mut name_in_runtime__ = None;
1434                let mut body__ = None;
1435                let mut compressed_binary__ = None;
1436                let mut always_retry_on_network_error__ = None;
1437                let mut runtime__ = None;
1438                let mut is_async__ = None;
1439                let mut is_batched__ = None;
1440                let mut kind__ = None;
1441                while let Some(k) = map_.next_key()? {
1442                    match k {
1443                        GeneratedField::Id => {
1444                            if id__.is_some() {
1445                                return Err(serde::de::Error::duplicate_field("id"));
1446                            }
1447                            id__ = 
1448                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1449                            ;
1450                        }
1451                        GeneratedField::SchemaId => {
1452                            if schema_id__.is_some() {
1453                                return Err(serde::de::Error::duplicate_field("schemaId"));
1454                            }
1455                            schema_id__ = 
1456                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1457                            ;
1458                        }
1459                        GeneratedField::DatabaseId => {
1460                            if database_id__.is_some() {
1461                                return Err(serde::de::Error::duplicate_field("databaseId"));
1462                            }
1463                            database_id__ = 
1464                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1465                            ;
1466                        }
1467                        GeneratedField::Name => {
1468                            if name__.is_some() {
1469                                return Err(serde::de::Error::duplicate_field("name"));
1470                            }
1471                            name__ = Some(map_.next_value()?);
1472                        }
1473                        GeneratedField::Owner => {
1474                            if owner__.is_some() {
1475                                return Err(serde::de::Error::duplicate_field("owner"));
1476                            }
1477                            owner__ = 
1478                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
1479                            ;
1480                        }
1481                        GeneratedField::ArgNames => {
1482                            if arg_names__.is_some() {
1483                                return Err(serde::de::Error::duplicate_field("argNames"));
1484                            }
1485                            arg_names__ = Some(map_.next_value()?);
1486                        }
1487                        GeneratedField::ArgTypes => {
1488                            if arg_types__.is_some() {
1489                                return Err(serde::de::Error::duplicate_field("argTypes"));
1490                            }
1491                            arg_types__ = Some(map_.next_value()?);
1492                        }
1493                        GeneratedField::ReturnType => {
1494                            if return_type__.is_some() {
1495                                return Err(serde::de::Error::duplicate_field("returnType"));
1496                            }
1497                            return_type__ = map_.next_value()?;
1498                        }
1499                        GeneratedField::Language => {
1500                            if language__.is_some() {
1501                                return Err(serde::de::Error::duplicate_field("language"));
1502                            }
1503                            language__ = Some(map_.next_value()?);
1504                        }
1505                        GeneratedField::Link => {
1506                            if link__.is_some() {
1507                                return Err(serde::de::Error::duplicate_field("link"));
1508                            }
1509                            link__ = map_.next_value()?;
1510                        }
1511                        GeneratedField::NameInRuntime => {
1512                            if name_in_runtime__.is_some() {
1513                                return Err(serde::de::Error::duplicate_field("nameInRuntime"));
1514                            }
1515                            name_in_runtime__ = map_.next_value()?;
1516                        }
1517                        GeneratedField::Body => {
1518                            if body__.is_some() {
1519                                return Err(serde::de::Error::duplicate_field("body"));
1520                            }
1521                            body__ = map_.next_value()?;
1522                        }
1523                        GeneratedField::CompressedBinary => {
1524                            if compressed_binary__.is_some() {
1525                                return Err(serde::de::Error::duplicate_field("compressedBinary"));
1526                            }
1527                            compressed_binary__ = 
1528                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
1529                            ;
1530                        }
1531                        GeneratedField::AlwaysRetryOnNetworkError => {
1532                            if always_retry_on_network_error__.is_some() {
1533                                return Err(serde::de::Error::duplicate_field("alwaysRetryOnNetworkError"));
1534                            }
1535                            always_retry_on_network_error__ = Some(map_.next_value()?);
1536                        }
1537                        GeneratedField::Runtime => {
1538                            if runtime__.is_some() {
1539                                return Err(serde::de::Error::duplicate_field("runtime"));
1540                            }
1541                            runtime__ = map_.next_value()?;
1542                        }
1543                        GeneratedField::IsAsync => {
1544                            if is_async__.is_some() {
1545                                return Err(serde::de::Error::duplicate_field("isAsync"));
1546                            }
1547                            is_async__ = map_.next_value()?;
1548                        }
1549                        GeneratedField::IsBatched => {
1550                            if is_batched__.is_some() {
1551                                return Err(serde::de::Error::duplicate_field("isBatched"));
1552                            }
1553                            is_batched__ = map_.next_value()?;
1554                        }
1555                        GeneratedField::Scalar => {
1556                            if kind__.is_some() {
1557                                return Err(serde::de::Error::duplicate_field("scalar"));
1558                            }
1559                            kind__ = map_.next_value::<::std::option::Option<_>>()?.map(function::Kind::Scalar)
1560;
1561                        }
1562                        GeneratedField::Table => {
1563                            if kind__.is_some() {
1564                                return Err(serde::de::Error::duplicate_field("table"));
1565                            }
1566                            kind__ = map_.next_value::<::std::option::Option<_>>()?.map(function::Kind::Table)
1567;
1568                        }
1569                        GeneratedField::Aggregate => {
1570                            if kind__.is_some() {
1571                                return Err(serde::de::Error::duplicate_field("aggregate"));
1572                            }
1573                            kind__ = map_.next_value::<::std::option::Option<_>>()?.map(function::Kind::Aggregate)
1574;
1575                        }
1576                    }
1577                }
1578                Ok(Function {
1579                    id: id__.unwrap_or_default(),
1580                    schema_id: schema_id__.unwrap_or_default(),
1581                    database_id: database_id__.unwrap_or_default(),
1582                    name: name__.unwrap_or_default(),
1583                    owner: owner__.unwrap_or_default(),
1584                    arg_names: arg_names__.unwrap_or_default(),
1585                    arg_types: arg_types__.unwrap_or_default(),
1586                    return_type: return_type__,
1587                    language: language__.unwrap_or_default(),
1588                    link: link__,
1589                    name_in_runtime: name_in_runtime__,
1590                    body: body__,
1591                    compressed_binary: compressed_binary__,
1592                    always_retry_on_network_error: always_retry_on_network_error__.unwrap_or_default(),
1593                    runtime: runtime__,
1594                    is_async: is_async__,
1595                    is_batched: is_batched__,
1596                    kind: kind__,
1597                })
1598            }
1599        }
1600        deserializer.deserialize_struct("catalog.Function", FIELDS, GeneratedVisitor)
1601    }
1602}
1603impl serde::Serialize for function::AggregateFunction {
1604    #[allow(deprecated)]
1605    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1606    where
1607        S: serde::Serializer,
1608    {
1609        use serde::ser::SerializeStruct;
1610        let len = 0;
1611        let struct_ser = serializer.serialize_struct("catalog.Function.AggregateFunction", len)?;
1612        struct_ser.end()
1613    }
1614}
1615impl<'de> serde::Deserialize<'de> for function::AggregateFunction {
1616    #[allow(deprecated)]
1617    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1618    where
1619        D: serde::Deserializer<'de>,
1620    {
1621        const FIELDS: &[&str] = &[
1622        ];
1623
1624        #[allow(clippy::enum_variant_names)]
1625        enum GeneratedField {
1626        }
1627        impl<'de> serde::Deserialize<'de> for GeneratedField {
1628            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1629            where
1630                D: serde::Deserializer<'de>,
1631            {
1632                struct GeneratedVisitor;
1633
1634                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1635                    type Value = GeneratedField;
1636
1637                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1638                        write!(formatter, "expected one of: {:?}", &FIELDS)
1639                    }
1640
1641                    #[allow(unused_variables)]
1642                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1643                    where
1644                        E: serde::de::Error,
1645                    {
1646                            Err(serde::de::Error::unknown_field(value, FIELDS))
1647                    }
1648                }
1649                deserializer.deserialize_identifier(GeneratedVisitor)
1650            }
1651        }
1652        struct GeneratedVisitor;
1653        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1654            type Value = function::AggregateFunction;
1655
1656            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1657                formatter.write_str("struct catalog.Function.AggregateFunction")
1658            }
1659
1660            fn visit_map<V>(self, mut map_: V) -> std::result::Result<function::AggregateFunction, V::Error>
1661                where
1662                    V: serde::de::MapAccess<'de>,
1663            {
1664                while map_.next_key::<GeneratedField>()?.is_some() {
1665                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
1666                }
1667                Ok(function::AggregateFunction {
1668                })
1669            }
1670        }
1671        deserializer.deserialize_struct("catalog.Function.AggregateFunction", FIELDS, GeneratedVisitor)
1672    }
1673}
1674impl serde::Serialize for function::ScalarFunction {
1675    #[allow(deprecated)]
1676    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1677    where
1678        S: serde::Serializer,
1679    {
1680        use serde::ser::SerializeStruct;
1681        let len = 0;
1682        let struct_ser = serializer.serialize_struct("catalog.Function.ScalarFunction", len)?;
1683        struct_ser.end()
1684    }
1685}
1686impl<'de> serde::Deserialize<'de> for function::ScalarFunction {
1687    #[allow(deprecated)]
1688    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1689    where
1690        D: serde::Deserializer<'de>,
1691    {
1692        const FIELDS: &[&str] = &[
1693        ];
1694
1695        #[allow(clippy::enum_variant_names)]
1696        enum GeneratedField {
1697        }
1698        impl<'de> serde::Deserialize<'de> for GeneratedField {
1699            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1700            where
1701                D: serde::Deserializer<'de>,
1702            {
1703                struct GeneratedVisitor;
1704
1705                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1706                    type Value = GeneratedField;
1707
1708                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1709                        write!(formatter, "expected one of: {:?}", &FIELDS)
1710                    }
1711
1712                    #[allow(unused_variables)]
1713                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1714                    where
1715                        E: serde::de::Error,
1716                    {
1717                            Err(serde::de::Error::unknown_field(value, FIELDS))
1718                    }
1719                }
1720                deserializer.deserialize_identifier(GeneratedVisitor)
1721            }
1722        }
1723        struct GeneratedVisitor;
1724        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1725            type Value = function::ScalarFunction;
1726
1727            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1728                formatter.write_str("struct catalog.Function.ScalarFunction")
1729            }
1730
1731            fn visit_map<V>(self, mut map_: V) -> std::result::Result<function::ScalarFunction, V::Error>
1732                where
1733                    V: serde::de::MapAccess<'de>,
1734            {
1735                while map_.next_key::<GeneratedField>()?.is_some() {
1736                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
1737                }
1738                Ok(function::ScalarFunction {
1739                })
1740            }
1741        }
1742        deserializer.deserialize_struct("catalog.Function.ScalarFunction", FIELDS, GeneratedVisitor)
1743    }
1744}
1745impl serde::Serialize for function::TableFunction {
1746    #[allow(deprecated)]
1747    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1748    where
1749        S: serde::Serializer,
1750    {
1751        use serde::ser::SerializeStruct;
1752        let len = 0;
1753        let struct_ser = serializer.serialize_struct("catalog.Function.TableFunction", len)?;
1754        struct_ser.end()
1755    }
1756}
1757impl<'de> serde::Deserialize<'de> for function::TableFunction {
1758    #[allow(deprecated)]
1759    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1760    where
1761        D: serde::Deserializer<'de>,
1762    {
1763        const FIELDS: &[&str] = &[
1764        ];
1765
1766        #[allow(clippy::enum_variant_names)]
1767        enum GeneratedField {
1768        }
1769        impl<'de> serde::Deserialize<'de> for GeneratedField {
1770            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
1771            where
1772                D: serde::Deserializer<'de>,
1773            {
1774                struct GeneratedVisitor;
1775
1776                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1777                    type Value = GeneratedField;
1778
1779                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1780                        write!(formatter, "expected one of: {:?}", &FIELDS)
1781                    }
1782
1783                    #[allow(unused_variables)]
1784                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
1785                    where
1786                        E: serde::de::Error,
1787                    {
1788                            Err(serde::de::Error::unknown_field(value, FIELDS))
1789                    }
1790                }
1791                deserializer.deserialize_identifier(GeneratedVisitor)
1792            }
1793        }
1794        struct GeneratedVisitor;
1795        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1796            type Value = function::TableFunction;
1797
1798            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1799                formatter.write_str("struct catalog.Function.TableFunction")
1800            }
1801
1802            fn visit_map<V>(self, mut map_: V) -> std::result::Result<function::TableFunction, V::Error>
1803                where
1804                    V: serde::de::MapAccess<'de>,
1805            {
1806                while map_.next_key::<GeneratedField>()?.is_some() {
1807                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
1808                }
1809                Ok(function::TableFunction {
1810                })
1811            }
1812        }
1813        deserializer.deserialize_struct("catalog.Function.TableFunction", FIELDS, GeneratedVisitor)
1814    }
1815}
1816impl serde::Serialize for HandleConflictBehavior {
1817    #[allow(deprecated)]
1818    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1819    where
1820        S: serde::Serializer,
1821    {
1822        let variant = match self {
1823            Self::Unspecified => "HANDLE_CONFLICT_BEHAVIOR_UNSPECIFIED",
1824            Self::Overwrite => "HANDLE_CONFLICT_BEHAVIOR_OVERWRITE",
1825            Self::Ignore => "HANDLE_CONFLICT_BEHAVIOR_IGNORE",
1826            Self::NoCheck => "HANDLE_CONFLICT_BEHAVIOR_NO_CHECK",
1827            Self::DoUpdateIfNotNull => "HANDLE_CONFLICT_BEHAVIOR_DO_UPDATE_IF_NOT_NULL",
1828        };
1829        serializer.serialize_str(variant)
1830    }
1831}
1832impl<'de> serde::Deserialize<'de> for HandleConflictBehavior {
1833    #[allow(deprecated)]
1834    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1835    where
1836        D: serde::Deserializer<'de>,
1837    {
1838        const FIELDS: &[&str] = &[
1839            "HANDLE_CONFLICT_BEHAVIOR_UNSPECIFIED",
1840            "HANDLE_CONFLICT_BEHAVIOR_OVERWRITE",
1841            "HANDLE_CONFLICT_BEHAVIOR_IGNORE",
1842            "HANDLE_CONFLICT_BEHAVIOR_NO_CHECK",
1843            "HANDLE_CONFLICT_BEHAVIOR_DO_UPDATE_IF_NOT_NULL",
1844        ];
1845
1846        struct GeneratedVisitor;
1847
1848        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
1849            type Value = HandleConflictBehavior;
1850
1851            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1852                write!(formatter, "expected one of: {:?}", &FIELDS)
1853            }
1854
1855            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
1856            where
1857                E: serde::de::Error,
1858            {
1859                i32::try_from(v)
1860                    .ok()
1861                    .and_then(|x| x.try_into().ok())
1862                    .ok_or_else(|| {
1863                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
1864                    })
1865            }
1866
1867            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
1868            where
1869                E: serde::de::Error,
1870            {
1871                i32::try_from(v)
1872                    .ok()
1873                    .and_then(|x| x.try_into().ok())
1874                    .ok_or_else(|| {
1875                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
1876                    })
1877            }
1878
1879            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1880            where
1881                E: serde::de::Error,
1882            {
1883                match value {
1884                    "HANDLE_CONFLICT_BEHAVIOR_UNSPECIFIED" => Ok(HandleConflictBehavior::Unspecified),
1885                    "HANDLE_CONFLICT_BEHAVIOR_OVERWRITE" => Ok(HandleConflictBehavior::Overwrite),
1886                    "HANDLE_CONFLICT_BEHAVIOR_IGNORE" => Ok(HandleConflictBehavior::Ignore),
1887                    "HANDLE_CONFLICT_BEHAVIOR_NO_CHECK" => Ok(HandleConflictBehavior::NoCheck),
1888                    "HANDLE_CONFLICT_BEHAVIOR_DO_UPDATE_IF_NOT_NULL" => Ok(HandleConflictBehavior::DoUpdateIfNotNull),
1889                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
1890                }
1891            }
1892        }
1893        deserializer.deserialize_any(GeneratedVisitor)
1894    }
1895}
1896impl serde::Serialize for Index {
1897    #[allow(deprecated)]
1898    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1899    where
1900        S: serde::Serializer,
1901    {
1902        use serde::ser::SerializeStruct;
1903        let mut len = 0;
1904        if self.id != 0 {
1905            len += 1;
1906        }
1907        if self.schema_id != 0 {
1908            len += 1;
1909        }
1910        if self.database_id != 0 {
1911            len += 1;
1912        }
1913        if !self.name.is_empty() {
1914            len += 1;
1915        }
1916        if self.owner != 0 {
1917            len += 1;
1918        }
1919        if self.index_table_id != 0 {
1920            len += 1;
1921        }
1922        if self.primary_table_id != 0 {
1923            len += 1;
1924        }
1925        if !self.index_item.is_empty() {
1926            len += 1;
1927        }
1928        if !self.index_column_properties.is_empty() {
1929            len += 1;
1930        }
1931        if self.initialized_at_epoch.is_some() {
1932            len += 1;
1933        }
1934        if self.created_at_epoch.is_some() {
1935            len += 1;
1936        }
1937        if self.stream_job_status != 0 {
1938            len += 1;
1939        }
1940        if self.index_columns_len != 0 {
1941            len += 1;
1942        }
1943        if self.initialized_at_cluster_version.is_some() {
1944            len += 1;
1945        }
1946        if self.created_at_cluster_version.is_some() {
1947            len += 1;
1948        }
1949        let mut struct_ser = serializer.serialize_struct("catalog.Index", len)?;
1950        if self.id != 0 {
1951            struct_ser.serialize_field("id", &self.id)?;
1952        }
1953        if self.schema_id != 0 {
1954            struct_ser.serialize_field("schemaId", &self.schema_id)?;
1955        }
1956        if self.database_id != 0 {
1957            struct_ser.serialize_field("databaseId", &self.database_id)?;
1958        }
1959        if !self.name.is_empty() {
1960            struct_ser.serialize_field("name", &self.name)?;
1961        }
1962        if self.owner != 0 {
1963            struct_ser.serialize_field("owner", &self.owner)?;
1964        }
1965        if self.index_table_id != 0 {
1966            struct_ser.serialize_field("indexTableId", &self.index_table_id)?;
1967        }
1968        if self.primary_table_id != 0 {
1969            struct_ser.serialize_field("primaryTableId", &self.primary_table_id)?;
1970        }
1971        if !self.index_item.is_empty() {
1972            struct_ser.serialize_field("indexItem", &self.index_item)?;
1973        }
1974        if !self.index_column_properties.is_empty() {
1975            struct_ser.serialize_field("indexColumnProperties", &self.index_column_properties)?;
1976        }
1977        if let Some(v) = self.initialized_at_epoch.as_ref() {
1978            #[allow(clippy::needless_borrow)]
1979            #[allow(clippy::needless_borrows_for_generic_args)]
1980            struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
1981        }
1982        if let Some(v) = self.created_at_epoch.as_ref() {
1983            #[allow(clippy::needless_borrow)]
1984            #[allow(clippy::needless_borrows_for_generic_args)]
1985            struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
1986        }
1987        if self.stream_job_status != 0 {
1988            let v = StreamJobStatus::try_from(self.stream_job_status)
1989                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.stream_job_status)))?;
1990            struct_ser.serialize_field("streamJobStatus", &v)?;
1991        }
1992        if self.index_columns_len != 0 {
1993            struct_ser.serialize_field("indexColumnsLen", &self.index_columns_len)?;
1994        }
1995        if let Some(v) = self.initialized_at_cluster_version.as_ref() {
1996            struct_ser.serialize_field("initializedAtClusterVersion", v)?;
1997        }
1998        if let Some(v) = self.created_at_cluster_version.as_ref() {
1999            struct_ser.serialize_field("createdAtClusterVersion", v)?;
2000        }
2001        struct_ser.end()
2002    }
2003}
2004impl<'de> serde::Deserialize<'de> for Index {
2005    #[allow(deprecated)]
2006    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2007    where
2008        D: serde::Deserializer<'de>,
2009    {
2010        const FIELDS: &[&str] = &[
2011            "id",
2012            "schema_id",
2013            "schemaId",
2014            "database_id",
2015            "databaseId",
2016            "name",
2017            "owner",
2018            "index_table_id",
2019            "indexTableId",
2020            "primary_table_id",
2021            "primaryTableId",
2022            "index_item",
2023            "indexItem",
2024            "index_column_properties",
2025            "indexColumnProperties",
2026            "initialized_at_epoch",
2027            "initializedAtEpoch",
2028            "created_at_epoch",
2029            "createdAtEpoch",
2030            "stream_job_status",
2031            "streamJobStatus",
2032            "index_columns_len",
2033            "indexColumnsLen",
2034            "initialized_at_cluster_version",
2035            "initializedAtClusterVersion",
2036            "created_at_cluster_version",
2037            "createdAtClusterVersion",
2038        ];
2039
2040        #[allow(clippy::enum_variant_names)]
2041        enum GeneratedField {
2042            Id,
2043            SchemaId,
2044            DatabaseId,
2045            Name,
2046            Owner,
2047            IndexTableId,
2048            PrimaryTableId,
2049            IndexItem,
2050            IndexColumnProperties,
2051            InitializedAtEpoch,
2052            CreatedAtEpoch,
2053            StreamJobStatus,
2054            IndexColumnsLen,
2055            InitializedAtClusterVersion,
2056            CreatedAtClusterVersion,
2057        }
2058        impl<'de> serde::Deserialize<'de> for GeneratedField {
2059            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
2060            where
2061                D: serde::Deserializer<'de>,
2062            {
2063                struct GeneratedVisitor;
2064
2065                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2066                    type Value = GeneratedField;
2067
2068                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2069                        write!(formatter, "expected one of: {:?}", &FIELDS)
2070                    }
2071
2072                    #[allow(unused_variables)]
2073                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
2074                    where
2075                        E: serde::de::Error,
2076                    {
2077                        match value {
2078                            "id" => Ok(GeneratedField::Id),
2079                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
2080                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
2081                            "name" => Ok(GeneratedField::Name),
2082                            "owner" => Ok(GeneratedField::Owner),
2083                            "indexTableId" | "index_table_id" => Ok(GeneratedField::IndexTableId),
2084                            "primaryTableId" | "primary_table_id" => Ok(GeneratedField::PrimaryTableId),
2085                            "indexItem" | "index_item" => Ok(GeneratedField::IndexItem),
2086                            "indexColumnProperties" | "index_column_properties" => Ok(GeneratedField::IndexColumnProperties),
2087                            "initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
2088                            "createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
2089                            "streamJobStatus" | "stream_job_status" => Ok(GeneratedField::StreamJobStatus),
2090                            "indexColumnsLen" | "index_columns_len" => Ok(GeneratedField::IndexColumnsLen),
2091                            "initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
2092                            "createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
2093                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
2094                        }
2095                    }
2096                }
2097                deserializer.deserialize_identifier(GeneratedVisitor)
2098            }
2099        }
2100        struct GeneratedVisitor;
2101        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2102            type Value = Index;
2103
2104            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2105                formatter.write_str("struct catalog.Index")
2106            }
2107
2108            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Index, V::Error>
2109                where
2110                    V: serde::de::MapAccess<'de>,
2111            {
2112                let mut id__ = None;
2113                let mut schema_id__ = None;
2114                let mut database_id__ = None;
2115                let mut name__ = None;
2116                let mut owner__ = None;
2117                let mut index_table_id__ = None;
2118                let mut primary_table_id__ = None;
2119                let mut index_item__ = None;
2120                let mut index_column_properties__ = None;
2121                let mut initialized_at_epoch__ = None;
2122                let mut created_at_epoch__ = None;
2123                let mut stream_job_status__ = None;
2124                let mut index_columns_len__ = None;
2125                let mut initialized_at_cluster_version__ = None;
2126                let mut created_at_cluster_version__ = None;
2127                while let Some(k) = map_.next_key()? {
2128                    match k {
2129                        GeneratedField::Id => {
2130                            if id__.is_some() {
2131                                return Err(serde::de::Error::duplicate_field("id"));
2132                            }
2133                            id__ = 
2134                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2135                            ;
2136                        }
2137                        GeneratedField::SchemaId => {
2138                            if schema_id__.is_some() {
2139                                return Err(serde::de::Error::duplicate_field("schemaId"));
2140                            }
2141                            schema_id__ = 
2142                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2143                            ;
2144                        }
2145                        GeneratedField::DatabaseId => {
2146                            if database_id__.is_some() {
2147                                return Err(serde::de::Error::duplicate_field("databaseId"));
2148                            }
2149                            database_id__ = 
2150                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2151                            ;
2152                        }
2153                        GeneratedField::Name => {
2154                            if name__.is_some() {
2155                                return Err(serde::de::Error::duplicate_field("name"));
2156                            }
2157                            name__ = Some(map_.next_value()?);
2158                        }
2159                        GeneratedField::Owner => {
2160                            if owner__.is_some() {
2161                                return Err(serde::de::Error::duplicate_field("owner"));
2162                            }
2163                            owner__ = 
2164                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2165                            ;
2166                        }
2167                        GeneratedField::IndexTableId => {
2168                            if index_table_id__.is_some() {
2169                                return Err(serde::de::Error::duplicate_field("indexTableId"));
2170                            }
2171                            index_table_id__ = 
2172                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2173                            ;
2174                        }
2175                        GeneratedField::PrimaryTableId => {
2176                            if primary_table_id__.is_some() {
2177                                return Err(serde::de::Error::duplicate_field("primaryTableId"));
2178                            }
2179                            primary_table_id__ = 
2180                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2181                            ;
2182                        }
2183                        GeneratedField::IndexItem => {
2184                            if index_item__.is_some() {
2185                                return Err(serde::de::Error::duplicate_field("indexItem"));
2186                            }
2187                            index_item__ = Some(map_.next_value()?);
2188                        }
2189                        GeneratedField::IndexColumnProperties => {
2190                            if index_column_properties__.is_some() {
2191                                return Err(serde::de::Error::duplicate_field("indexColumnProperties"));
2192                            }
2193                            index_column_properties__ = Some(map_.next_value()?);
2194                        }
2195                        GeneratedField::InitializedAtEpoch => {
2196                            if initialized_at_epoch__.is_some() {
2197                                return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
2198                            }
2199                            initialized_at_epoch__ = 
2200                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
2201                            ;
2202                        }
2203                        GeneratedField::CreatedAtEpoch => {
2204                            if created_at_epoch__.is_some() {
2205                                return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
2206                            }
2207                            created_at_epoch__ = 
2208                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
2209                            ;
2210                        }
2211                        GeneratedField::StreamJobStatus => {
2212                            if stream_job_status__.is_some() {
2213                                return Err(serde::de::Error::duplicate_field("streamJobStatus"));
2214                            }
2215                            stream_job_status__ = Some(map_.next_value::<StreamJobStatus>()? as i32);
2216                        }
2217                        GeneratedField::IndexColumnsLen => {
2218                            if index_columns_len__.is_some() {
2219                                return Err(serde::de::Error::duplicate_field("indexColumnsLen"));
2220                            }
2221                            index_columns_len__ = 
2222                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2223                            ;
2224                        }
2225                        GeneratedField::InitializedAtClusterVersion => {
2226                            if initialized_at_cluster_version__.is_some() {
2227                                return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
2228                            }
2229                            initialized_at_cluster_version__ = map_.next_value()?;
2230                        }
2231                        GeneratedField::CreatedAtClusterVersion => {
2232                            if created_at_cluster_version__.is_some() {
2233                                return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
2234                            }
2235                            created_at_cluster_version__ = map_.next_value()?;
2236                        }
2237                    }
2238                }
2239                Ok(Index {
2240                    id: id__.unwrap_or_default(),
2241                    schema_id: schema_id__.unwrap_or_default(),
2242                    database_id: database_id__.unwrap_or_default(),
2243                    name: name__.unwrap_or_default(),
2244                    owner: owner__.unwrap_or_default(),
2245                    index_table_id: index_table_id__.unwrap_or_default(),
2246                    primary_table_id: primary_table_id__.unwrap_or_default(),
2247                    index_item: index_item__.unwrap_or_default(),
2248                    index_column_properties: index_column_properties__.unwrap_or_default(),
2249                    initialized_at_epoch: initialized_at_epoch__,
2250                    created_at_epoch: created_at_epoch__,
2251                    stream_job_status: stream_job_status__.unwrap_or_default(),
2252                    index_columns_len: index_columns_len__.unwrap_or_default(),
2253                    initialized_at_cluster_version: initialized_at_cluster_version__,
2254                    created_at_cluster_version: created_at_cluster_version__,
2255                })
2256            }
2257        }
2258        deserializer.deserialize_struct("catalog.Index", FIELDS, GeneratedVisitor)
2259    }
2260}
2261impl serde::Serialize for IndexColumnProperties {
2262    #[allow(deprecated)]
2263    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2264    where
2265        S: serde::Serializer,
2266    {
2267        use serde::ser::SerializeStruct;
2268        let mut len = 0;
2269        if self.is_desc {
2270            len += 1;
2271        }
2272        if self.nulls_first {
2273            len += 1;
2274        }
2275        let mut struct_ser = serializer.serialize_struct("catalog.IndexColumnProperties", len)?;
2276        if self.is_desc {
2277            struct_ser.serialize_field("isDesc", &self.is_desc)?;
2278        }
2279        if self.nulls_first {
2280            struct_ser.serialize_field("nullsFirst", &self.nulls_first)?;
2281        }
2282        struct_ser.end()
2283    }
2284}
2285impl<'de> serde::Deserialize<'de> for IndexColumnProperties {
2286    #[allow(deprecated)]
2287    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2288    where
2289        D: serde::Deserializer<'de>,
2290    {
2291        const FIELDS: &[&str] = &[
2292            "is_desc",
2293            "isDesc",
2294            "nulls_first",
2295            "nullsFirst",
2296        ];
2297
2298        #[allow(clippy::enum_variant_names)]
2299        enum GeneratedField {
2300            IsDesc,
2301            NullsFirst,
2302        }
2303        impl<'de> serde::Deserialize<'de> for GeneratedField {
2304            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
2305            where
2306                D: serde::Deserializer<'de>,
2307            {
2308                struct GeneratedVisitor;
2309
2310                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2311                    type Value = GeneratedField;
2312
2313                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2314                        write!(formatter, "expected one of: {:?}", &FIELDS)
2315                    }
2316
2317                    #[allow(unused_variables)]
2318                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
2319                    where
2320                        E: serde::de::Error,
2321                    {
2322                        match value {
2323                            "isDesc" | "is_desc" => Ok(GeneratedField::IsDesc),
2324                            "nullsFirst" | "nulls_first" => Ok(GeneratedField::NullsFirst),
2325                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
2326                        }
2327                    }
2328                }
2329                deserializer.deserialize_identifier(GeneratedVisitor)
2330            }
2331        }
2332        struct GeneratedVisitor;
2333        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2334            type Value = IndexColumnProperties;
2335
2336            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2337                formatter.write_str("struct catalog.IndexColumnProperties")
2338            }
2339
2340            fn visit_map<V>(self, mut map_: V) -> std::result::Result<IndexColumnProperties, V::Error>
2341                where
2342                    V: serde::de::MapAccess<'de>,
2343            {
2344                let mut is_desc__ = None;
2345                let mut nulls_first__ = None;
2346                while let Some(k) = map_.next_key()? {
2347                    match k {
2348                        GeneratedField::IsDesc => {
2349                            if is_desc__.is_some() {
2350                                return Err(serde::de::Error::duplicate_field("isDesc"));
2351                            }
2352                            is_desc__ = Some(map_.next_value()?);
2353                        }
2354                        GeneratedField::NullsFirst => {
2355                            if nulls_first__.is_some() {
2356                                return Err(serde::de::Error::duplicate_field("nullsFirst"));
2357                            }
2358                            nulls_first__ = Some(map_.next_value()?);
2359                        }
2360                    }
2361                }
2362                Ok(IndexColumnProperties {
2363                    is_desc: is_desc__.unwrap_or_default(),
2364                    nulls_first: nulls_first__.unwrap_or_default(),
2365                })
2366            }
2367        }
2368        deserializer.deserialize_struct("catalog.IndexColumnProperties", FIELDS, GeneratedVisitor)
2369    }
2370}
2371impl serde::Serialize for OptionsWithSecret {
2372    #[allow(deprecated)]
2373    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2374    where
2375        S: serde::Serializer,
2376    {
2377        use serde::ser::SerializeStruct;
2378        let mut len = 0;
2379        if !self.options.is_empty() {
2380            len += 1;
2381        }
2382        if !self.secret_refs.is_empty() {
2383            len += 1;
2384        }
2385        let mut struct_ser = serializer.serialize_struct("catalog.OptionsWithSecret", len)?;
2386        if !self.options.is_empty() {
2387            struct_ser.serialize_field("options", &self.options)?;
2388        }
2389        if !self.secret_refs.is_empty() {
2390            struct_ser.serialize_field("secretRefs", &self.secret_refs)?;
2391        }
2392        struct_ser.end()
2393    }
2394}
2395impl<'de> serde::Deserialize<'de> for OptionsWithSecret {
2396    #[allow(deprecated)]
2397    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2398    where
2399        D: serde::Deserializer<'de>,
2400    {
2401        const FIELDS: &[&str] = &[
2402            "options",
2403            "secret_refs",
2404            "secretRefs",
2405        ];
2406
2407        #[allow(clippy::enum_variant_names)]
2408        enum GeneratedField {
2409            Options,
2410            SecretRefs,
2411        }
2412        impl<'de> serde::Deserialize<'de> for GeneratedField {
2413            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
2414            where
2415                D: serde::Deserializer<'de>,
2416            {
2417                struct GeneratedVisitor;
2418
2419                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2420                    type Value = GeneratedField;
2421
2422                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2423                        write!(formatter, "expected one of: {:?}", &FIELDS)
2424                    }
2425
2426                    #[allow(unused_variables)]
2427                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
2428                    where
2429                        E: serde::de::Error,
2430                    {
2431                        match value {
2432                            "options" => Ok(GeneratedField::Options),
2433                            "secretRefs" | "secret_refs" => Ok(GeneratedField::SecretRefs),
2434                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
2435                        }
2436                    }
2437                }
2438                deserializer.deserialize_identifier(GeneratedVisitor)
2439            }
2440        }
2441        struct GeneratedVisitor;
2442        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2443            type Value = OptionsWithSecret;
2444
2445            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2446                formatter.write_str("struct catalog.OptionsWithSecret")
2447            }
2448
2449            fn visit_map<V>(self, mut map_: V) -> std::result::Result<OptionsWithSecret, V::Error>
2450                where
2451                    V: serde::de::MapAccess<'de>,
2452            {
2453                let mut options__ = None;
2454                let mut secret_refs__ = None;
2455                while let Some(k) = map_.next_key()? {
2456                    match k {
2457                        GeneratedField::Options => {
2458                            if options__.is_some() {
2459                                return Err(serde::de::Error::duplicate_field("options"));
2460                            }
2461                            options__ = Some(
2462                                map_.next_value::<std::collections::HashMap<_, _>>()?
2463                            );
2464                        }
2465                        GeneratedField::SecretRefs => {
2466                            if secret_refs__.is_some() {
2467                                return Err(serde::de::Error::duplicate_field("secretRefs"));
2468                            }
2469                            secret_refs__ = Some(
2470                                map_.next_value::<std::collections::HashMap<_, _>>()?
2471                            );
2472                        }
2473                    }
2474                }
2475                Ok(OptionsWithSecret {
2476                    options: options__.unwrap_or_default(),
2477                    secret_refs: secret_refs__.unwrap_or_default(),
2478                })
2479            }
2480        }
2481        deserializer.deserialize_struct("catalog.OptionsWithSecret", FIELDS, GeneratedVisitor)
2482    }
2483}
2484impl serde::Serialize for Schema {
2485    #[allow(deprecated)]
2486    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2487    where
2488        S: serde::Serializer,
2489    {
2490        use serde::ser::SerializeStruct;
2491        let mut len = 0;
2492        if self.id != 0 {
2493            len += 1;
2494        }
2495        if self.database_id != 0 {
2496            len += 1;
2497        }
2498        if !self.name.is_empty() {
2499            len += 1;
2500        }
2501        if self.owner != 0 {
2502            len += 1;
2503        }
2504        let mut struct_ser = serializer.serialize_struct("catalog.Schema", len)?;
2505        if self.id != 0 {
2506            struct_ser.serialize_field("id", &self.id)?;
2507        }
2508        if self.database_id != 0 {
2509            struct_ser.serialize_field("databaseId", &self.database_id)?;
2510        }
2511        if !self.name.is_empty() {
2512            struct_ser.serialize_field("name", &self.name)?;
2513        }
2514        if self.owner != 0 {
2515            struct_ser.serialize_field("owner", &self.owner)?;
2516        }
2517        struct_ser.end()
2518    }
2519}
2520impl<'de> serde::Deserialize<'de> for Schema {
2521    #[allow(deprecated)]
2522    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2523    where
2524        D: serde::Deserializer<'de>,
2525    {
2526        const FIELDS: &[&str] = &[
2527            "id",
2528            "database_id",
2529            "databaseId",
2530            "name",
2531            "owner",
2532        ];
2533
2534        #[allow(clippy::enum_variant_names)]
2535        enum GeneratedField {
2536            Id,
2537            DatabaseId,
2538            Name,
2539            Owner,
2540        }
2541        impl<'de> serde::Deserialize<'de> for GeneratedField {
2542            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
2543            where
2544                D: serde::Deserializer<'de>,
2545            {
2546                struct GeneratedVisitor;
2547
2548                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2549                    type Value = GeneratedField;
2550
2551                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2552                        write!(formatter, "expected one of: {:?}", &FIELDS)
2553                    }
2554
2555                    #[allow(unused_variables)]
2556                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
2557                    where
2558                        E: serde::de::Error,
2559                    {
2560                        match value {
2561                            "id" => Ok(GeneratedField::Id),
2562                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
2563                            "name" => Ok(GeneratedField::Name),
2564                            "owner" => Ok(GeneratedField::Owner),
2565                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
2566                        }
2567                    }
2568                }
2569                deserializer.deserialize_identifier(GeneratedVisitor)
2570            }
2571        }
2572        struct GeneratedVisitor;
2573        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2574            type Value = Schema;
2575
2576            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2577                formatter.write_str("struct catalog.Schema")
2578            }
2579
2580            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Schema, V::Error>
2581                where
2582                    V: serde::de::MapAccess<'de>,
2583            {
2584                let mut id__ = None;
2585                let mut database_id__ = None;
2586                let mut name__ = None;
2587                let mut owner__ = None;
2588                while let Some(k) = map_.next_key()? {
2589                    match k {
2590                        GeneratedField::Id => {
2591                            if id__.is_some() {
2592                                return Err(serde::de::Error::duplicate_field("id"));
2593                            }
2594                            id__ = 
2595                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2596                            ;
2597                        }
2598                        GeneratedField::DatabaseId => {
2599                            if database_id__.is_some() {
2600                                return Err(serde::de::Error::duplicate_field("databaseId"));
2601                            }
2602                            database_id__ = 
2603                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2604                            ;
2605                        }
2606                        GeneratedField::Name => {
2607                            if name__.is_some() {
2608                                return Err(serde::de::Error::duplicate_field("name"));
2609                            }
2610                            name__ = Some(map_.next_value()?);
2611                        }
2612                        GeneratedField::Owner => {
2613                            if owner__.is_some() {
2614                                return Err(serde::de::Error::duplicate_field("owner"));
2615                            }
2616                            owner__ = 
2617                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2618                            ;
2619                        }
2620                    }
2621                }
2622                Ok(Schema {
2623                    id: id__.unwrap_or_default(),
2624                    database_id: database_id__.unwrap_or_default(),
2625                    name: name__.unwrap_or_default(),
2626                    owner: owner__.unwrap_or_default(),
2627                })
2628            }
2629        }
2630        deserializer.deserialize_struct("catalog.Schema", FIELDS, GeneratedVisitor)
2631    }
2632}
2633impl serde::Serialize for SchemaRegistryNameStrategy {
2634    #[allow(deprecated)]
2635    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2636    where
2637        S: serde::Serializer,
2638    {
2639        let variant = match self {
2640            Self::Unspecified => "SCHEMA_REGISTRY_NAME_STRATEGY_UNSPECIFIED",
2641            Self::RecordNameStrategy => "SCHEMA_REGISTRY_NAME_STRATEGY_RECORD_NAME_STRATEGY",
2642            Self::TopicRecordNameStrategy => "SCHEMA_REGISTRY_NAME_STRATEGY_TOPIC_RECORD_NAME_STRATEGY",
2643        };
2644        serializer.serialize_str(variant)
2645    }
2646}
2647impl<'de> serde::Deserialize<'de> for SchemaRegistryNameStrategy {
2648    #[allow(deprecated)]
2649    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2650    where
2651        D: serde::Deserializer<'de>,
2652    {
2653        const FIELDS: &[&str] = &[
2654            "SCHEMA_REGISTRY_NAME_STRATEGY_UNSPECIFIED",
2655            "SCHEMA_REGISTRY_NAME_STRATEGY_RECORD_NAME_STRATEGY",
2656            "SCHEMA_REGISTRY_NAME_STRATEGY_TOPIC_RECORD_NAME_STRATEGY",
2657        ];
2658
2659        struct GeneratedVisitor;
2660
2661        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2662            type Value = SchemaRegistryNameStrategy;
2663
2664            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2665                write!(formatter, "expected one of: {:?}", &FIELDS)
2666            }
2667
2668            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
2669            where
2670                E: serde::de::Error,
2671            {
2672                i32::try_from(v)
2673                    .ok()
2674                    .and_then(|x| x.try_into().ok())
2675                    .ok_or_else(|| {
2676                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
2677                    })
2678            }
2679
2680            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
2681            where
2682                E: serde::de::Error,
2683            {
2684                i32::try_from(v)
2685                    .ok()
2686                    .and_then(|x| x.try_into().ok())
2687                    .ok_or_else(|| {
2688                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
2689                    })
2690            }
2691
2692            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2693            where
2694                E: serde::de::Error,
2695            {
2696                match value {
2697                    "SCHEMA_REGISTRY_NAME_STRATEGY_UNSPECIFIED" => Ok(SchemaRegistryNameStrategy::Unspecified),
2698                    "SCHEMA_REGISTRY_NAME_STRATEGY_RECORD_NAME_STRATEGY" => Ok(SchemaRegistryNameStrategy::RecordNameStrategy),
2699                    "SCHEMA_REGISTRY_NAME_STRATEGY_TOPIC_RECORD_NAME_STRATEGY" => Ok(SchemaRegistryNameStrategy::TopicRecordNameStrategy),
2700                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
2701                }
2702            }
2703        }
2704        deserializer.deserialize_any(GeneratedVisitor)
2705    }
2706}
2707impl serde::Serialize for Secret {
2708    #[allow(deprecated)]
2709    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2710    where
2711        S: serde::Serializer,
2712    {
2713        use serde::ser::SerializeStruct;
2714        let mut len = 0;
2715        if self.id != 0 {
2716            len += 1;
2717        }
2718        if !self.name.is_empty() {
2719            len += 1;
2720        }
2721        if self.database_id != 0 {
2722            len += 1;
2723        }
2724        if !self.value.is_empty() {
2725            len += 1;
2726        }
2727        if self.owner != 0 {
2728            len += 1;
2729        }
2730        if self.schema_id != 0 {
2731            len += 1;
2732        }
2733        let mut struct_ser = serializer.serialize_struct("catalog.Secret", len)?;
2734        if self.id != 0 {
2735            struct_ser.serialize_field("id", &self.id)?;
2736        }
2737        if !self.name.is_empty() {
2738            struct_ser.serialize_field("name", &self.name)?;
2739        }
2740        if self.database_id != 0 {
2741            struct_ser.serialize_field("databaseId", &self.database_id)?;
2742        }
2743        if !self.value.is_empty() {
2744            #[allow(clippy::needless_borrow)]
2745            #[allow(clippy::needless_borrows_for_generic_args)]
2746            struct_ser.serialize_field("value", pbjson::private::base64::encode(&self.value).as_str())?;
2747        }
2748        if self.owner != 0 {
2749            struct_ser.serialize_field("owner", &self.owner)?;
2750        }
2751        if self.schema_id != 0 {
2752            struct_ser.serialize_field("schemaId", &self.schema_id)?;
2753        }
2754        struct_ser.end()
2755    }
2756}
2757impl<'de> serde::Deserialize<'de> for Secret {
2758    #[allow(deprecated)]
2759    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2760    where
2761        D: serde::Deserializer<'de>,
2762    {
2763        const FIELDS: &[&str] = &[
2764            "id",
2765            "name",
2766            "database_id",
2767            "databaseId",
2768            "value",
2769            "owner",
2770            "schema_id",
2771            "schemaId",
2772        ];
2773
2774        #[allow(clippy::enum_variant_names)]
2775        enum GeneratedField {
2776            Id,
2777            Name,
2778            DatabaseId,
2779            Value,
2780            Owner,
2781            SchemaId,
2782        }
2783        impl<'de> serde::Deserialize<'de> for GeneratedField {
2784            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
2785            where
2786                D: serde::Deserializer<'de>,
2787            {
2788                struct GeneratedVisitor;
2789
2790                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2791                    type Value = GeneratedField;
2792
2793                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2794                        write!(formatter, "expected one of: {:?}", &FIELDS)
2795                    }
2796
2797                    #[allow(unused_variables)]
2798                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
2799                    where
2800                        E: serde::de::Error,
2801                    {
2802                        match value {
2803                            "id" => Ok(GeneratedField::Id),
2804                            "name" => Ok(GeneratedField::Name),
2805                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
2806                            "value" => Ok(GeneratedField::Value),
2807                            "owner" => Ok(GeneratedField::Owner),
2808                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
2809                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
2810                        }
2811                    }
2812                }
2813                deserializer.deserialize_identifier(GeneratedVisitor)
2814            }
2815        }
2816        struct GeneratedVisitor;
2817        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
2818            type Value = Secret;
2819
2820            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2821                formatter.write_str("struct catalog.Secret")
2822            }
2823
2824            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Secret, V::Error>
2825                where
2826                    V: serde::de::MapAccess<'de>,
2827            {
2828                let mut id__ = None;
2829                let mut name__ = None;
2830                let mut database_id__ = None;
2831                let mut value__ = None;
2832                let mut owner__ = None;
2833                let mut schema_id__ = None;
2834                while let Some(k) = map_.next_key()? {
2835                    match k {
2836                        GeneratedField::Id => {
2837                            if id__.is_some() {
2838                                return Err(serde::de::Error::duplicate_field("id"));
2839                            }
2840                            id__ = 
2841                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2842                            ;
2843                        }
2844                        GeneratedField::Name => {
2845                            if name__.is_some() {
2846                                return Err(serde::de::Error::duplicate_field("name"));
2847                            }
2848                            name__ = Some(map_.next_value()?);
2849                        }
2850                        GeneratedField::DatabaseId => {
2851                            if database_id__.is_some() {
2852                                return Err(serde::de::Error::duplicate_field("databaseId"));
2853                            }
2854                            database_id__ = 
2855                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2856                            ;
2857                        }
2858                        GeneratedField::Value => {
2859                            if value__.is_some() {
2860                                return Err(serde::de::Error::duplicate_field("value"));
2861                            }
2862                            value__ = 
2863                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
2864                            ;
2865                        }
2866                        GeneratedField::Owner => {
2867                            if owner__.is_some() {
2868                                return Err(serde::de::Error::duplicate_field("owner"));
2869                            }
2870                            owner__ = 
2871                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2872                            ;
2873                        }
2874                        GeneratedField::SchemaId => {
2875                            if schema_id__.is_some() {
2876                                return Err(serde::de::Error::duplicate_field("schemaId"));
2877                            }
2878                            schema_id__ = 
2879                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
2880                            ;
2881                        }
2882                    }
2883                }
2884                Ok(Secret {
2885                    id: id__.unwrap_or_default(),
2886                    name: name__.unwrap_or_default(),
2887                    database_id: database_id__.unwrap_or_default(),
2888                    value: value__.unwrap_or_default(),
2889                    owner: owner__.unwrap_or_default(),
2890                    schema_id: schema_id__.unwrap_or_default(),
2891                })
2892            }
2893        }
2894        deserializer.deserialize_struct("catalog.Secret", FIELDS, GeneratedVisitor)
2895    }
2896}
2897impl serde::Serialize for Sink {
2898    #[allow(deprecated)]
2899    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2900    where
2901        S: serde::Serializer,
2902    {
2903        use serde::ser::SerializeStruct;
2904        let mut len = 0;
2905        if self.id != 0 {
2906            len += 1;
2907        }
2908        if self.schema_id != 0 {
2909            len += 1;
2910        }
2911        if self.database_id != 0 {
2912            len += 1;
2913        }
2914        if !self.name.is_empty() {
2915            len += 1;
2916        }
2917        if !self.columns.is_empty() {
2918            len += 1;
2919        }
2920        if !self.plan_pk.is_empty() {
2921            len += 1;
2922        }
2923        if !self.dependent_relations.is_empty() {
2924            len += 1;
2925        }
2926        if !self.distribution_key.is_empty() {
2927            len += 1;
2928        }
2929        if !self.downstream_pk.is_empty() {
2930            len += 1;
2931        }
2932        if self.sink_type != 0 {
2933            len += 1;
2934        }
2935        if self.owner != 0 {
2936            len += 1;
2937        }
2938        if !self.properties.is_empty() {
2939            len += 1;
2940        }
2941        if !self.definition.is_empty() {
2942            len += 1;
2943        }
2944        if self.connection_id.is_some() {
2945            len += 1;
2946        }
2947        if self.initialized_at_epoch.is_some() {
2948            len += 1;
2949        }
2950        if self.created_at_epoch.is_some() {
2951            len += 1;
2952        }
2953        if !self.db_name.is_empty() {
2954            len += 1;
2955        }
2956        if !self.sink_from_name.is_empty() {
2957            len += 1;
2958        }
2959        if self.stream_job_status != 0 {
2960            len += 1;
2961        }
2962        if self.format_desc.is_some() {
2963            len += 1;
2964        }
2965        if self.target_table.is_some() {
2966            len += 1;
2967        }
2968        if self.initialized_at_cluster_version.is_some() {
2969            len += 1;
2970        }
2971        if self.created_at_cluster_version.is_some() {
2972            len += 1;
2973        }
2974        if self.create_type != 0 {
2975            len += 1;
2976        }
2977        if !self.secret_refs.is_empty() {
2978            len += 1;
2979        }
2980        if !self.original_target_columns.is_empty() {
2981            len += 1;
2982        }
2983        let mut struct_ser = serializer.serialize_struct("catalog.Sink", len)?;
2984        if self.id != 0 {
2985            struct_ser.serialize_field("id", &self.id)?;
2986        }
2987        if self.schema_id != 0 {
2988            struct_ser.serialize_field("schemaId", &self.schema_id)?;
2989        }
2990        if self.database_id != 0 {
2991            struct_ser.serialize_field("databaseId", &self.database_id)?;
2992        }
2993        if !self.name.is_empty() {
2994            struct_ser.serialize_field("name", &self.name)?;
2995        }
2996        if !self.columns.is_empty() {
2997            struct_ser.serialize_field("columns", &self.columns)?;
2998        }
2999        if !self.plan_pk.is_empty() {
3000            struct_ser.serialize_field("planPk", &self.plan_pk)?;
3001        }
3002        if !self.dependent_relations.is_empty() {
3003            struct_ser.serialize_field("dependentRelations", &self.dependent_relations)?;
3004        }
3005        if !self.distribution_key.is_empty() {
3006            struct_ser.serialize_field("distributionKey", &self.distribution_key)?;
3007        }
3008        if !self.downstream_pk.is_empty() {
3009            struct_ser.serialize_field("downstreamPk", &self.downstream_pk)?;
3010        }
3011        if self.sink_type != 0 {
3012            let v = SinkType::try_from(self.sink_type)
3013                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.sink_type)))?;
3014            struct_ser.serialize_field("sinkType", &v)?;
3015        }
3016        if self.owner != 0 {
3017            struct_ser.serialize_field("owner", &self.owner)?;
3018        }
3019        if !self.properties.is_empty() {
3020            struct_ser.serialize_field("properties", &self.properties)?;
3021        }
3022        if !self.definition.is_empty() {
3023            struct_ser.serialize_field("definition", &self.definition)?;
3024        }
3025        if let Some(v) = self.connection_id.as_ref() {
3026            struct_ser.serialize_field("connectionId", v)?;
3027        }
3028        if let Some(v) = self.initialized_at_epoch.as_ref() {
3029            #[allow(clippy::needless_borrow)]
3030            #[allow(clippy::needless_borrows_for_generic_args)]
3031            struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
3032        }
3033        if let Some(v) = self.created_at_epoch.as_ref() {
3034            #[allow(clippy::needless_borrow)]
3035            #[allow(clippy::needless_borrows_for_generic_args)]
3036            struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
3037        }
3038        if !self.db_name.is_empty() {
3039            struct_ser.serialize_field("dbName", &self.db_name)?;
3040        }
3041        if !self.sink_from_name.is_empty() {
3042            struct_ser.serialize_field("sinkFromName", &self.sink_from_name)?;
3043        }
3044        if self.stream_job_status != 0 {
3045            let v = StreamJobStatus::try_from(self.stream_job_status)
3046                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.stream_job_status)))?;
3047            struct_ser.serialize_field("streamJobStatus", &v)?;
3048        }
3049        if let Some(v) = self.format_desc.as_ref() {
3050            struct_ser.serialize_field("formatDesc", v)?;
3051        }
3052        if let Some(v) = self.target_table.as_ref() {
3053            struct_ser.serialize_field("targetTable", v)?;
3054        }
3055        if let Some(v) = self.initialized_at_cluster_version.as_ref() {
3056            struct_ser.serialize_field("initializedAtClusterVersion", v)?;
3057        }
3058        if let Some(v) = self.created_at_cluster_version.as_ref() {
3059            struct_ser.serialize_field("createdAtClusterVersion", v)?;
3060        }
3061        if self.create_type != 0 {
3062            let v = CreateType::try_from(self.create_type)
3063                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.create_type)))?;
3064            struct_ser.serialize_field("createType", &v)?;
3065        }
3066        if !self.secret_refs.is_empty() {
3067            struct_ser.serialize_field("secretRefs", &self.secret_refs)?;
3068        }
3069        if !self.original_target_columns.is_empty() {
3070            struct_ser.serialize_field("originalTargetColumns", &self.original_target_columns)?;
3071        }
3072        struct_ser.end()
3073    }
3074}
3075impl<'de> serde::Deserialize<'de> for Sink {
3076    #[allow(deprecated)]
3077    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3078    where
3079        D: serde::Deserializer<'de>,
3080    {
3081        const FIELDS: &[&str] = &[
3082            "id",
3083            "schema_id",
3084            "schemaId",
3085            "database_id",
3086            "databaseId",
3087            "name",
3088            "columns",
3089            "plan_pk",
3090            "planPk",
3091            "dependent_relations",
3092            "dependentRelations",
3093            "distribution_key",
3094            "distributionKey",
3095            "downstream_pk",
3096            "downstreamPk",
3097            "sink_type",
3098            "sinkType",
3099            "owner",
3100            "properties",
3101            "definition",
3102            "connection_id",
3103            "connectionId",
3104            "initialized_at_epoch",
3105            "initializedAtEpoch",
3106            "created_at_epoch",
3107            "createdAtEpoch",
3108            "db_name",
3109            "dbName",
3110            "sink_from_name",
3111            "sinkFromName",
3112            "stream_job_status",
3113            "streamJobStatus",
3114            "format_desc",
3115            "formatDesc",
3116            "target_table",
3117            "targetTable",
3118            "initialized_at_cluster_version",
3119            "initializedAtClusterVersion",
3120            "created_at_cluster_version",
3121            "createdAtClusterVersion",
3122            "create_type",
3123            "createType",
3124            "secret_refs",
3125            "secretRefs",
3126            "original_target_columns",
3127            "originalTargetColumns",
3128        ];
3129
3130        #[allow(clippy::enum_variant_names)]
3131        enum GeneratedField {
3132            Id,
3133            SchemaId,
3134            DatabaseId,
3135            Name,
3136            Columns,
3137            PlanPk,
3138            DependentRelations,
3139            DistributionKey,
3140            DownstreamPk,
3141            SinkType,
3142            Owner,
3143            Properties,
3144            Definition,
3145            ConnectionId,
3146            InitializedAtEpoch,
3147            CreatedAtEpoch,
3148            DbName,
3149            SinkFromName,
3150            StreamJobStatus,
3151            FormatDesc,
3152            TargetTable,
3153            InitializedAtClusterVersion,
3154            CreatedAtClusterVersion,
3155            CreateType,
3156            SecretRefs,
3157            OriginalTargetColumns,
3158        }
3159        impl<'de> serde::Deserialize<'de> for GeneratedField {
3160            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
3161            where
3162                D: serde::Deserializer<'de>,
3163            {
3164                struct GeneratedVisitor;
3165
3166                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
3167                    type Value = GeneratedField;
3168
3169                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3170                        write!(formatter, "expected one of: {:?}", &FIELDS)
3171                    }
3172
3173                    #[allow(unused_variables)]
3174                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
3175                    where
3176                        E: serde::de::Error,
3177                    {
3178                        match value {
3179                            "id" => Ok(GeneratedField::Id),
3180                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
3181                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
3182                            "name" => Ok(GeneratedField::Name),
3183                            "columns" => Ok(GeneratedField::Columns),
3184                            "planPk" | "plan_pk" => Ok(GeneratedField::PlanPk),
3185                            "dependentRelations" | "dependent_relations" => Ok(GeneratedField::DependentRelations),
3186                            "distributionKey" | "distribution_key" => Ok(GeneratedField::DistributionKey),
3187                            "downstreamPk" | "downstream_pk" => Ok(GeneratedField::DownstreamPk),
3188                            "sinkType" | "sink_type" => Ok(GeneratedField::SinkType),
3189                            "owner" => Ok(GeneratedField::Owner),
3190                            "properties" => Ok(GeneratedField::Properties),
3191                            "definition" => Ok(GeneratedField::Definition),
3192                            "connectionId" | "connection_id" => Ok(GeneratedField::ConnectionId),
3193                            "initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
3194                            "createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
3195                            "dbName" | "db_name" => Ok(GeneratedField::DbName),
3196                            "sinkFromName" | "sink_from_name" => Ok(GeneratedField::SinkFromName),
3197                            "streamJobStatus" | "stream_job_status" => Ok(GeneratedField::StreamJobStatus),
3198                            "formatDesc" | "format_desc" => Ok(GeneratedField::FormatDesc),
3199                            "targetTable" | "target_table" => Ok(GeneratedField::TargetTable),
3200                            "initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
3201                            "createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
3202                            "createType" | "create_type" => Ok(GeneratedField::CreateType),
3203                            "secretRefs" | "secret_refs" => Ok(GeneratedField::SecretRefs),
3204                            "originalTargetColumns" | "original_target_columns" => Ok(GeneratedField::OriginalTargetColumns),
3205                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
3206                        }
3207                    }
3208                }
3209                deserializer.deserialize_identifier(GeneratedVisitor)
3210            }
3211        }
3212        struct GeneratedVisitor;
3213        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
3214            type Value = Sink;
3215
3216            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3217                formatter.write_str("struct catalog.Sink")
3218            }
3219
3220            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Sink, V::Error>
3221                where
3222                    V: serde::de::MapAccess<'de>,
3223            {
3224                let mut id__ = None;
3225                let mut schema_id__ = None;
3226                let mut database_id__ = None;
3227                let mut name__ = None;
3228                let mut columns__ = None;
3229                let mut plan_pk__ = None;
3230                let mut dependent_relations__ = None;
3231                let mut distribution_key__ = None;
3232                let mut downstream_pk__ = None;
3233                let mut sink_type__ = None;
3234                let mut owner__ = None;
3235                let mut properties__ = None;
3236                let mut definition__ = None;
3237                let mut connection_id__ = None;
3238                let mut initialized_at_epoch__ = None;
3239                let mut created_at_epoch__ = None;
3240                let mut db_name__ = None;
3241                let mut sink_from_name__ = None;
3242                let mut stream_job_status__ = None;
3243                let mut format_desc__ = None;
3244                let mut target_table__ = None;
3245                let mut initialized_at_cluster_version__ = None;
3246                let mut created_at_cluster_version__ = None;
3247                let mut create_type__ = None;
3248                let mut secret_refs__ = None;
3249                let mut original_target_columns__ = None;
3250                while let Some(k) = map_.next_key()? {
3251                    match k {
3252                        GeneratedField::Id => {
3253                            if id__.is_some() {
3254                                return Err(serde::de::Error::duplicate_field("id"));
3255                            }
3256                            id__ = 
3257                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
3258                            ;
3259                        }
3260                        GeneratedField::SchemaId => {
3261                            if schema_id__.is_some() {
3262                                return Err(serde::de::Error::duplicate_field("schemaId"));
3263                            }
3264                            schema_id__ = 
3265                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
3266                            ;
3267                        }
3268                        GeneratedField::DatabaseId => {
3269                            if database_id__.is_some() {
3270                                return Err(serde::de::Error::duplicate_field("databaseId"));
3271                            }
3272                            database_id__ = 
3273                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
3274                            ;
3275                        }
3276                        GeneratedField::Name => {
3277                            if name__.is_some() {
3278                                return Err(serde::de::Error::duplicate_field("name"));
3279                            }
3280                            name__ = Some(map_.next_value()?);
3281                        }
3282                        GeneratedField::Columns => {
3283                            if columns__.is_some() {
3284                                return Err(serde::de::Error::duplicate_field("columns"));
3285                            }
3286                            columns__ = Some(map_.next_value()?);
3287                        }
3288                        GeneratedField::PlanPk => {
3289                            if plan_pk__.is_some() {
3290                                return Err(serde::de::Error::duplicate_field("planPk"));
3291                            }
3292                            plan_pk__ = Some(map_.next_value()?);
3293                        }
3294                        GeneratedField::DependentRelations => {
3295                            if dependent_relations__.is_some() {
3296                                return Err(serde::de::Error::duplicate_field("dependentRelations"));
3297                            }
3298                            dependent_relations__ = 
3299                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
3300                                    .into_iter().map(|x| x.0).collect())
3301                            ;
3302                        }
3303                        GeneratedField::DistributionKey => {
3304                            if distribution_key__.is_some() {
3305                                return Err(serde::de::Error::duplicate_field("distributionKey"));
3306                            }
3307                            distribution_key__ = 
3308                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
3309                                    .into_iter().map(|x| x.0).collect())
3310                            ;
3311                        }
3312                        GeneratedField::DownstreamPk => {
3313                            if downstream_pk__.is_some() {
3314                                return Err(serde::de::Error::duplicate_field("downstreamPk"));
3315                            }
3316                            downstream_pk__ = 
3317                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
3318                                    .into_iter().map(|x| x.0).collect())
3319                            ;
3320                        }
3321                        GeneratedField::SinkType => {
3322                            if sink_type__.is_some() {
3323                                return Err(serde::de::Error::duplicate_field("sinkType"));
3324                            }
3325                            sink_type__ = Some(map_.next_value::<SinkType>()? as i32);
3326                        }
3327                        GeneratedField::Owner => {
3328                            if owner__.is_some() {
3329                                return Err(serde::de::Error::duplicate_field("owner"));
3330                            }
3331                            owner__ = 
3332                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
3333                            ;
3334                        }
3335                        GeneratedField::Properties => {
3336                            if properties__.is_some() {
3337                                return Err(serde::de::Error::duplicate_field("properties"));
3338                            }
3339                            properties__ = Some(
3340                                map_.next_value::<std::collections::BTreeMap<_, _>>()?
3341                            );
3342                        }
3343                        GeneratedField::Definition => {
3344                            if definition__.is_some() {
3345                                return Err(serde::de::Error::duplicate_field("definition"));
3346                            }
3347                            definition__ = Some(map_.next_value()?);
3348                        }
3349                        GeneratedField::ConnectionId => {
3350                            if connection_id__.is_some() {
3351                                return Err(serde::de::Error::duplicate_field("connectionId"));
3352                            }
3353                            connection_id__ = 
3354                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
3355                            ;
3356                        }
3357                        GeneratedField::InitializedAtEpoch => {
3358                            if initialized_at_epoch__.is_some() {
3359                                return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
3360                            }
3361                            initialized_at_epoch__ = 
3362                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
3363                            ;
3364                        }
3365                        GeneratedField::CreatedAtEpoch => {
3366                            if created_at_epoch__.is_some() {
3367                                return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
3368                            }
3369                            created_at_epoch__ = 
3370                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
3371                            ;
3372                        }
3373                        GeneratedField::DbName => {
3374                            if db_name__.is_some() {
3375                                return Err(serde::de::Error::duplicate_field("dbName"));
3376                            }
3377                            db_name__ = Some(map_.next_value()?);
3378                        }
3379                        GeneratedField::SinkFromName => {
3380                            if sink_from_name__.is_some() {
3381                                return Err(serde::de::Error::duplicate_field("sinkFromName"));
3382                            }
3383                            sink_from_name__ = Some(map_.next_value()?);
3384                        }
3385                        GeneratedField::StreamJobStatus => {
3386                            if stream_job_status__.is_some() {
3387                                return Err(serde::de::Error::duplicate_field("streamJobStatus"));
3388                            }
3389                            stream_job_status__ = Some(map_.next_value::<StreamJobStatus>()? as i32);
3390                        }
3391                        GeneratedField::FormatDesc => {
3392                            if format_desc__.is_some() {
3393                                return Err(serde::de::Error::duplicate_field("formatDesc"));
3394                            }
3395                            format_desc__ = map_.next_value()?;
3396                        }
3397                        GeneratedField::TargetTable => {
3398                            if target_table__.is_some() {
3399                                return Err(serde::de::Error::duplicate_field("targetTable"));
3400                            }
3401                            target_table__ = 
3402                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
3403                            ;
3404                        }
3405                        GeneratedField::InitializedAtClusterVersion => {
3406                            if initialized_at_cluster_version__.is_some() {
3407                                return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
3408                            }
3409                            initialized_at_cluster_version__ = map_.next_value()?;
3410                        }
3411                        GeneratedField::CreatedAtClusterVersion => {
3412                            if created_at_cluster_version__.is_some() {
3413                                return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
3414                            }
3415                            created_at_cluster_version__ = map_.next_value()?;
3416                        }
3417                        GeneratedField::CreateType => {
3418                            if create_type__.is_some() {
3419                                return Err(serde::de::Error::duplicate_field("createType"));
3420                            }
3421                            create_type__ = Some(map_.next_value::<CreateType>()? as i32);
3422                        }
3423                        GeneratedField::SecretRefs => {
3424                            if secret_refs__.is_some() {
3425                                return Err(serde::de::Error::duplicate_field("secretRefs"));
3426                            }
3427                            secret_refs__ = Some(
3428                                map_.next_value::<std::collections::BTreeMap<_, _>>()?
3429                            );
3430                        }
3431                        GeneratedField::OriginalTargetColumns => {
3432                            if original_target_columns__.is_some() {
3433                                return Err(serde::de::Error::duplicate_field("originalTargetColumns"));
3434                            }
3435                            original_target_columns__ = Some(map_.next_value()?);
3436                        }
3437                    }
3438                }
3439                Ok(Sink {
3440                    id: id__.unwrap_or_default(),
3441                    schema_id: schema_id__.unwrap_or_default(),
3442                    database_id: database_id__.unwrap_or_default(),
3443                    name: name__.unwrap_or_default(),
3444                    columns: columns__.unwrap_or_default(),
3445                    plan_pk: plan_pk__.unwrap_or_default(),
3446                    dependent_relations: dependent_relations__.unwrap_or_default(),
3447                    distribution_key: distribution_key__.unwrap_or_default(),
3448                    downstream_pk: downstream_pk__.unwrap_or_default(),
3449                    sink_type: sink_type__.unwrap_or_default(),
3450                    owner: owner__.unwrap_or_default(),
3451                    properties: properties__.unwrap_or_default(),
3452                    definition: definition__.unwrap_or_default(),
3453                    connection_id: connection_id__,
3454                    initialized_at_epoch: initialized_at_epoch__,
3455                    created_at_epoch: created_at_epoch__,
3456                    db_name: db_name__.unwrap_or_default(),
3457                    sink_from_name: sink_from_name__.unwrap_or_default(),
3458                    stream_job_status: stream_job_status__.unwrap_or_default(),
3459                    format_desc: format_desc__,
3460                    target_table: target_table__,
3461                    initialized_at_cluster_version: initialized_at_cluster_version__,
3462                    created_at_cluster_version: created_at_cluster_version__,
3463                    create_type: create_type__.unwrap_or_default(),
3464                    secret_refs: secret_refs__.unwrap_or_default(),
3465                    original_target_columns: original_target_columns__.unwrap_or_default(),
3466                })
3467            }
3468        }
3469        deserializer.deserialize_struct("catalog.Sink", FIELDS, GeneratedVisitor)
3470    }
3471}
3472impl serde::Serialize for SinkFormatDesc {
3473    #[allow(deprecated)]
3474    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3475    where
3476        S: serde::Serializer,
3477    {
3478        use serde::ser::SerializeStruct;
3479        let mut len = 0;
3480        if self.format != 0 {
3481            len += 1;
3482        }
3483        if self.encode != 0 {
3484            len += 1;
3485        }
3486        if !self.options.is_empty() {
3487            len += 1;
3488        }
3489        if self.key_encode.is_some() {
3490            len += 1;
3491        }
3492        if !self.secret_refs.is_empty() {
3493            len += 1;
3494        }
3495        if self.connection_id.is_some() {
3496            len += 1;
3497        }
3498        let mut struct_ser = serializer.serialize_struct("catalog.SinkFormatDesc", len)?;
3499        if self.format != 0 {
3500            let v = super::plan_common::FormatType::try_from(self.format)
3501                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.format)))?;
3502            struct_ser.serialize_field("format", &v)?;
3503        }
3504        if self.encode != 0 {
3505            let v = super::plan_common::EncodeType::try_from(self.encode)
3506                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.encode)))?;
3507            struct_ser.serialize_field("encode", &v)?;
3508        }
3509        if !self.options.is_empty() {
3510            struct_ser.serialize_field("options", &self.options)?;
3511        }
3512        if let Some(v) = self.key_encode.as_ref() {
3513            let v = super::plan_common::EncodeType::try_from(*v)
3514                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
3515            struct_ser.serialize_field("keyEncode", &v)?;
3516        }
3517        if !self.secret_refs.is_empty() {
3518            struct_ser.serialize_field("secretRefs", &self.secret_refs)?;
3519        }
3520        if let Some(v) = self.connection_id.as_ref() {
3521            struct_ser.serialize_field("connectionId", v)?;
3522        }
3523        struct_ser.end()
3524    }
3525}
3526impl<'de> serde::Deserialize<'de> for SinkFormatDesc {
3527    #[allow(deprecated)]
3528    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3529    where
3530        D: serde::Deserializer<'de>,
3531    {
3532        const FIELDS: &[&str] = &[
3533            "format",
3534            "encode",
3535            "options",
3536            "key_encode",
3537            "keyEncode",
3538            "secret_refs",
3539            "secretRefs",
3540            "connection_id",
3541            "connectionId",
3542        ];
3543
3544        #[allow(clippy::enum_variant_names)]
3545        enum GeneratedField {
3546            Format,
3547            Encode,
3548            Options,
3549            KeyEncode,
3550            SecretRefs,
3551            ConnectionId,
3552        }
3553        impl<'de> serde::Deserialize<'de> for GeneratedField {
3554            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
3555            where
3556                D: serde::Deserializer<'de>,
3557            {
3558                struct GeneratedVisitor;
3559
3560                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
3561                    type Value = GeneratedField;
3562
3563                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3564                        write!(formatter, "expected one of: {:?}", &FIELDS)
3565                    }
3566
3567                    #[allow(unused_variables)]
3568                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
3569                    where
3570                        E: serde::de::Error,
3571                    {
3572                        match value {
3573                            "format" => Ok(GeneratedField::Format),
3574                            "encode" => Ok(GeneratedField::Encode),
3575                            "options" => Ok(GeneratedField::Options),
3576                            "keyEncode" | "key_encode" => Ok(GeneratedField::KeyEncode),
3577                            "secretRefs" | "secret_refs" => Ok(GeneratedField::SecretRefs),
3578                            "connectionId" | "connection_id" => Ok(GeneratedField::ConnectionId),
3579                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
3580                        }
3581                    }
3582                }
3583                deserializer.deserialize_identifier(GeneratedVisitor)
3584            }
3585        }
3586        struct GeneratedVisitor;
3587        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
3588            type Value = SinkFormatDesc;
3589
3590            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3591                formatter.write_str("struct catalog.SinkFormatDesc")
3592            }
3593
3594            fn visit_map<V>(self, mut map_: V) -> std::result::Result<SinkFormatDesc, V::Error>
3595                where
3596                    V: serde::de::MapAccess<'de>,
3597            {
3598                let mut format__ = None;
3599                let mut encode__ = None;
3600                let mut options__ = None;
3601                let mut key_encode__ = None;
3602                let mut secret_refs__ = None;
3603                let mut connection_id__ = None;
3604                while let Some(k) = map_.next_key()? {
3605                    match k {
3606                        GeneratedField::Format => {
3607                            if format__.is_some() {
3608                                return Err(serde::de::Error::duplicate_field("format"));
3609                            }
3610                            format__ = Some(map_.next_value::<super::plan_common::FormatType>()? as i32);
3611                        }
3612                        GeneratedField::Encode => {
3613                            if encode__.is_some() {
3614                                return Err(serde::de::Error::duplicate_field("encode"));
3615                            }
3616                            encode__ = Some(map_.next_value::<super::plan_common::EncodeType>()? as i32);
3617                        }
3618                        GeneratedField::Options => {
3619                            if options__.is_some() {
3620                                return Err(serde::de::Error::duplicate_field("options"));
3621                            }
3622                            options__ = Some(
3623                                map_.next_value::<std::collections::BTreeMap<_, _>>()?
3624                            );
3625                        }
3626                        GeneratedField::KeyEncode => {
3627                            if key_encode__.is_some() {
3628                                return Err(serde::de::Error::duplicate_field("keyEncode"));
3629                            }
3630                            key_encode__ = map_.next_value::<::std::option::Option<super::plan_common::EncodeType>>()?.map(|x| x as i32);
3631                        }
3632                        GeneratedField::SecretRefs => {
3633                            if secret_refs__.is_some() {
3634                                return Err(serde::de::Error::duplicate_field("secretRefs"));
3635                            }
3636                            secret_refs__ = Some(
3637                                map_.next_value::<std::collections::BTreeMap<_, _>>()?
3638                            );
3639                        }
3640                        GeneratedField::ConnectionId => {
3641                            if connection_id__.is_some() {
3642                                return Err(serde::de::Error::duplicate_field("connectionId"));
3643                            }
3644                            connection_id__ = 
3645                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
3646                            ;
3647                        }
3648                    }
3649                }
3650                Ok(SinkFormatDesc {
3651                    format: format__.unwrap_or_default(),
3652                    encode: encode__.unwrap_or_default(),
3653                    options: options__.unwrap_or_default(),
3654                    key_encode: key_encode__,
3655                    secret_refs: secret_refs__.unwrap_or_default(),
3656                    connection_id: connection_id__,
3657                })
3658            }
3659        }
3660        deserializer.deserialize_struct("catalog.SinkFormatDesc", FIELDS, GeneratedVisitor)
3661    }
3662}
3663impl serde::Serialize for SinkType {
3664    #[allow(deprecated)]
3665    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3666    where
3667        S: serde::Serializer,
3668    {
3669        let variant = match self {
3670            Self::Unspecified => "SINK_TYPE_UNSPECIFIED",
3671            Self::AppendOnly => "SINK_TYPE_APPEND_ONLY",
3672            Self::ForceAppendOnly => "SINK_TYPE_FORCE_APPEND_ONLY",
3673            Self::Upsert => "SINK_TYPE_UPSERT",
3674        };
3675        serializer.serialize_str(variant)
3676    }
3677}
3678impl<'de> serde::Deserialize<'de> for SinkType {
3679    #[allow(deprecated)]
3680    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3681    where
3682        D: serde::Deserializer<'de>,
3683    {
3684        const FIELDS: &[&str] = &[
3685            "SINK_TYPE_UNSPECIFIED",
3686            "SINK_TYPE_APPEND_ONLY",
3687            "SINK_TYPE_FORCE_APPEND_ONLY",
3688            "SINK_TYPE_UPSERT",
3689        ];
3690
3691        struct GeneratedVisitor;
3692
3693        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
3694            type Value = SinkType;
3695
3696            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3697                write!(formatter, "expected one of: {:?}", &FIELDS)
3698            }
3699
3700            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
3701            where
3702                E: serde::de::Error,
3703            {
3704                i32::try_from(v)
3705                    .ok()
3706                    .and_then(|x| x.try_into().ok())
3707                    .ok_or_else(|| {
3708                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
3709                    })
3710            }
3711
3712            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
3713            where
3714                E: serde::de::Error,
3715            {
3716                i32::try_from(v)
3717                    .ok()
3718                    .and_then(|x| x.try_into().ok())
3719                    .ok_or_else(|| {
3720                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
3721                    })
3722            }
3723
3724            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3725            where
3726                E: serde::de::Error,
3727            {
3728                match value {
3729                    "SINK_TYPE_UNSPECIFIED" => Ok(SinkType::Unspecified),
3730                    "SINK_TYPE_APPEND_ONLY" => Ok(SinkType::AppendOnly),
3731                    "SINK_TYPE_FORCE_APPEND_ONLY" => Ok(SinkType::ForceAppendOnly),
3732                    "SINK_TYPE_UPSERT" => Ok(SinkType::Upsert),
3733                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
3734                }
3735            }
3736        }
3737        deserializer.deserialize_any(GeneratedVisitor)
3738    }
3739}
3740impl serde::Serialize for Source {
3741    #[allow(deprecated)]
3742    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3743    where
3744        S: serde::Serializer,
3745    {
3746        use serde::ser::SerializeStruct;
3747        let mut len = 0;
3748        if self.id != 0 {
3749            len += 1;
3750        }
3751        if self.schema_id != 0 {
3752            len += 1;
3753        }
3754        if self.database_id != 0 {
3755            len += 1;
3756        }
3757        if !self.name.is_empty() {
3758            len += 1;
3759        }
3760        if self.row_id_index.is_some() {
3761            len += 1;
3762        }
3763        if !self.columns.is_empty() {
3764            len += 1;
3765        }
3766        if !self.pk_column_ids.is_empty() {
3767            len += 1;
3768        }
3769        if !self.with_properties.is_empty() {
3770            len += 1;
3771        }
3772        if self.owner != 0 {
3773            len += 1;
3774        }
3775        if self.info.is_some() {
3776            len += 1;
3777        }
3778        if !self.watermark_descs.is_empty() {
3779            len += 1;
3780        }
3781        if !self.definition.is_empty() {
3782            len += 1;
3783        }
3784        if self.connection_id.is_some() {
3785            len += 1;
3786        }
3787        if self.initialized_at_epoch.is_some() {
3788            len += 1;
3789        }
3790        if self.created_at_epoch.is_some() {
3791            len += 1;
3792        }
3793        if self.initialized_at_cluster_version.is_some() {
3794            len += 1;
3795        }
3796        if self.created_at_cluster_version.is_some() {
3797            len += 1;
3798        }
3799        if !self.secret_refs.is_empty() {
3800            len += 1;
3801        }
3802        if self.version != 0 {
3803            len += 1;
3804        }
3805        if self.rate_limit.is_some() {
3806            len += 1;
3807        }
3808        if self.optional_associated_table_id.is_some() {
3809            len += 1;
3810        }
3811        let mut struct_ser = serializer.serialize_struct("catalog.Source", len)?;
3812        if self.id != 0 {
3813            struct_ser.serialize_field("id", &self.id)?;
3814        }
3815        if self.schema_id != 0 {
3816            struct_ser.serialize_field("schemaId", &self.schema_id)?;
3817        }
3818        if self.database_id != 0 {
3819            struct_ser.serialize_field("databaseId", &self.database_id)?;
3820        }
3821        if !self.name.is_empty() {
3822            struct_ser.serialize_field("name", &self.name)?;
3823        }
3824        if let Some(v) = self.row_id_index.as_ref() {
3825            struct_ser.serialize_field("rowIdIndex", v)?;
3826        }
3827        if !self.columns.is_empty() {
3828            struct_ser.serialize_field("columns", &self.columns)?;
3829        }
3830        if !self.pk_column_ids.is_empty() {
3831            struct_ser.serialize_field("pkColumnIds", &self.pk_column_ids)?;
3832        }
3833        if !self.with_properties.is_empty() {
3834            struct_ser.serialize_field("withProperties", &self.with_properties)?;
3835        }
3836        if self.owner != 0 {
3837            struct_ser.serialize_field("owner", &self.owner)?;
3838        }
3839        if let Some(v) = self.info.as_ref() {
3840            struct_ser.serialize_field("info", v)?;
3841        }
3842        if !self.watermark_descs.is_empty() {
3843            struct_ser.serialize_field("watermarkDescs", &self.watermark_descs)?;
3844        }
3845        if !self.definition.is_empty() {
3846            struct_ser.serialize_field("definition", &self.definition)?;
3847        }
3848        if let Some(v) = self.connection_id.as_ref() {
3849            struct_ser.serialize_field("connectionId", v)?;
3850        }
3851        if let Some(v) = self.initialized_at_epoch.as_ref() {
3852            #[allow(clippy::needless_borrow)]
3853            #[allow(clippy::needless_borrows_for_generic_args)]
3854            struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
3855        }
3856        if let Some(v) = self.created_at_epoch.as_ref() {
3857            #[allow(clippy::needless_borrow)]
3858            #[allow(clippy::needless_borrows_for_generic_args)]
3859            struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
3860        }
3861        if let Some(v) = self.initialized_at_cluster_version.as_ref() {
3862            struct_ser.serialize_field("initializedAtClusterVersion", v)?;
3863        }
3864        if let Some(v) = self.created_at_cluster_version.as_ref() {
3865            struct_ser.serialize_field("createdAtClusterVersion", v)?;
3866        }
3867        if !self.secret_refs.is_empty() {
3868            struct_ser.serialize_field("secretRefs", &self.secret_refs)?;
3869        }
3870        if self.version != 0 {
3871            #[allow(clippy::needless_borrow)]
3872            #[allow(clippy::needless_borrows_for_generic_args)]
3873            struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
3874        }
3875        if let Some(v) = self.rate_limit.as_ref() {
3876            struct_ser.serialize_field("rateLimit", v)?;
3877        }
3878        if let Some(v) = self.optional_associated_table_id.as_ref() {
3879            match v {
3880                source::OptionalAssociatedTableId::AssociatedTableId(v) => {
3881                    struct_ser.serialize_field("associatedTableId", v)?;
3882                }
3883            }
3884        }
3885        struct_ser.end()
3886    }
3887}
3888impl<'de> serde::Deserialize<'de> for Source {
3889    #[allow(deprecated)]
3890    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3891    where
3892        D: serde::Deserializer<'de>,
3893    {
3894        const FIELDS: &[&str] = &[
3895            "id",
3896            "schema_id",
3897            "schemaId",
3898            "database_id",
3899            "databaseId",
3900            "name",
3901            "row_id_index",
3902            "rowIdIndex",
3903            "columns",
3904            "pk_column_ids",
3905            "pkColumnIds",
3906            "with_properties",
3907            "withProperties",
3908            "owner",
3909            "info",
3910            "watermark_descs",
3911            "watermarkDescs",
3912            "definition",
3913            "connection_id",
3914            "connectionId",
3915            "initialized_at_epoch",
3916            "initializedAtEpoch",
3917            "created_at_epoch",
3918            "createdAtEpoch",
3919            "initialized_at_cluster_version",
3920            "initializedAtClusterVersion",
3921            "created_at_cluster_version",
3922            "createdAtClusterVersion",
3923            "secret_refs",
3924            "secretRefs",
3925            "version",
3926            "rate_limit",
3927            "rateLimit",
3928            "associated_table_id",
3929            "associatedTableId",
3930        ];
3931
3932        #[allow(clippy::enum_variant_names)]
3933        enum GeneratedField {
3934            Id,
3935            SchemaId,
3936            DatabaseId,
3937            Name,
3938            RowIdIndex,
3939            Columns,
3940            PkColumnIds,
3941            WithProperties,
3942            Owner,
3943            Info,
3944            WatermarkDescs,
3945            Definition,
3946            ConnectionId,
3947            InitializedAtEpoch,
3948            CreatedAtEpoch,
3949            InitializedAtClusterVersion,
3950            CreatedAtClusterVersion,
3951            SecretRefs,
3952            Version,
3953            RateLimit,
3954            AssociatedTableId,
3955        }
3956        impl<'de> serde::Deserialize<'de> for GeneratedField {
3957            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
3958            where
3959                D: serde::Deserializer<'de>,
3960            {
3961                struct GeneratedVisitor;
3962
3963                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
3964                    type Value = GeneratedField;
3965
3966                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3967                        write!(formatter, "expected one of: {:?}", &FIELDS)
3968                    }
3969
3970                    #[allow(unused_variables)]
3971                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
3972                    where
3973                        E: serde::de::Error,
3974                    {
3975                        match value {
3976                            "id" => Ok(GeneratedField::Id),
3977                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
3978                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
3979                            "name" => Ok(GeneratedField::Name),
3980                            "rowIdIndex" | "row_id_index" => Ok(GeneratedField::RowIdIndex),
3981                            "columns" => Ok(GeneratedField::Columns),
3982                            "pkColumnIds" | "pk_column_ids" => Ok(GeneratedField::PkColumnIds),
3983                            "withProperties" | "with_properties" => Ok(GeneratedField::WithProperties),
3984                            "owner" => Ok(GeneratedField::Owner),
3985                            "info" => Ok(GeneratedField::Info),
3986                            "watermarkDescs" | "watermark_descs" => Ok(GeneratedField::WatermarkDescs),
3987                            "definition" => Ok(GeneratedField::Definition),
3988                            "connectionId" | "connection_id" => Ok(GeneratedField::ConnectionId),
3989                            "initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
3990                            "createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
3991                            "initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
3992                            "createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
3993                            "secretRefs" | "secret_refs" => Ok(GeneratedField::SecretRefs),
3994                            "version" => Ok(GeneratedField::Version),
3995                            "rateLimit" | "rate_limit" => Ok(GeneratedField::RateLimit),
3996                            "associatedTableId" | "associated_table_id" => Ok(GeneratedField::AssociatedTableId),
3997                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
3998                        }
3999                    }
4000                }
4001                deserializer.deserialize_identifier(GeneratedVisitor)
4002            }
4003        }
4004        struct GeneratedVisitor;
4005        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
4006            type Value = Source;
4007
4008            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4009                formatter.write_str("struct catalog.Source")
4010            }
4011
4012            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Source, V::Error>
4013                where
4014                    V: serde::de::MapAccess<'de>,
4015            {
4016                let mut id__ = None;
4017                let mut schema_id__ = None;
4018                let mut database_id__ = None;
4019                let mut name__ = None;
4020                let mut row_id_index__ = None;
4021                let mut columns__ = None;
4022                let mut pk_column_ids__ = None;
4023                let mut with_properties__ = None;
4024                let mut owner__ = None;
4025                let mut info__ = None;
4026                let mut watermark_descs__ = None;
4027                let mut definition__ = None;
4028                let mut connection_id__ = None;
4029                let mut initialized_at_epoch__ = None;
4030                let mut created_at_epoch__ = None;
4031                let mut initialized_at_cluster_version__ = None;
4032                let mut created_at_cluster_version__ = None;
4033                let mut secret_refs__ = None;
4034                let mut version__ = None;
4035                let mut rate_limit__ = None;
4036                let mut optional_associated_table_id__ = None;
4037                while let Some(k) = map_.next_key()? {
4038                    match k {
4039                        GeneratedField::Id => {
4040                            if id__.is_some() {
4041                                return Err(serde::de::Error::duplicate_field("id"));
4042                            }
4043                            id__ = 
4044                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4045                            ;
4046                        }
4047                        GeneratedField::SchemaId => {
4048                            if schema_id__.is_some() {
4049                                return Err(serde::de::Error::duplicate_field("schemaId"));
4050                            }
4051                            schema_id__ = 
4052                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4053                            ;
4054                        }
4055                        GeneratedField::DatabaseId => {
4056                            if database_id__.is_some() {
4057                                return Err(serde::de::Error::duplicate_field("databaseId"));
4058                            }
4059                            database_id__ = 
4060                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4061                            ;
4062                        }
4063                        GeneratedField::Name => {
4064                            if name__.is_some() {
4065                                return Err(serde::de::Error::duplicate_field("name"));
4066                            }
4067                            name__ = Some(map_.next_value()?);
4068                        }
4069                        GeneratedField::RowIdIndex => {
4070                            if row_id_index__.is_some() {
4071                                return Err(serde::de::Error::duplicate_field("rowIdIndex"));
4072                            }
4073                            row_id_index__ = 
4074                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
4075                            ;
4076                        }
4077                        GeneratedField::Columns => {
4078                            if columns__.is_some() {
4079                                return Err(serde::de::Error::duplicate_field("columns"));
4080                            }
4081                            columns__ = Some(map_.next_value()?);
4082                        }
4083                        GeneratedField::PkColumnIds => {
4084                            if pk_column_ids__.is_some() {
4085                                return Err(serde::de::Error::duplicate_field("pkColumnIds"));
4086                            }
4087                            pk_column_ids__ = 
4088                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
4089                                    .into_iter().map(|x| x.0).collect())
4090                            ;
4091                        }
4092                        GeneratedField::WithProperties => {
4093                            if with_properties__.is_some() {
4094                                return Err(serde::de::Error::duplicate_field("withProperties"));
4095                            }
4096                            with_properties__ = Some(
4097                                map_.next_value::<std::collections::BTreeMap<_, _>>()?
4098                            );
4099                        }
4100                        GeneratedField::Owner => {
4101                            if owner__.is_some() {
4102                                return Err(serde::de::Error::duplicate_field("owner"));
4103                            }
4104                            owner__ = 
4105                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4106                            ;
4107                        }
4108                        GeneratedField::Info => {
4109                            if info__.is_some() {
4110                                return Err(serde::de::Error::duplicate_field("info"));
4111                            }
4112                            info__ = map_.next_value()?;
4113                        }
4114                        GeneratedField::WatermarkDescs => {
4115                            if watermark_descs__.is_some() {
4116                                return Err(serde::de::Error::duplicate_field("watermarkDescs"));
4117                            }
4118                            watermark_descs__ = Some(map_.next_value()?);
4119                        }
4120                        GeneratedField::Definition => {
4121                            if definition__.is_some() {
4122                                return Err(serde::de::Error::duplicate_field("definition"));
4123                            }
4124                            definition__ = Some(map_.next_value()?);
4125                        }
4126                        GeneratedField::ConnectionId => {
4127                            if connection_id__.is_some() {
4128                                return Err(serde::de::Error::duplicate_field("connectionId"));
4129                            }
4130                            connection_id__ = 
4131                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
4132                            ;
4133                        }
4134                        GeneratedField::InitializedAtEpoch => {
4135                            if initialized_at_epoch__.is_some() {
4136                                return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
4137                            }
4138                            initialized_at_epoch__ = 
4139                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
4140                            ;
4141                        }
4142                        GeneratedField::CreatedAtEpoch => {
4143                            if created_at_epoch__.is_some() {
4144                                return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
4145                            }
4146                            created_at_epoch__ = 
4147                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
4148                            ;
4149                        }
4150                        GeneratedField::InitializedAtClusterVersion => {
4151                            if initialized_at_cluster_version__.is_some() {
4152                                return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
4153                            }
4154                            initialized_at_cluster_version__ = map_.next_value()?;
4155                        }
4156                        GeneratedField::CreatedAtClusterVersion => {
4157                            if created_at_cluster_version__.is_some() {
4158                                return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
4159                            }
4160                            created_at_cluster_version__ = map_.next_value()?;
4161                        }
4162                        GeneratedField::SecretRefs => {
4163                            if secret_refs__.is_some() {
4164                                return Err(serde::de::Error::duplicate_field("secretRefs"));
4165                            }
4166                            secret_refs__ = Some(
4167                                map_.next_value::<std::collections::BTreeMap<_, _>>()?
4168                            );
4169                        }
4170                        GeneratedField::Version => {
4171                            if version__.is_some() {
4172                                return Err(serde::de::Error::duplicate_field("version"));
4173                            }
4174                            version__ = 
4175                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4176                            ;
4177                        }
4178                        GeneratedField::RateLimit => {
4179                            if rate_limit__.is_some() {
4180                                return Err(serde::de::Error::duplicate_field("rateLimit"));
4181                            }
4182                            rate_limit__ = 
4183                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
4184                            ;
4185                        }
4186                        GeneratedField::AssociatedTableId => {
4187                            if optional_associated_table_id__.is_some() {
4188                                return Err(serde::de::Error::duplicate_field("associatedTableId"));
4189                            }
4190                            optional_associated_table_id__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| source::OptionalAssociatedTableId::AssociatedTableId(x.0));
4191                        }
4192                    }
4193                }
4194                Ok(Source {
4195                    id: id__.unwrap_or_default(),
4196                    schema_id: schema_id__.unwrap_or_default(),
4197                    database_id: database_id__.unwrap_or_default(),
4198                    name: name__.unwrap_or_default(),
4199                    row_id_index: row_id_index__,
4200                    columns: columns__.unwrap_or_default(),
4201                    pk_column_ids: pk_column_ids__.unwrap_or_default(),
4202                    with_properties: with_properties__.unwrap_or_default(),
4203                    owner: owner__.unwrap_or_default(),
4204                    info: info__,
4205                    watermark_descs: watermark_descs__.unwrap_or_default(),
4206                    definition: definition__.unwrap_or_default(),
4207                    connection_id: connection_id__,
4208                    initialized_at_epoch: initialized_at_epoch__,
4209                    created_at_epoch: created_at_epoch__,
4210                    initialized_at_cluster_version: initialized_at_cluster_version__,
4211                    created_at_cluster_version: created_at_cluster_version__,
4212                    secret_refs: secret_refs__.unwrap_or_default(),
4213                    version: version__.unwrap_or_default(),
4214                    rate_limit: rate_limit__,
4215                    optional_associated_table_id: optional_associated_table_id__,
4216                })
4217            }
4218        }
4219        deserializer.deserialize_struct("catalog.Source", FIELDS, GeneratedVisitor)
4220    }
4221}
4222impl serde::Serialize for StreamJobStatus {
4223    #[allow(deprecated)]
4224    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4225    where
4226        S: serde::Serializer,
4227    {
4228        let variant = match self {
4229            Self::Unspecified => "STREAM_JOB_STATUS_UNSPECIFIED",
4230            Self::Creating => "STREAM_JOB_STATUS_CREATING",
4231            Self::Created => "STREAM_JOB_STATUS_CREATED",
4232        };
4233        serializer.serialize_str(variant)
4234    }
4235}
4236impl<'de> serde::Deserialize<'de> for StreamJobStatus {
4237    #[allow(deprecated)]
4238    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4239    where
4240        D: serde::Deserializer<'de>,
4241    {
4242        const FIELDS: &[&str] = &[
4243            "STREAM_JOB_STATUS_UNSPECIFIED",
4244            "STREAM_JOB_STATUS_CREATING",
4245            "STREAM_JOB_STATUS_CREATED",
4246        ];
4247
4248        struct GeneratedVisitor;
4249
4250        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
4251            type Value = StreamJobStatus;
4252
4253            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4254                write!(formatter, "expected one of: {:?}", &FIELDS)
4255            }
4256
4257            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
4258            where
4259                E: serde::de::Error,
4260            {
4261                i32::try_from(v)
4262                    .ok()
4263                    .and_then(|x| x.try_into().ok())
4264                    .ok_or_else(|| {
4265                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
4266                    })
4267            }
4268
4269            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
4270            where
4271                E: serde::de::Error,
4272            {
4273                i32::try_from(v)
4274                    .ok()
4275                    .and_then(|x| x.try_into().ok())
4276                    .ok_or_else(|| {
4277                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
4278                    })
4279            }
4280
4281            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4282            where
4283                E: serde::de::Error,
4284            {
4285                match value {
4286                    "STREAM_JOB_STATUS_UNSPECIFIED" => Ok(StreamJobStatus::Unspecified),
4287                    "STREAM_JOB_STATUS_CREATING" => Ok(StreamJobStatus::Creating),
4288                    "STREAM_JOB_STATUS_CREATED" => Ok(StreamJobStatus::Created),
4289                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
4290                }
4291            }
4292        }
4293        deserializer.deserialize_any(GeneratedVisitor)
4294    }
4295}
4296impl serde::Serialize for StreamSourceInfo {
4297    #[allow(deprecated)]
4298    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4299    where
4300        S: serde::Serializer,
4301    {
4302        use serde::ser::SerializeStruct;
4303        let mut len = 0;
4304        if self.row_format != 0 {
4305            len += 1;
4306        }
4307        if !self.row_schema_location.is_empty() {
4308            len += 1;
4309        }
4310        if self.use_schema_registry {
4311            len += 1;
4312        }
4313        if !self.proto_message_name.is_empty() {
4314            len += 1;
4315        }
4316        if self.csv_delimiter != 0 {
4317            len += 1;
4318        }
4319        if self.csv_has_header {
4320            len += 1;
4321        }
4322        if self.format != 0 {
4323            len += 1;
4324        }
4325        if self.row_encode != 0 {
4326            len += 1;
4327        }
4328        if self.name_strategy != 0 {
4329            len += 1;
4330        }
4331        if self.key_message_name.is_some() {
4332            len += 1;
4333        }
4334        if self.external_table.is_some() {
4335            len += 1;
4336        }
4337        if self.cdc_source_job {
4338            len += 1;
4339        }
4340        if self.is_distributed {
4341            len += 1;
4342        }
4343        if !self.format_encode_options.is_empty() {
4344            len += 1;
4345        }
4346        if !self.format_encode_secret_refs.is_empty() {
4347            len += 1;
4348        }
4349        if self.connection_id.is_some() {
4350            len += 1;
4351        }
4352        let mut struct_ser = serializer.serialize_struct("catalog.StreamSourceInfo", len)?;
4353        if self.row_format != 0 {
4354            let v = super::plan_common::RowFormatType::try_from(self.row_format)
4355                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.row_format)))?;
4356            struct_ser.serialize_field("rowFormat", &v)?;
4357        }
4358        if !self.row_schema_location.is_empty() {
4359            struct_ser.serialize_field("rowSchemaLocation", &self.row_schema_location)?;
4360        }
4361        if self.use_schema_registry {
4362            struct_ser.serialize_field("useSchemaRegistry", &self.use_schema_registry)?;
4363        }
4364        if !self.proto_message_name.is_empty() {
4365            struct_ser.serialize_field("protoMessageName", &self.proto_message_name)?;
4366        }
4367        if self.csv_delimiter != 0 {
4368            struct_ser.serialize_field("csvDelimiter", &self.csv_delimiter)?;
4369        }
4370        if self.csv_has_header {
4371            struct_ser.serialize_field("csvHasHeader", &self.csv_has_header)?;
4372        }
4373        if self.format != 0 {
4374            let v = super::plan_common::FormatType::try_from(self.format)
4375                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.format)))?;
4376            struct_ser.serialize_field("format", &v)?;
4377        }
4378        if self.row_encode != 0 {
4379            let v = super::plan_common::EncodeType::try_from(self.row_encode)
4380                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.row_encode)))?;
4381            struct_ser.serialize_field("rowEncode", &v)?;
4382        }
4383        if self.name_strategy != 0 {
4384            let v = SchemaRegistryNameStrategy::try_from(self.name_strategy)
4385                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.name_strategy)))?;
4386            struct_ser.serialize_field("nameStrategy", &v)?;
4387        }
4388        if let Some(v) = self.key_message_name.as_ref() {
4389            struct_ser.serialize_field("keyMessageName", v)?;
4390        }
4391        if let Some(v) = self.external_table.as_ref() {
4392            struct_ser.serialize_field("externalTable", v)?;
4393        }
4394        if self.cdc_source_job {
4395            struct_ser.serialize_field("cdcSourceJob", &self.cdc_source_job)?;
4396        }
4397        if self.is_distributed {
4398            struct_ser.serialize_field("isDistributed", &self.is_distributed)?;
4399        }
4400        if !self.format_encode_options.is_empty() {
4401            struct_ser.serialize_field("formatEncodeOptions", &self.format_encode_options)?;
4402        }
4403        if !self.format_encode_secret_refs.is_empty() {
4404            struct_ser.serialize_field("formatEncodeSecretRefs", &self.format_encode_secret_refs)?;
4405        }
4406        if let Some(v) = self.connection_id.as_ref() {
4407            struct_ser.serialize_field("connectionId", v)?;
4408        }
4409        struct_ser.end()
4410    }
4411}
4412impl<'de> serde::Deserialize<'de> for StreamSourceInfo {
4413    #[allow(deprecated)]
4414    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4415    where
4416        D: serde::Deserializer<'de>,
4417    {
4418        const FIELDS: &[&str] = &[
4419            "row_format",
4420            "rowFormat",
4421            "row_schema_location",
4422            "rowSchemaLocation",
4423            "use_schema_registry",
4424            "useSchemaRegistry",
4425            "proto_message_name",
4426            "protoMessageName",
4427            "csv_delimiter",
4428            "csvDelimiter",
4429            "csv_has_header",
4430            "csvHasHeader",
4431            "format",
4432            "row_encode",
4433            "rowEncode",
4434            "name_strategy",
4435            "nameStrategy",
4436            "key_message_name",
4437            "keyMessageName",
4438            "external_table",
4439            "externalTable",
4440            "cdc_source_job",
4441            "cdcSourceJob",
4442            "is_distributed",
4443            "isDistributed",
4444            "format_encode_options",
4445            "formatEncodeOptions",
4446            "format_encode_secret_refs",
4447            "formatEncodeSecretRefs",
4448            "connection_id",
4449            "connectionId",
4450        ];
4451
4452        #[allow(clippy::enum_variant_names)]
4453        enum GeneratedField {
4454            RowFormat,
4455            RowSchemaLocation,
4456            UseSchemaRegistry,
4457            ProtoMessageName,
4458            CsvDelimiter,
4459            CsvHasHeader,
4460            Format,
4461            RowEncode,
4462            NameStrategy,
4463            KeyMessageName,
4464            ExternalTable,
4465            CdcSourceJob,
4466            IsDistributed,
4467            FormatEncodeOptions,
4468            FormatEncodeSecretRefs,
4469            ConnectionId,
4470        }
4471        impl<'de> serde::Deserialize<'de> for GeneratedField {
4472            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
4473            where
4474                D: serde::Deserializer<'de>,
4475            {
4476                struct GeneratedVisitor;
4477
4478                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
4479                    type Value = GeneratedField;
4480
4481                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4482                        write!(formatter, "expected one of: {:?}", &FIELDS)
4483                    }
4484
4485                    #[allow(unused_variables)]
4486                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
4487                    where
4488                        E: serde::de::Error,
4489                    {
4490                        match value {
4491                            "rowFormat" | "row_format" => Ok(GeneratedField::RowFormat),
4492                            "rowSchemaLocation" | "row_schema_location" => Ok(GeneratedField::RowSchemaLocation),
4493                            "useSchemaRegistry" | "use_schema_registry" => Ok(GeneratedField::UseSchemaRegistry),
4494                            "protoMessageName" | "proto_message_name" => Ok(GeneratedField::ProtoMessageName),
4495                            "csvDelimiter" | "csv_delimiter" => Ok(GeneratedField::CsvDelimiter),
4496                            "csvHasHeader" | "csv_has_header" => Ok(GeneratedField::CsvHasHeader),
4497                            "format" => Ok(GeneratedField::Format),
4498                            "rowEncode" | "row_encode" => Ok(GeneratedField::RowEncode),
4499                            "nameStrategy" | "name_strategy" => Ok(GeneratedField::NameStrategy),
4500                            "keyMessageName" | "key_message_name" => Ok(GeneratedField::KeyMessageName),
4501                            "externalTable" | "external_table" => Ok(GeneratedField::ExternalTable),
4502                            "cdcSourceJob" | "cdc_source_job" => Ok(GeneratedField::CdcSourceJob),
4503                            "isDistributed" | "is_distributed" => Ok(GeneratedField::IsDistributed),
4504                            "formatEncodeOptions" | "format_encode_options" => Ok(GeneratedField::FormatEncodeOptions),
4505                            "formatEncodeSecretRefs" | "format_encode_secret_refs" => Ok(GeneratedField::FormatEncodeSecretRefs),
4506                            "connectionId" | "connection_id" => Ok(GeneratedField::ConnectionId),
4507                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
4508                        }
4509                    }
4510                }
4511                deserializer.deserialize_identifier(GeneratedVisitor)
4512            }
4513        }
4514        struct GeneratedVisitor;
4515        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
4516            type Value = StreamSourceInfo;
4517
4518            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4519                formatter.write_str("struct catalog.StreamSourceInfo")
4520            }
4521
4522            fn visit_map<V>(self, mut map_: V) -> std::result::Result<StreamSourceInfo, V::Error>
4523                where
4524                    V: serde::de::MapAccess<'de>,
4525            {
4526                let mut row_format__ = None;
4527                let mut row_schema_location__ = None;
4528                let mut use_schema_registry__ = None;
4529                let mut proto_message_name__ = None;
4530                let mut csv_delimiter__ = None;
4531                let mut csv_has_header__ = None;
4532                let mut format__ = None;
4533                let mut row_encode__ = None;
4534                let mut name_strategy__ = None;
4535                let mut key_message_name__ = None;
4536                let mut external_table__ = None;
4537                let mut cdc_source_job__ = None;
4538                let mut is_distributed__ = None;
4539                let mut format_encode_options__ = None;
4540                let mut format_encode_secret_refs__ = None;
4541                let mut connection_id__ = None;
4542                while let Some(k) = map_.next_key()? {
4543                    match k {
4544                        GeneratedField::RowFormat => {
4545                            if row_format__.is_some() {
4546                                return Err(serde::de::Error::duplicate_field("rowFormat"));
4547                            }
4548                            row_format__ = Some(map_.next_value::<super::plan_common::RowFormatType>()? as i32);
4549                        }
4550                        GeneratedField::RowSchemaLocation => {
4551                            if row_schema_location__.is_some() {
4552                                return Err(serde::de::Error::duplicate_field("rowSchemaLocation"));
4553                            }
4554                            row_schema_location__ = Some(map_.next_value()?);
4555                        }
4556                        GeneratedField::UseSchemaRegistry => {
4557                            if use_schema_registry__.is_some() {
4558                                return Err(serde::de::Error::duplicate_field("useSchemaRegistry"));
4559                            }
4560                            use_schema_registry__ = Some(map_.next_value()?);
4561                        }
4562                        GeneratedField::ProtoMessageName => {
4563                            if proto_message_name__.is_some() {
4564                                return Err(serde::de::Error::duplicate_field("protoMessageName"));
4565                            }
4566                            proto_message_name__ = Some(map_.next_value()?);
4567                        }
4568                        GeneratedField::CsvDelimiter => {
4569                            if csv_delimiter__.is_some() {
4570                                return Err(serde::de::Error::duplicate_field("csvDelimiter"));
4571                            }
4572                            csv_delimiter__ = 
4573                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4574                            ;
4575                        }
4576                        GeneratedField::CsvHasHeader => {
4577                            if csv_has_header__.is_some() {
4578                                return Err(serde::de::Error::duplicate_field("csvHasHeader"));
4579                            }
4580                            csv_has_header__ = Some(map_.next_value()?);
4581                        }
4582                        GeneratedField::Format => {
4583                            if format__.is_some() {
4584                                return Err(serde::de::Error::duplicate_field("format"));
4585                            }
4586                            format__ = Some(map_.next_value::<super::plan_common::FormatType>()? as i32);
4587                        }
4588                        GeneratedField::RowEncode => {
4589                            if row_encode__.is_some() {
4590                                return Err(serde::de::Error::duplicate_field("rowEncode"));
4591                            }
4592                            row_encode__ = Some(map_.next_value::<super::plan_common::EncodeType>()? as i32);
4593                        }
4594                        GeneratedField::NameStrategy => {
4595                            if name_strategy__.is_some() {
4596                                return Err(serde::de::Error::duplicate_field("nameStrategy"));
4597                            }
4598                            name_strategy__ = Some(map_.next_value::<SchemaRegistryNameStrategy>()? as i32);
4599                        }
4600                        GeneratedField::KeyMessageName => {
4601                            if key_message_name__.is_some() {
4602                                return Err(serde::de::Error::duplicate_field("keyMessageName"));
4603                            }
4604                            key_message_name__ = map_.next_value()?;
4605                        }
4606                        GeneratedField::ExternalTable => {
4607                            if external_table__.is_some() {
4608                                return Err(serde::de::Error::duplicate_field("externalTable"));
4609                            }
4610                            external_table__ = map_.next_value()?;
4611                        }
4612                        GeneratedField::CdcSourceJob => {
4613                            if cdc_source_job__.is_some() {
4614                                return Err(serde::de::Error::duplicate_field("cdcSourceJob"));
4615                            }
4616                            cdc_source_job__ = Some(map_.next_value()?);
4617                        }
4618                        GeneratedField::IsDistributed => {
4619                            if is_distributed__.is_some() {
4620                                return Err(serde::de::Error::duplicate_field("isDistributed"));
4621                            }
4622                            is_distributed__ = Some(map_.next_value()?);
4623                        }
4624                        GeneratedField::FormatEncodeOptions => {
4625                            if format_encode_options__.is_some() {
4626                                return Err(serde::de::Error::duplicate_field("formatEncodeOptions"));
4627                            }
4628                            format_encode_options__ = Some(
4629                                map_.next_value::<std::collections::BTreeMap<_, _>>()?
4630                            );
4631                        }
4632                        GeneratedField::FormatEncodeSecretRefs => {
4633                            if format_encode_secret_refs__.is_some() {
4634                                return Err(serde::de::Error::duplicate_field("formatEncodeSecretRefs"));
4635                            }
4636                            format_encode_secret_refs__ = Some(
4637                                map_.next_value::<std::collections::BTreeMap<_, _>>()?
4638                            );
4639                        }
4640                        GeneratedField::ConnectionId => {
4641                            if connection_id__.is_some() {
4642                                return Err(serde::de::Error::duplicate_field("connectionId"));
4643                            }
4644                            connection_id__ = 
4645                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
4646                            ;
4647                        }
4648                    }
4649                }
4650                Ok(StreamSourceInfo {
4651                    row_format: row_format__.unwrap_or_default(),
4652                    row_schema_location: row_schema_location__.unwrap_or_default(),
4653                    use_schema_registry: use_schema_registry__.unwrap_or_default(),
4654                    proto_message_name: proto_message_name__.unwrap_or_default(),
4655                    csv_delimiter: csv_delimiter__.unwrap_or_default(),
4656                    csv_has_header: csv_has_header__.unwrap_or_default(),
4657                    format: format__.unwrap_or_default(),
4658                    row_encode: row_encode__.unwrap_or_default(),
4659                    name_strategy: name_strategy__.unwrap_or_default(),
4660                    key_message_name: key_message_name__,
4661                    external_table: external_table__,
4662                    cdc_source_job: cdc_source_job__.unwrap_or_default(),
4663                    is_distributed: is_distributed__.unwrap_or_default(),
4664                    format_encode_options: format_encode_options__.unwrap_or_default(),
4665                    format_encode_secret_refs: format_encode_secret_refs__.unwrap_or_default(),
4666                    connection_id: connection_id__,
4667                })
4668            }
4669        }
4670        deserializer.deserialize_struct("catalog.StreamSourceInfo", FIELDS, GeneratedVisitor)
4671    }
4672}
4673impl serde::Serialize for Subscription {
4674    #[allow(deprecated)]
4675    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4676    where
4677        S: serde::Serializer,
4678    {
4679        use serde::ser::SerializeStruct;
4680        let mut len = 0;
4681        if self.id != 0 {
4682            len += 1;
4683        }
4684        if !self.name.is_empty() {
4685            len += 1;
4686        }
4687        if !self.definition.is_empty() {
4688            len += 1;
4689        }
4690        if self.retention_seconds != 0 {
4691            len += 1;
4692        }
4693        if self.database_id != 0 {
4694            len += 1;
4695        }
4696        if self.schema_id != 0 {
4697            len += 1;
4698        }
4699        if self.dependent_table_id != 0 {
4700            len += 1;
4701        }
4702        if self.initialized_at_epoch.is_some() {
4703            len += 1;
4704        }
4705        if self.created_at_epoch.is_some() {
4706            len += 1;
4707        }
4708        if self.owner != 0 {
4709            len += 1;
4710        }
4711        if self.initialized_at_cluster_version.is_some() {
4712            len += 1;
4713        }
4714        if self.created_at_cluster_version.is_some() {
4715            len += 1;
4716        }
4717        if self.subscription_state != 0 {
4718            len += 1;
4719        }
4720        let mut struct_ser = serializer.serialize_struct("catalog.Subscription", len)?;
4721        if self.id != 0 {
4722            struct_ser.serialize_field("id", &self.id)?;
4723        }
4724        if !self.name.is_empty() {
4725            struct_ser.serialize_field("name", &self.name)?;
4726        }
4727        if !self.definition.is_empty() {
4728            struct_ser.serialize_field("definition", &self.definition)?;
4729        }
4730        if self.retention_seconds != 0 {
4731            #[allow(clippy::needless_borrow)]
4732            #[allow(clippy::needless_borrows_for_generic_args)]
4733            struct_ser.serialize_field("retentionSeconds", ToString::to_string(&self.retention_seconds).as_str())?;
4734        }
4735        if self.database_id != 0 {
4736            struct_ser.serialize_field("databaseId", &self.database_id)?;
4737        }
4738        if self.schema_id != 0 {
4739            struct_ser.serialize_field("schemaId", &self.schema_id)?;
4740        }
4741        if self.dependent_table_id != 0 {
4742            struct_ser.serialize_field("dependentTableId", &self.dependent_table_id)?;
4743        }
4744        if let Some(v) = self.initialized_at_epoch.as_ref() {
4745            #[allow(clippy::needless_borrow)]
4746            #[allow(clippy::needless_borrows_for_generic_args)]
4747            struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
4748        }
4749        if let Some(v) = self.created_at_epoch.as_ref() {
4750            #[allow(clippy::needless_borrow)]
4751            #[allow(clippy::needless_borrows_for_generic_args)]
4752            struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
4753        }
4754        if self.owner != 0 {
4755            struct_ser.serialize_field("owner", &self.owner)?;
4756        }
4757        if let Some(v) = self.initialized_at_cluster_version.as_ref() {
4758            struct_ser.serialize_field("initializedAtClusterVersion", v)?;
4759        }
4760        if let Some(v) = self.created_at_cluster_version.as_ref() {
4761            struct_ser.serialize_field("createdAtClusterVersion", v)?;
4762        }
4763        if self.subscription_state != 0 {
4764            let v = subscription::SubscriptionState::try_from(self.subscription_state)
4765                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.subscription_state)))?;
4766            struct_ser.serialize_field("subscriptionState", &v)?;
4767        }
4768        struct_ser.end()
4769    }
4770}
4771impl<'de> serde::Deserialize<'de> for Subscription {
4772    #[allow(deprecated)]
4773    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4774    where
4775        D: serde::Deserializer<'de>,
4776    {
4777        const FIELDS: &[&str] = &[
4778            "id",
4779            "name",
4780            "definition",
4781            "retention_seconds",
4782            "retentionSeconds",
4783            "database_id",
4784            "databaseId",
4785            "schema_id",
4786            "schemaId",
4787            "dependent_table_id",
4788            "dependentTableId",
4789            "initialized_at_epoch",
4790            "initializedAtEpoch",
4791            "created_at_epoch",
4792            "createdAtEpoch",
4793            "owner",
4794            "initialized_at_cluster_version",
4795            "initializedAtClusterVersion",
4796            "created_at_cluster_version",
4797            "createdAtClusterVersion",
4798            "subscription_state",
4799            "subscriptionState",
4800        ];
4801
4802        #[allow(clippy::enum_variant_names)]
4803        enum GeneratedField {
4804            Id,
4805            Name,
4806            Definition,
4807            RetentionSeconds,
4808            DatabaseId,
4809            SchemaId,
4810            DependentTableId,
4811            InitializedAtEpoch,
4812            CreatedAtEpoch,
4813            Owner,
4814            InitializedAtClusterVersion,
4815            CreatedAtClusterVersion,
4816            SubscriptionState,
4817        }
4818        impl<'de> serde::Deserialize<'de> for GeneratedField {
4819            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
4820            where
4821                D: serde::Deserializer<'de>,
4822            {
4823                struct GeneratedVisitor;
4824
4825                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
4826                    type Value = GeneratedField;
4827
4828                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4829                        write!(formatter, "expected one of: {:?}", &FIELDS)
4830                    }
4831
4832                    #[allow(unused_variables)]
4833                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
4834                    where
4835                        E: serde::de::Error,
4836                    {
4837                        match value {
4838                            "id" => Ok(GeneratedField::Id),
4839                            "name" => Ok(GeneratedField::Name),
4840                            "definition" => Ok(GeneratedField::Definition),
4841                            "retentionSeconds" | "retention_seconds" => Ok(GeneratedField::RetentionSeconds),
4842                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
4843                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
4844                            "dependentTableId" | "dependent_table_id" => Ok(GeneratedField::DependentTableId),
4845                            "initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
4846                            "createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
4847                            "owner" => Ok(GeneratedField::Owner),
4848                            "initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
4849                            "createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
4850                            "subscriptionState" | "subscription_state" => Ok(GeneratedField::SubscriptionState),
4851                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
4852                        }
4853                    }
4854                }
4855                deserializer.deserialize_identifier(GeneratedVisitor)
4856            }
4857        }
4858        struct GeneratedVisitor;
4859        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
4860            type Value = Subscription;
4861
4862            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4863                formatter.write_str("struct catalog.Subscription")
4864            }
4865
4866            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Subscription, V::Error>
4867                where
4868                    V: serde::de::MapAccess<'de>,
4869            {
4870                let mut id__ = None;
4871                let mut name__ = None;
4872                let mut definition__ = None;
4873                let mut retention_seconds__ = None;
4874                let mut database_id__ = None;
4875                let mut schema_id__ = None;
4876                let mut dependent_table_id__ = None;
4877                let mut initialized_at_epoch__ = None;
4878                let mut created_at_epoch__ = None;
4879                let mut owner__ = None;
4880                let mut initialized_at_cluster_version__ = None;
4881                let mut created_at_cluster_version__ = None;
4882                let mut subscription_state__ = None;
4883                while let Some(k) = map_.next_key()? {
4884                    match k {
4885                        GeneratedField::Id => {
4886                            if id__.is_some() {
4887                                return Err(serde::de::Error::duplicate_field("id"));
4888                            }
4889                            id__ = 
4890                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4891                            ;
4892                        }
4893                        GeneratedField::Name => {
4894                            if name__.is_some() {
4895                                return Err(serde::de::Error::duplicate_field("name"));
4896                            }
4897                            name__ = Some(map_.next_value()?);
4898                        }
4899                        GeneratedField::Definition => {
4900                            if definition__.is_some() {
4901                                return Err(serde::de::Error::duplicate_field("definition"));
4902                            }
4903                            definition__ = Some(map_.next_value()?);
4904                        }
4905                        GeneratedField::RetentionSeconds => {
4906                            if retention_seconds__.is_some() {
4907                                return Err(serde::de::Error::duplicate_field("retentionSeconds"));
4908                            }
4909                            retention_seconds__ = 
4910                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4911                            ;
4912                        }
4913                        GeneratedField::DatabaseId => {
4914                            if database_id__.is_some() {
4915                                return Err(serde::de::Error::duplicate_field("databaseId"));
4916                            }
4917                            database_id__ = 
4918                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4919                            ;
4920                        }
4921                        GeneratedField::SchemaId => {
4922                            if schema_id__.is_some() {
4923                                return Err(serde::de::Error::duplicate_field("schemaId"));
4924                            }
4925                            schema_id__ = 
4926                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4927                            ;
4928                        }
4929                        GeneratedField::DependentTableId => {
4930                            if dependent_table_id__.is_some() {
4931                                return Err(serde::de::Error::duplicate_field("dependentTableId"));
4932                            }
4933                            dependent_table_id__ = 
4934                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4935                            ;
4936                        }
4937                        GeneratedField::InitializedAtEpoch => {
4938                            if initialized_at_epoch__.is_some() {
4939                                return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
4940                            }
4941                            initialized_at_epoch__ = 
4942                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
4943                            ;
4944                        }
4945                        GeneratedField::CreatedAtEpoch => {
4946                            if created_at_epoch__.is_some() {
4947                                return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
4948                            }
4949                            created_at_epoch__ = 
4950                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
4951                            ;
4952                        }
4953                        GeneratedField::Owner => {
4954                            if owner__.is_some() {
4955                                return Err(serde::de::Error::duplicate_field("owner"));
4956                            }
4957                            owner__ = 
4958                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
4959                            ;
4960                        }
4961                        GeneratedField::InitializedAtClusterVersion => {
4962                            if initialized_at_cluster_version__.is_some() {
4963                                return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
4964                            }
4965                            initialized_at_cluster_version__ = map_.next_value()?;
4966                        }
4967                        GeneratedField::CreatedAtClusterVersion => {
4968                            if created_at_cluster_version__.is_some() {
4969                                return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
4970                            }
4971                            created_at_cluster_version__ = map_.next_value()?;
4972                        }
4973                        GeneratedField::SubscriptionState => {
4974                            if subscription_state__.is_some() {
4975                                return Err(serde::de::Error::duplicate_field("subscriptionState"));
4976                            }
4977                            subscription_state__ = Some(map_.next_value::<subscription::SubscriptionState>()? as i32);
4978                        }
4979                    }
4980                }
4981                Ok(Subscription {
4982                    id: id__.unwrap_or_default(),
4983                    name: name__.unwrap_or_default(),
4984                    definition: definition__.unwrap_or_default(),
4985                    retention_seconds: retention_seconds__.unwrap_or_default(),
4986                    database_id: database_id__.unwrap_or_default(),
4987                    schema_id: schema_id__.unwrap_or_default(),
4988                    dependent_table_id: dependent_table_id__.unwrap_or_default(),
4989                    initialized_at_epoch: initialized_at_epoch__,
4990                    created_at_epoch: created_at_epoch__,
4991                    owner: owner__.unwrap_or_default(),
4992                    initialized_at_cluster_version: initialized_at_cluster_version__,
4993                    created_at_cluster_version: created_at_cluster_version__,
4994                    subscription_state: subscription_state__.unwrap_or_default(),
4995                })
4996            }
4997        }
4998        deserializer.deserialize_struct("catalog.Subscription", FIELDS, GeneratedVisitor)
4999    }
5000}
5001impl serde::Serialize for subscription::SubscriptionState {
5002    #[allow(deprecated)]
5003    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5004    where
5005        S: serde::Serializer,
5006    {
5007        let variant = match self {
5008            Self::Unspecified => "UNSPECIFIED",
5009            Self::Init => "INIT",
5010            Self::Created => "CREATED",
5011        };
5012        serializer.serialize_str(variant)
5013    }
5014}
5015impl<'de> serde::Deserialize<'de> for subscription::SubscriptionState {
5016    #[allow(deprecated)]
5017    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5018    where
5019        D: serde::Deserializer<'de>,
5020    {
5021        const FIELDS: &[&str] = &[
5022            "UNSPECIFIED",
5023            "INIT",
5024            "CREATED",
5025        ];
5026
5027        struct GeneratedVisitor;
5028
5029        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
5030            type Value = subscription::SubscriptionState;
5031
5032            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5033                write!(formatter, "expected one of: {:?}", &FIELDS)
5034            }
5035
5036            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
5037            where
5038                E: serde::de::Error,
5039            {
5040                i32::try_from(v)
5041                    .ok()
5042                    .and_then(|x| x.try_into().ok())
5043                    .ok_or_else(|| {
5044                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
5045                    })
5046            }
5047
5048            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
5049            where
5050                E: serde::de::Error,
5051            {
5052                i32::try_from(v)
5053                    .ok()
5054                    .and_then(|x| x.try_into().ok())
5055                    .ok_or_else(|| {
5056                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
5057                    })
5058            }
5059
5060            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5061            where
5062                E: serde::de::Error,
5063            {
5064                match value {
5065                    "UNSPECIFIED" => Ok(subscription::SubscriptionState::Unspecified),
5066                    "INIT" => Ok(subscription::SubscriptionState::Init),
5067                    "CREATED" => Ok(subscription::SubscriptionState::Created),
5068                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
5069                }
5070            }
5071        }
5072        deserializer.deserialize_any(GeneratedVisitor)
5073    }
5074}
5075impl serde::Serialize for Table {
5076    #[allow(deprecated)]
5077    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5078    where
5079        S: serde::Serializer,
5080    {
5081        use serde::ser::SerializeStruct;
5082        let mut len = 0;
5083        if self.id != 0 {
5084            len += 1;
5085        }
5086        if self.schema_id != 0 {
5087            len += 1;
5088        }
5089        if self.database_id != 0 {
5090            len += 1;
5091        }
5092        if !self.name.is_empty() {
5093            len += 1;
5094        }
5095        if !self.columns.is_empty() {
5096            len += 1;
5097        }
5098        if !self.pk.is_empty() {
5099            len += 1;
5100        }
5101        if !self.dependent_relations.is_empty() {
5102            len += 1;
5103        }
5104        if self.table_type != 0 {
5105            len += 1;
5106        }
5107        if !self.distribution_key.is_empty() {
5108            len += 1;
5109        }
5110        if !self.stream_key.is_empty() {
5111            len += 1;
5112        }
5113        if self.append_only {
5114            len += 1;
5115        }
5116        if self.owner != 0 {
5117            len += 1;
5118        }
5119        if self.fragment_id != 0 {
5120            len += 1;
5121        }
5122        if self.vnode_col_index.is_some() {
5123            len += 1;
5124        }
5125        if self.row_id_index.is_some() {
5126            len += 1;
5127        }
5128        if !self.value_indices.is_empty() {
5129            len += 1;
5130        }
5131        if !self.definition.is_empty() {
5132            len += 1;
5133        }
5134        if self.handle_pk_conflict_behavior != 0 {
5135            len += 1;
5136        }
5137        if self.read_prefix_len_hint != 0 {
5138            len += 1;
5139        }
5140        if !self.watermark_indices.is_empty() {
5141            len += 1;
5142        }
5143        if !self.dist_key_in_pk.is_empty() {
5144            len += 1;
5145        }
5146        if self.dml_fragment_id.is_some() {
5147            len += 1;
5148        }
5149        if self.cardinality.is_some() {
5150            len += 1;
5151        }
5152        if self.initialized_at_epoch.is_some() {
5153            len += 1;
5154        }
5155        if self.created_at_epoch.is_some() {
5156            len += 1;
5157        }
5158        if self.cleaned_by_watermark {
5159            len += 1;
5160        }
5161        if self.stream_job_status != 0 {
5162            len += 1;
5163        }
5164        if self.create_type != 0 {
5165            len += 1;
5166        }
5167        if self.description.is_some() {
5168            len += 1;
5169        }
5170        if !self.incoming_sinks.is_empty() {
5171            len += 1;
5172        }
5173        if self.initialized_at_cluster_version.is_some() {
5174            len += 1;
5175        }
5176        if self.created_at_cluster_version.is_some() {
5177            len += 1;
5178        }
5179        if self.retention_seconds.is_some() {
5180            len += 1;
5181        }
5182        if self.version_column_index.is_some() {
5183            len += 1;
5184        }
5185        if self.cdc_table_id.is_some() {
5186            len += 1;
5187        }
5188        if self.maybe_vnode_count.is_some() {
5189            len += 1;
5190        }
5191        if self.webhook_info.is_some() {
5192            len += 1;
5193        }
5194        if self.job_id.is_some() {
5195            len += 1;
5196        }
5197        if self.engine.is_some() {
5198            len += 1;
5199        }
5200        if self.clean_watermark_index_in_pk.is_some() {
5201            len += 1;
5202        }
5203        if self.version.is_some() {
5204            len += 1;
5205        }
5206        if self.optional_associated_source_id.is_some() {
5207            len += 1;
5208        }
5209        let mut struct_ser = serializer.serialize_struct("catalog.Table", len)?;
5210        if self.id != 0 {
5211            struct_ser.serialize_field("id", &self.id)?;
5212        }
5213        if self.schema_id != 0 {
5214            struct_ser.serialize_field("schemaId", &self.schema_id)?;
5215        }
5216        if self.database_id != 0 {
5217            struct_ser.serialize_field("databaseId", &self.database_id)?;
5218        }
5219        if !self.name.is_empty() {
5220            struct_ser.serialize_field("name", &self.name)?;
5221        }
5222        if !self.columns.is_empty() {
5223            struct_ser.serialize_field("columns", &self.columns)?;
5224        }
5225        if !self.pk.is_empty() {
5226            struct_ser.serialize_field("pk", &self.pk)?;
5227        }
5228        if !self.dependent_relations.is_empty() {
5229            struct_ser.serialize_field("dependentRelations", &self.dependent_relations)?;
5230        }
5231        if self.table_type != 0 {
5232            let v = table::TableType::try_from(self.table_type)
5233                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.table_type)))?;
5234            struct_ser.serialize_field("tableType", &v)?;
5235        }
5236        if !self.distribution_key.is_empty() {
5237            struct_ser.serialize_field("distributionKey", &self.distribution_key)?;
5238        }
5239        if !self.stream_key.is_empty() {
5240            struct_ser.serialize_field("streamKey", &self.stream_key)?;
5241        }
5242        if self.append_only {
5243            struct_ser.serialize_field("appendOnly", &self.append_only)?;
5244        }
5245        if self.owner != 0 {
5246            struct_ser.serialize_field("owner", &self.owner)?;
5247        }
5248        if self.fragment_id != 0 {
5249            struct_ser.serialize_field("fragmentId", &self.fragment_id)?;
5250        }
5251        if let Some(v) = self.vnode_col_index.as_ref() {
5252            struct_ser.serialize_field("vnodeColIndex", v)?;
5253        }
5254        if let Some(v) = self.row_id_index.as_ref() {
5255            struct_ser.serialize_field("rowIdIndex", v)?;
5256        }
5257        if !self.value_indices.is_empty() {
5258            struct_ser.serialize_field("valueIndices", &self.value_indices)?;
5259        }
5260        if !self.definition.is_empty() {
5261            struct_ser.serialize_field("definition", &self.definition)?;
5262        }
5263        if self.handle_pk_conflict_behavior != 0 {
5264            let v = HandleConflictBehavior::try_from(self.handle_pk_conflict_behavior)
5265                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.handle_pk_conflict_behavior)))?;
5266            struct_ser.serialize_field("handlePkConflictBehavior", &v)?;
5267        }
5268        if self.read_prefix_len_hint != 0 {
5269            struct_ser.serialize_field("readPrefixLenHint", &self.read_prefix_len_hint)?;
5270        }
5271        if !self.watermark_indices.is_empty() {
5272            struct_ser.serialize_field("watermarkIndices", &self.watermark_indices)?;
5273        }
5274        if !self.dist_key_in_pk.is_empty() {
5275            struct_ser.serialize_field("distKeyInPk", &self.dist_key_in_pk)?;
5276        }
5277        if let Some(v) = self.dml_fragment_id.as_ref() {
5278            struct_ser.serialize_field("dmlFragmentId", v)?;
5279        }
5280        if let Some(v) = self.cardinality.as_ref() {
5281            struct_ser.serialize_field("cardinality", v)?;
5282        }
5283        if let Some(v) = self.initialized_at_epoch.as_ref() {
5284            #[allow(clippy::needless_borrow)]
5285            #[allow(clippy::needless_borrows_for_generic_args)]
5286            struct_ser.serialize_field("initializedAtEpoch", ToString::to_string(&v).as_str())?;
5287        }
5288        if let Some(v) = self.created_at_epoch.as_ref() {
5289            #[allow(clippy::needless_borrow)]
5290            #[allow(clippy::needless_borrows_for_generic_args)]
5291            struct_ser.serialize_field("createdAtEpoch", ToString::to_string(&v).as_str())?;
5292        }
5293        if self.cleaned_by_watermark {
5294            struct_ser.serialize_field("cleanedByWatermark", &self.cleaned_by_watermark)?;
5295        }
5296        if self.stream_job_status != 0 {
5297            let v = StreamJobStatus::try_from(self.stream_job_status)
5298                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.stream_job_status)))?;
5299            struct_ser.serialize_field("streamJobStatus", &v)?;
5300        }
5301        if self.create_type != 0 {
5302            let v = CreateType::try_from(self.create_type)
5303                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.create_type)))?;
5304            struct_ser.serialize_field("createType", &v)?;
5305        }
5306        if let Some(v) = self.description.as_ref() {
5307            struct_ser.serialize_field("description", v)?;
5308        }
5309        if !self.incoming_sinks.is_empty() {
5310            struct_ser.serialize_field("incomingSinks", &self.incoming_sinks)?;
5311        }
5312        if let Some(v) = self.initialized_at_cluster_version.as_ref() {
5313            struct_ser.serialize_field("initializedAtClusterVersion", v)?;
5314        }
5315        if let Some(v) = self.created_at_cluster_version.as_ref() {
5316            struct_ser.serialize_field("createdAtClusterVersion", v)?;
5317        }
5318        if let Some(v) = self.retention_seconds.as_ref() {
5319            struct_ser.serialize_field("retentionSeconds", v)?;
5320        }
5321        if let Some(v) = self.version_column_index.as_ref() {
5322            struct_ser.serialize_field("versionColumnIndex", v)?;
5323        }
5324        if let Some(v) = self.cdc_table_id.as_ref() {
5325            struct_ser.serialize_field("cdcTableId", v)?;
5326        }
5327        if let Some(v) = self.maybe_vnode_count.as_ref() {
5328            struct_ser.serialize_field("maybeVnodeCount", v)?;
5329        }
5330        if let Some(v) = self.webhook_info.as_ref() {
5331            struct_ser.serialize_field("webhookInfo", v)?;
5332        }
5333        if let Some(v) = self.job_id.as_ref() {
5334            struct_ser.serialize_field("jobId", v)?;
5335        }
5336        if let Some(v) = self.engine.as_ref() {
5337            let v = table::Engine::try_from(*v)
5338                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
5339            struct_ser.serialize_field("engine", &v)?;
5340        }
5341        if let Some(v) = self.clean_watermark_index_in_pk.as_ref() {
5342            struct_ser.serialize_field("cleanWatermarkIndexInPk", v)?;
5343        }
5344        if let Some(v) = self.version.as_ref() {
5345            struct_ser.serialize_field("version", v)?;
5346        }
5347        if let Some(v) = self.optional_associated_source_id.as_ref() {
5348            match v {
5349                table::OptionalAssociatedSourceId::AssociatedSourceId(v) => {
5350                    struct_ser.serialize_field("associatedSourceId", v)?;
5351                }
5352            }
5353        }
5354        struct_ser.end()
5355    }
5356}
5357impl<'de> serde::Deserialize<'de> for Table {
5358    #[allow(deprecated)]
5359    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5360    where
5361        D: serde::Deserializer<'de>,
5362    {
5363        const FIELDS: &[&str] = &[
5364            "id",
5365            "schema_id",
5366            "schemaId",
5367            "database_id",
5368            "databaseId",
5369            "name",
5370            "columns",
5371            "pk",
5372            "dependent_relations",
5373            "dependentRelations",
5374            "table_type",
5375            "tableType",
5376            "distribution_key",
5377            "distributionKey",
5378            "stream_key",
5379            "streamKey",
5380            "append_only",
5381            "appendOnly",
5382            "owner",
5383            "fragment_id",
5384            "fragmentId",
5385            "vnode_col_index",
5386            "vnodeColIndex",
5387            "row_id_index",
5388            "rowIdIndex",
5389            "value_indices",
5390            "valueIndices",
5391            "definition",
5392            "handle_pk_conflict_behavior",
5393            "handlePkConflictBehavior",
5394            "read_prefix_len_hint",
5395            "readPrefixLenHint",
5396            "watermark_indices",
5397            "watermarkIndices",
5398            "dist_key_in_pk",
5399            "distKeyInPk",
5400            "dml_fragment_id",
5401            "dmlFragmentId",
5402            "cardinality",
5403            "initialized_at_epoch",
5404            "initializedAtEpoch",
5405            "created_at_epoch",
5406            "createdAtEpoch",
5407            "cleaned_by_watermark",
5408            "cleanedByWatermark",
5409            "stream_job_status",
5410            "streamJobStatus",
5411            "create_type",
5412            "createType",
5413            "description",
5414            "incoming_sinks",
5415            "incomingSinks",
5416            "initialized_at_cluster_version",
5417            "initializedAtClusterVersion",
5418            "created_at_cluster_version",
5419            "createdAtClusterVersion",
5420            "retention_seconds",
5421            "retentionSeconds",
5422            "version_column_index",
5423            "versionColumnIndex",
5424            "cdc_table_id",
5425            "cdcTableId",
5426            "maybe_vnode_count",
5427            "maybeVnodeCount",
5428            "webhook_info",
5429            "webhookInfo",
5430            "job_id",
5431            "jobId",
5432            "engine",
5433            "clean_watermark_index_in_pk",
5434            "cleanWatermarkIndexInPk",
5435            "version",
5436            "associated_source_id",
5437            "associatedSourceId",
5438        ];
5439
5440        #[allow(clippy::enum_variant_names)]
5441        enum GeneratedField {
5442            Id,
5443            SchemaId,
5444            DatabaseId,
5445            Name,
5446            Columns,
5447            Pk,
5448            DependentRelations,
5449            TableType,
5450            DistributionKey,
5451            StreamKey,
5452            AppendOnly,
5453            Owner,
5454            FragmentId,
5455            VnodeColIndex,
5456            RowIdIndex,
5457            ValueIndices,
5458            Definition,
5459            HandlePkConflictBehavior,
5460            ReadPrefixLenHint,
5461            WatermarkIndices,
5462            DistKeyInPk,
5463            DmlFragmentId,
5464            Cardinality,
5465            InitializedAtEpoch,
5466            CreatedAtEpoch,
5467            CleanedByWatermark,
5468            StreamJobStatus,
5469            CreateType,
5470            Description,
5471            IncomingSinks,
5472            InitializedAtClusterVersion,
5473            CreatedAtClusterVersion,
5474            RetentionSeconds,
5475            VersionColumnIndex,
5476            CdcTableId,
5477            MaybeVnodeCount,
5478            WebhookInfo,
5479            JobId,
5480            Engine,
5481            CleanWatermarkIndexInPk,
5482            Version,
5483            AssociatedSourceId,
5484        }
5485        impl<'de> serde::Deserialize<'de> for GeneratedField {
5486            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
5487            where
5488                D: serde::Deserializer<'de>,
5489            {
5490                struct GeneratedVisitor;
5491
5492                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
5493                    type Value = GeneratedField;
5494
5495                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5496                        write!(formatter, "expected one of: {:?}", &FIELDS)
5497                    }
5498
5499                    #[allow(unused_variables)]
5500                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
5501                    where
5502                        E: serde::de::Error,
5503                    {
5504                        match value {
5505                            "id" => Ok(GeneratedField::Id),
5506                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
5507                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
5508                            "name" => Ok(GeneratedField::Name),
5509                            "columns" => Ok(GeneratedField::Columns),
5510                            "pk" => Ok(GeneratedField::Pk),
5511                            "dependentRelations" | "dependent_relations" => Ok(GeneratedField::DependentRelations),
5512                            "tableType" | "table_type" => Ok(GeneratedField::TableType),
5513                            "distributionKey" | "distribution_key" => Ok(GeneratedField::DistributionKey),
5514                            "streamKey" | "stream_key" => Ok(GeneratedField::StreamKey),
5515                            "appendOnly" | "append_only" => Ok(GeneratedField::AppendOnly),
5516                            "owner" => Ok(GeneratedField::Owner),
5517                            "fragmentId" | "fragment_id" => Ok(GeneratedField::FragmentId),
5518                            "vnodeColIndex" | "vnode_col_index" => Ok(GeneratedField::VnodeColIndex),
5519                            "rowIdIndex" | "row_id_index" => Ok(GeneratedField::RowIdIndex),
5520                            "valueIndices" | "value_indices" => Ok(GeneratedField::ValueIndices),
5521                            "definition" => Ok(GeneratedField::Definition),
5522                            "handlePkConflictBehavior" | "handle_pk_conflict_behavior" => Ok(GeneratedField::HandlePkConflictBehavior),
5523                            "readPrefixLenHint" | "read_prefix_len_hint" => Ok(GeneratedField::ReadPrefixLenHint),
5524                            "watermarkIndices" | "watermark_indices" => Ok(GeneratedField::WatermarkIndices),
5525                            "distKeyInPk" | "dist_key_in_pk" => Ok(GeneratedField::DistKeyInPk),
5526                            "dmlFragmentId" | "dml_fragment_id" => Ok(GeneratedField::DmlFragmentId),
5527                            "cardinality" => Ok(GeneratedField::Cardinality),
5528                            "initializedAtEpoch" | "initialized_at_epoch" => Ok(GeneratedField::InitializedAtEpoch),
5529                            "createdAtEpoch" | "created_at_epoch" => Ok(GeneratedField::CreatedAtEpoch),
5530                            "cleanedByWatermark" | "cleaned_by_watermark" => Ok(GeneratedField::CleanedByWatermark),
5531                            "streamJobStatus" | "stream_job_status" => Ok(GeneratedField::StreamJobStatus),
5532                            "createType" | "create_type" => Ok(GeneratedField::CreateType),
5533                            "description" => Ok(GeneratedField::Description),
5534                            "incomingSinks" | "incoming_sinks" => Ok(GeneratedField::IncomingSinks),
5535                            "initializedAtClusterVersion" | "initialized_at_cluster_version" => Ok(GeneratedField::InitializedAtClusterVersion),
5536                            "createdAtClusterVersion" | "created_at_cluster_version" => Ok(GeneratedField::CreatedAtClusterVersion),
5537                            "retentionSeconds" | "retention_seconds" => Ok(GeneratedField::RetentionSeconds),
5538                            "versionColumnIndex" | "version_column_index" => Ok(GeneratedField::VersionColumnIndex),
5539                            "cdcTableId" | "cdc_table_id" => Ok(GeneratedField::CdcTableId),
5540                            "maybeVnodeCount" | "maybe_vnode_count" => Ok(GeneratedField::MaybeVnodeCount),
5541                            "webhookInfo" | "webhook_info" => Ok(GeneratedField::WebhookInfo),
5542                            "jobId" | "job_id" => Ok(GeneratedField::JobId),
5543                            "engine" => Ok(GeneratedField::Engine),
5544                            "cleanWatermarkIndexInPk" | "clean_watermark_index_in_pk" => Ok(GeneratedField::CleanWatermarkIndexInPk),
5545                            "version" => Ok(GeneratedField::Version),
5546                            "associatedSourceId" | "associated_source_id" => Ok(GeneratedField::AssociatedSourceId),
5547                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
5548                        }
5549                    }
5550                }
5551                deserializer.deserialize_identifier(GeneratedVisitor)
5552            }
5553        }
5554        struct GeneratedVisitor;
5555        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
5556            type Value = Table;
5557
5558            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5559                formatter.write_str("struct catalog.Table")
5560            }
5561
5562            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Table, V::Error>
5563                where
5564                    V: serde::de::MapAccess<'de>,
5565            {
5566                let mut id__ = None;
5567                let mut schema_id__ = None;
5568                let mut database_id__ = None;
5569                let mut name__ = None;
5570                let mut columns__ = None;
5571                let mut pk__ = None;
5572                let mut dependent_relations__ = None;
5573                let mut table_type__ = None;
5574                let mut distribution_key__ = None;
5575                let mut stream_key__ = None;
5576                let mut append_only__ = None;
5577                let mut owner__ = None;
5578                let mut fragment_id__ = None;
5579                let mut vnode_col_index__ = None;
5580                let mut row_id_index__ = None;
5581                let mut value_indices__ = None;
5582                let mut definition__ = None;
5583                let mut handle_pk_conflict_behavior__ = None;
5584                let mut read_prefix_len_hint__ = None;
5585                let mut watermark_indices__ = None;
5586                let mut dist_key_in_pk__ = None;
5587                let mut dml_fragment_id__ = None;
5588                let mut cardinality__ = None;
5589                let mut initialized_at_epoch__ = None;
5590                let mut created_at_epoch__ = None;
5591                let mut cleaned_by_watermark__ = None;
5592                let mut stream_job_status__ = None;
5593                let mut create_type__ = None;
5594                let mut description__ = None;
5595                let mut incoming_sinks__ = None;
5596                let mut initialized_at_cluster_version__ = None;
5597                let mut created_at_cluster_version__ = None;
5598                let mut retention_seconds__ = None;
5599                let mut version_column_index__ = None;
5600                let mut cdc_table_id__ = None;
5601                let mut maybe_vnode_count__ = None;
5602                let mut webhook_info__ = None;
5603                let mut job_id__ = None;
5604                let mut engine__ = None;
5605                let mut clean_watermark_index_in_pk__ = None;
5606                let mut version__ = None;
5607                let mut optional_associated_source_id__ = None;
5608                while let Some(k) = map_.next_key()? {
5609                    match k {
5610                        GeneratedField::Id => {
5611                            if id__.is_some() {
5612                                return Err(serde::de::Error::duplicate_field("id"));
5613                            }
5614                            id__ = 
5615                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
5616                            ;
5617                        }
5618                        GeneratedField::SchemaId => {
5619                            if schema_id__.is_some() {
5620                                return Err(serde::de::Error::duplicate_field("schemaId"));
5621                            }
5622                            schema_id__ = 
5623                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
5624                            ;
5625                        }
5626                        GeneratedField::DatabaseId => {
5627                            if database_id__.is_some() {
5628                                return Err(serde::de::Error::duplicate_field("databaseId"));
5629                            }
5630                            database_id__ = 
5631                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
5632                            ;
5633                        }
5634                        GeneratedField::Name => {
5635                            if name__.is_some() {
5636                                return Err(serde::de::Error::duplicate_field("name"));
5637                            }
5638                            name__ = Some(map_.next_value()?);
5639                        }
5640                        GeneratedField::Columns => {
5641                            if columns__.is_some() {
5642                                return Err(serde::de::Error::duplicate_field("columns"));
5643                            }
5644                            columns__ = Some(map_.next_value()?);
5645                        }
5646                        GeneratedField::Pk => {
5647                            if pk__.is_some() {
5648                                return Err(serde::de::Error::duplicate_field("pk"));
5649                            }
5650                            pk__ = Some(map_.next_value()?);
5651                        }
5652                        GeneratedField::DependentRelations => {
5653                            if dependent_relations__.is_some() {
5654                                return Err(serde::de::Error::duplicate_field("dependentRelations"));
5655                            }
5656                            dependent_relations__ = 
5657                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
5658                                    .into_iter().map(|x| x.0).collect())
5659                            ;
5660                        }
5661                        GeneratedField::TableType => {
5662                            if table_type__.is_some() {
5663                                return Err(serde::de::Error::duplicate_field("tableType"));
5664                            }
5665                            table_type__ = Some(map_.next_value::<table::TableType>()? as i32);
5666                        }
5667                        GeneratedField::DistributionKey => {
5668                            if distribution_key__.is_some() {
5669                                return Err(serde::de::Error::duplicate_field("distributionKey"));
5670                            }
5671                            distribution_key__ = 
5672                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
5673                                    .into_iter().map(|x| x.0).collect())
5674                            ;
5675                        }
5676                        GeneratedField::StreamKey => {
5677                            if stream_key__.is_some() {
5678                                return Err(serde::de::Error::duplicate_field("streamKey"));
5679                            }
5680                            stream_key__ = 
5681                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
5682                                    .into_iter().map(|x| x.0).collect())
5683                            ;
5684                        }
5685                        GeneratedField::AppendOnly => {
5686                            if append_only__.is_some() {
5687                                return Err(serde::de::Error::duplicate_field("appendOnly"));
5688                            }
5689                            append_only__ = Some(map_.next_value()?);
5690                        }
5691                        GeneratedField::Owner => {
5692                            if owner__.is_some() {
5693                                return Err(serde::de::Error::duplicate_field("owner"));
5694                            }
5695                            owner__ = 
5696                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
5697                            ;
5698                        }
5699                        GeneratedField::FragmentId => {
5700                            if fragment_id__.is_some() {
5701                                return Err(serde::de::Error::duplicate_field("fragmentId"));
5702                            }
5703                            fragment_id__ = 
5704                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
5705                            ;
5706                        }
5707                        GeneratedField::VnodeColIndex => {
5708                            if vnode_col_index__.is_some() {
5709                                return Err(serde::de::Error::duplicate_field("vnodeColIndex"));
5710                            }
5711                            vnode_col_index__ = 
5712                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5713                            ;
5714                        }
5715                        GeneratedField::RowIdIndex => {
5716                            if row_id_index__.is_some() {
5717                                return Err(serde::de::Error::duplicate_field("rowIdIndex"));
5718                            }
5719                            row_id_index__ = 
5720                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5721                            ;
5722                        }
5723                        GeneratedField::ValueIndices => {
5724                            if value_indices__.is_some() {
5725                                return Err(serde::de::Error::duplicate_field("valueIndices"));
5726                            }
5727                            value_indices__ = 
5728                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
5729                                    .into_iter().map(|x| x.0).collect())
5730                            ;
5731                        }
5732                        GeneratedField::Definition => {
5733                            if definition__.is_some() {
5734                                return Err(serde::de::Error::duplicate_field("definition"));
5735                            }
5736                            definition__ = Some(map_.next_value()?);
5737                        }
5738                        GeneratedField::HandlePkConflictBehavior => {
5739                            if handle_pk_conflict_behavior__.is_some() {
5740                                return Err(serde::de::Error::duplicate_field("handlePkConflictBehavior"));
5741                            }
5742                            handle_pk_conflict_behavior__ = Some(map_.next_value::<HandleConflictBehavior>()? as i32);
5743                        }
5744                        GeneratedField::ReadPrefixLenHint => {
5745                            if read_prefix_len_hint__.is_some() {
5746                                return Err(serde::de::Error::duplicate_field("readPrefixLenHint"));
5747                            }
5748                            read_prefix_len_hint__ = 
5749                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
5750                            ;
5751                        }
5752                        GeneratedField::WatermarkIndices => {
5753                            if watermark_indices__.is_some() {
5754                                return Err(serde::de::Error::duplicate_field("watermarkIndices"));
5755                            }
5756                            watermark_indices__ = 
5757                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
5758                                    .into_iter().map(|x| x.0).collect())
5759                            ;
5760                        }
5761                        GeneratedField::DistKeyInPk => {
5762                            if dist_key_in_pk__.is_some() {
5763                                return Err(serde::de::Error::duplicate_field("distKeyInPk"));
5764                            }
5765                            dist_key_in_pk__ = 
5766                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
5767                                    .into_iter().map(|x| x.0).collect())
5768                            ;
5769                        }
5770                        GeneratedField::DmlFragmentId => {
5771                            if dml_fragment_id__.is_some() {
5772                                return Err(serde::de::Error::duplicate_field("dmlFragmentId"));
5773                            }
5774                            dml_fragment_id__ = 
5775                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5776                            ;
5777                        }
5778                        GeneratedField::Cardinality => {
5779                            if cardinality__.is_some() {
5780                                return Err(serde::de::Error::duplicate_field("cardinality"));
5781                            }
5782                            cardinality__ = map_.next_value()?;
5783                        }
5784                        GeneratedField::InitializedAtEpoch => {
5785                            if initialized_at_epoch__.is_some() {
5786                                return Err(serde::de::Error::duplicate_field("initializedAtEpoch"));
5787                            }
5788                            initialized_at_epoch__ = 
5789                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5790                            ;
5791                        }
5792                        GeneratedField::CreatedAtEpoch => {
5793                            if created_at_epoch__.is_some() {
5794                                return Err(serde::de::Error::duplicate_field("createdAtEpoch"));
5795                            }
5796                            created_at_epoch__ = 
5797                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5798                            ;
5799                        }
5800                        GeneratedField::CleanedByWatermark => {
5801                            if cleaned_by_watermark__.is_some() {
5802                                return Err(serde::de::Error::duplicate_field("cleanedByWatermark"));
5803                            }
5804                            cleaned_by_watermark__ = Some(map_.next_value()?);
5805                        }
5806                        GeneratedField::StreamJobStatus => {
5807                            if stream_job_status__.is_some() {
5808                                return Err(serde::de::Error::duplicate_field("streamJobStatus"));
5809                            }
5810                            stream_job_status__ = Some(map_.next_value::<StreamJobStatus>()? as i32);
5811                        }
5812                        GeneratedField::CreateType => {
5813                            if create_type__.is_some() {
5814                                return Err(serde::de::Error::duplicate_field("createType"));
5815                            }
5816                            create_type__ = Some(map_.next_value::<CreateType>()? as i32);
5817                        }
5818                        GeneratedField::Description => {
5819                            if description__.is_some() {
5820                                return Err(serde::de::Error::duplicate_field("description"));
5821                            }
5822                            description__ = map_.next_value()?;
5823                        }
5824                        GeneratedField::IncomingSinks => {
5825                            if incoming_sinks__.is_some() {
5826                                return Err(serde::de::Error::duplicate_field("incomingSinks"));
5827                            }
5828                            incoming_sinks__ = 
5829                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
5830                                    .into_iter().map(|x| x.0).collect())
5831                            ;
5832                        }
5833                        GeneratedField::InitializedAtClusterVersion => {
5834                            if initialized_at_cluster_version__.is_some() {
5835                                return Err(serde::de::Error::duplicate_field("initializedAtClusterVersion"));
5836                            }
5837                            initialized_at_cluster_version__ = map_.next_value()?;
5838                        }
5839                        GeneratedField::CreatedAtClusterVersion => {
5840                            if created_at_cluster_version__.is_some() {
5841                                return Err(serde::de::Error::duplicate_field("createdAtClusterVersion"));
5842                            }
5843                            created_at_cluster_version__ = map_.next_value()?;
5844                        }
5845                        GeneratedField::RetentionSeconds => {
5846                            if retention_seconds__.is_some() {
5847                                return Err(serde::de::Error::duplicate_field("retentionSeconds"));
5848                            }
5849                            retention_seconds__ = 
5850                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5851                            ;
5852                        }
5853                        GeneratedField::VersionColumnIndex => {
5854                            if version_column_index__.is_some() {
5855                                return Err(serde::de::Error::duplicate_field("versionColumnIndex"));
5856                            }
5857                            version_column_index__ = 
5858                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5859                            ;
5860                        }
5861                        GeneratedField::CdcTableId => {
5862                            if cdc_table_id__.is_some() {
5863                                return Err(serde::de::Error::duplicate_field("cdcTableId"));
5864                            }
5865                            cdc_table_id__ = map_.next_value()?;
5866                        }
5867                        GeneratedField::MaybeVnodeCount => {
5868                            if maybe_vnode_count__.is_some() {
5869                                return Err(serde::de::Error::duplicate_field("maybeVnodeCount"));
5870                            }
5871                            maybe_vnode_count__ = 
5872                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5873                            ;
5874                        }
5875                        GeneratedField::WebhookInfo => {
5876                            if webhook_info__.is_some() {
5877                                return Err(serde::de::Error::duplicate_field("webhookInfo"));
5878                            }
5879                            webhook_info__ = map_.next_value()?;
5880                        }
5881                        GeneratedField::JobId => {
5882                            if job_id__.is_some() {
5883                                return Err(serde::de::Error::duplicate_field("jobId"));
5884                            }
5885                            job_id__ = 
5886                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5887                            ;
5888                        }
5889                        GeneratedField::Engine => {
5890                            if engine__.is_some() {
5891                                return Err(serde::de::Error::duplicate_field("engine"));
5892                            }
5893                            engine__ = map_.next_value::<::std::option::Option<table::Engine>>()?.map(|x| x as i32);
5894                        }
5895                        GeneratedField::CleanWatermarkIndexInPk => {
5896                            if clean_watermark_index_in_pk__.is_some() {
5897                                return Err(serde::de::Error::duplicate_field("cleanWatermarkIndexInPk"));
5898                            }
5899                            clean_watermark_index_in_pk__ = 
5900                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
5901                            ;
5902                        }
5903                        GeneratedField::Version => {
5904                            if version__.is_some() {
5905                                return Err(serde::de::Error::duplicate_field("version"));
5906                            }
5907                            version__ = map_.next_value()?;
5908                        }
5909                        GeneratedField::AssociatedSourceId => {
5910                            if optional_associated_source_id__.is_some() {
5911                                return Err(serde::de::Error::duplicate_field("associatedSourceId"));
5912                            }
5913                            optional_associated_source_id__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| table::OptionalAssociatedSourceId::AssociatedSourceId(x.0));
5914                        }
5915                    }
5916                }
5917                Ok(Table {
5918                    id: id__.unwrap_or_default(),
5919                    schema_id: schema_id__.unwrap_or_default(),
5920                    database_id: database_id__.unwrap_or_default(),
5921                    name: name__.unwrap_or_default(),
5922                    columns: columns__.unwrap_or_default(),
5923                    pk: pk__.unwrap_or_default(),
5924                    dependent_relations: dependent_relations__.unwrap_or_default(),
5925                    table_type: table_type__.unwrap_or_default(),
5926                    distribution_key: distribution_key__.unwrap_or_default(),
5927                    stream_key: stream_key__.unwrap_or_default(),
5928                    append_only: append_only__.unwrap_or_default(),
5929                    owner: owner__.unwrap_or_default(),
5930                    fragment_id: fragment_id__.unwrap_or_default(),
5931                    vnode_col_index: vnode_col_index__,
5932                    row_id_index: row_id_index__,
5933                    value_indices: value_indices__.unwrap_or_default(),
5934                    definition: definition__.unwrap_or_default(),
5935                    handle_pk_conflict_behavior: handle_pk_conflict_behavior__.unwrap_or_default(),
5936                    read_prefix_len_hint: read_prefix_len_hint__.unwrap_or_default(),
5937                    watermark_indices: watermark_indices__.unwrap_or_default(),
5938                    dist_key_in_pk: dist_key_in_pk__.unwrap_or_default(),
5939                    dml_fragment_id: dml_fragment_id__,
5940                    cardinality: cardinality__,
5941                    initialized_at_epoch: initialized_at_epoch__,
5942                    created_at_epoch: created_at_epoch__,
5943                    cleaned_by_watermark: cleaned_by_watermark__.unwrap_or_default(),
5944                    stream_job_status: stream_job_status__.unwrap_or_default(),
5945                    create_type: create_type__.unwrap_or_default(),
5946                    description: description__,
5947                    incoming_sinks: incoming_sinks__.unwrap_or_default(),
5948                    initialized_at_cluster_version: initialized_at_cluster_version__,
5949                    created_at_cluster_version: created_at_cluster_version__,
5950                    retention_seconds: retention_seconds__,
5951                    version_column_index: version_column_index__,
5952                    cdc_table_id: cdc_table_id__,
5953                    maybe_vnode_count: maybe_vnode_count__,
5954                    webhook_info: webhook_info__,
5955                    job_id: job_id__,
5956                    engine: engine__,
5957                    clean_watermark_index_in_pk: clean_watermark_index_in_pk__,
5958                    version: version__,
5959                    optional_associated_source_id: optional_associated_source_id__,
5960                })
5961            }
5962        }
5963        deserializer.deserialize_struct("catalog.Table", FIELDS, GeneratedVisitor)
5964    }
5965}
5966impl serde::Serialize for table::Engine {
5967    #[allow(deprecated)]
5968    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5969    where
5970        S: serde::Serializer,
5971    {
5972        let variant = match self {
5973            Self::Unspecified => "ENGINE_UNSPECIFIED",
5974            Self::Hummock => "HUMMOCK",
5975            Self::Iceberg => "ICEBERG",
5976        };
5977        serializer.serialize_str(variant)
5978    }
5979}
5980impl<'de> serde::Deserialize<'de> for table::Engine {
5981    #[allow(deprecated)]
5982    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5983    where
5984        D: serde::Deserializer<'de>,
5985    {
5986        const FIELDS: &[&str] = &[
5987            "ENGINE_UNSPECIFIED",
5988            "HUMMOCK",
5989            "ICEBERG",
5990        ];
5991
5992        struct GeneratedVisitor;
5993
5994        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
5995            type Value = table::Engine;
5996
5997            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5998                write!(formatter, "expected one of: {:?}", &FIELDS)
5999            }
6000
6001            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
6002            where
6003                E: serde::de::Error,
6004            {
6005                i32::try_from(v)
6006                    .ok()
6007                    .and_then(|x| x.try_into().ok())
6008                    .ok_or_else(|| {
6009                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
6010                    })
6011            }
6012
6013            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
6014            where
6015                E: serde::de::Error,
6016            {
6017                i32::try_from(v)
6018                    .ok()
6019                    .and_then(|x| x.try_into().ok())
6020                    .ok_or_else(|| {
6021                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
6022                    })
6023            }
6024
6025            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6026            where
6027                E: serde::de::Error,
6028            {
6029                match value {
6030                    "ENGINE_UNSPECIFIED" => Ok(table::Engine::Unspecified),
6031                    "HUMMOCK" => Ok(table::Engine::Hummock),
6032                    "ICEBERG" => Ok(table::Engine::Iceberg),
6033                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
6034                }
6035            }
6036        }
6037        deserializer.deserialize_any(GeneratedVisitor)
6038    }
6039}
6040impl serde::Serialize for table::TableType {
6041    #[allow(deprecated)]
6042    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6043    where
6044        S: serde::Serializer,
6045    {
6046        let variant = match self {
6047            Self::Unspecified => "UNSPECIFIED",
6048            Self::Table => "TABLE",
6049            Self::MaterializedView => "MATERIALIZED_VIEW",
6050            Self::Index => "INDEX",
6051            Self::Internal => "INTERNAL",
6052        };
6053        serializer.serialize_str(variant)
6054    }
6055}
6056impl<'de> serde::Deserialize<'de> for table::TableType {
6057    #[allow(deprecated)]
6058    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6059    where
6060        D: serde::Deserializer<'de>,
6061    {
6062        const FIELDS: &[&str] = &[
6063            "UNSPECIFIED",
6064            "TABLE",
6065            "MATERIALIZED_VIEW",
6066            "INDEX",
6067            "INTERNAL",
6068        ];
6069
6070        struct GeneratedVisitor;
6071
6072        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
6073            type Value = table::TableType;
6074
6075            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6076                write!(formatter, "expected one of: {:?}", &FIELDS)
6077            }
6078
6079            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
6080            where
6081                E: serde::de::Error,
6082            {
6083                i32::try_from(v)
6084                    .ok()
6085                    .and_then(|x| x.try_into().ok())
6086                    .ok_or_else(|| {
6087                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
6088                    })
6089            }
6090
6091            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
6092            where
6093                E: serde::de::Error,
6094            {
6095                i32::try_from(v)
6096                    .ok()
6097                    .and_then(|x| x.try_into().ok())
6098                    .ok_or_else(|| {
6099                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
6100                    })
6101            }
6102
6103            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6104            where
6105                E: serde::de::Error,
6106            {
6107                match value {
6108                    "UNSPECIFIED" => Ok(table::TableType::Unspecified),
6109                    "TABLE" => Ok(table::TableType::Table),
6110                    "MATERIALIZED_VIEW" => Ok(table::TableType::MaterializedView),
6111                    "INDEX" => Ok(table::TableType::Index),
6112                    "INTERNAL" => Ok(table::TableType::Internal),
6113                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
6114                }
6115            }
6116        }
6117        deserializer.deserialize_any(GeneratedVisitor)
6118    }
6119}
6120impl serde::Serialize for table::TableVersion {
6121    #[allow(deprecated)]
6122    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6123    where
6124        S: serde::Serializer,
6125    {
6126        use serde::ser::SerializeStruct;
6127        let mut len = 0;
6128        if self.version != 0 {
6129            len += 1;
6130        }
6131        if self.next_column_id != 0 {
6132            len += 1;
6133        }
6134        let mut struct_ser = serializer.serialize_struct("catalog.Table.TableVersion", len)?;
6135        if self.version != 0 {
6136            #[allow(clippy::needless_borrow)]
6137            #[allow(clippy::needless_borrows_for_generic_args)]
6138            struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
6139        }
6140        if self.next_column_id != 0 {
6141            struct_ser.serialize_field("nextColumnId", &self.next_column_id)?;
6142        }
6143        struct_ser.end()
6144    }
6145}
6146impl<'de> serde::Deserialize<'de> for table::TableVersion {
6147    #[allow(deprecated)]
6148    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6149    where
6150        D: serde::Deserializer<'de>,
6151    {
6152        const FIELDS: &[&str] = &[
6153            "version",
6154            "next_column_id",
6155            "nextColumnId",
6156        ];
6157
6158        #[allow(clippy::enum_variant_names)]
6159        enum GeneratedField {
6160            Version,
6161            NextColumnId,
6162        }
6163        impl<'de> serde::Deserialize<'de> for GeneratedField {
6164            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
6165            where
6166                D: serde::Deserializer<'de>,
6167            {
6168                struct GeneratedVisitor;
6169
6170                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
6171                    type Value = GeneratedField;
6172
6173                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6174                        write!(formatter, "expected one of: {:?}", &FIELDS)
6175                    }
6176
6177                    #[allow(unused_variables)]
6178                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
6179                    where
6180                        E: serde::de::Error,
6181                    {
6182                        match value {
6183                            "version" => Ok(GeneratedField::Version),
6184                            "nextColumnId" | "next_column_id" => Ok(GeneratedField::NextColumnId),
6185                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
6186                        }
6187                    }
6188                }
6189                deserializer.deserialize_identifier(GeneratedVisitor)
6190            }
6191        }
6192        struct GeneratedVisitor;
6193        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
6194            type Value = table::TableVersion;
6195
6196            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6197                formatter.write_str("struct catalog.Table.TableVersion")
6198            }
6199
6200            fn visit_map<V>(self, mut map_: V) -> std::result::Result<table::TableVersion, V::Error>
6201                where
6202                    V: serde::de::MapAccess<'de>,
6203            {
6204                let mut version__ = None;
6205                let mut next_column_id__ = None;
6206                while let Some(k) = map_.next_key()? {
6207                    match k {
6208                        GeneratedField::Version => {
6209                            if version__.is_some() {
6210                                return Err(serde::de::Error::duplicate_field("version"));
6211                            }
6212                            version__ = 
6213                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
6214                            ;
6215                        }
6216                        GeneratedField::NextColumnId => {
6217                            if next_column_id__.is_some() {
6218                                return Err(serde::de::Error::duplicate_field("nextColumnId"));
6219                            }
6220                            next_column_id__ = 
6221                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
6222                            ;
6223                        }
6224                    }
6225                }
6226                Ok(table::TableVersion {
6227                    version: version__.unwrap_or_default(),
6228                    next_column_id: next_column_id__.unwrap_or_default(),
6229                })
6230            }
6231        }
6232        deserializer.deserialize_struct("catalog.Table.TableVersion", FIELDS, GeneratedVisitor)
6233    }
6234}
6235impl serde::Serialize for View {
6236    #[allow(deprecated)]
6237    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6238    where
6239        S: serde::Serializer,
6240    {
6241        use serde::ser::SerializeStruct;
6242        let mut len = 0;
6243        if self.id != 0 {
6244            len += 1;
6245        }
6246        if self.schema_id != 0 {
6247            len += 1;
6248        }
6249        if self.database_id != 0 {
6250            len += 1;
6251        }
6252        if !self.name.is_empty() {
6253            len += 1;
6254        }
6255        if self.owner != 0 {
6256            len += 1;
6257        }
6258        if !self.properties.is_empty() {
6259            len += 1;
6260        }
6261        if !self.sql.is_empty() {
6262            len += 1;
6263        }
6264        if !self.dependent_relations.is_empty() {
6265            len += 1;
6266        }
6267        if !self.columns.is_empty() {
6268            len += 1;
6269        }
6270        let mut struct_ser = serializer.serialize_struct("catalog.View", len)?;
6271        if self.id != 0 {
6272            struct_ser.serialize_field("id", &self.id)?;
6273        }
6274        if self.schema_id != 0 {
6275            struct_ser.serialize_field("schemaId", &self.schema_id)?;
6276        }
6277        if self.database_id != 0 {
6278            struct_ser.serialize_field("databaseId", &self.database_id)?;
6279        }
6280        if !self.name.is_empty() {
6281            struct_ser.serialize_field("name", &self.name)?;
6282        }
6283        if self.owner != 0 {
6284            struct_ser.serialize_field("owner", &self.owner)?;
6285        }
6286        if !self.properties.is_empty() {
6287            struct_ser.serialize_field("properties", &self.properties)?;
6288        }
6289        if !self.sql.is_empty() {
6290            struct_ser.serialize_field("sql", &self.sql)?;
6291        }
6292        if !self.dependent_relations.is_empty() {
6293            struct_ser.serialize_field("dependentRelations", &self.dependent_relations)?;
6294        }
6295        if !self.columns.is_empty() {
6296            struct_ser.serialize_field("columns", &self.columns)?;
6297        }
6298        struct_ser.end()
6299    }
6300}
6301impl<'de> serde::Deserialize<'de> for View {
6302    #[allow(deprecated)]
6303    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6304    where
6305        D: serde::Deserializer<'de>,
6306    {
6307        const FIELDS: &[&str] = &[
6308            "id",
6309            "schema_id",
6310            "schemaId",
6311            "database_id",
6312            "databaseId",
6313            "name",
6314            "owner",
6315            "properties",
6316            "sql",
6317            "dependent_relations",
6318            "dependentRelations",
6319            "columns",
6320        ];
6321
6322        #[allow(clippy::enum_variant_names)]
6323        enum GeneratedField {
6324            Id,
6325            SchemaId,
6326            DatabaseId,
6327            Name,
6328            Owner,
6329            Properties,
6330            Sql,
6331            DependentRelations,
6332            Columns,
6333        }
6334        impl<'de> serde::Deserialize<'de> for GeneratedField {
6335            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
6336            where
6337                D: serde::Deserializer<'de>,
6338            {
6339                struct GeneratedVisitor;
6340
6341                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
6342                    type Value = GeneratedField;
6343
6344                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6345                        write!(formatter, "expected one of: {:?}", &FIELDS)
6346                    }
6347
6348                    #[allow(unused_variables)]
6349                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
6350                    where
6351                        E: serde::de::Error,
6352                    {
6353                        match value {
6354                            "id" => Ok(GeneratedField::Id),
6355                            "schemaId" | "schema_id" => Ok(GeneratedField::SchemaId),
6356                            "databaseId" | "database_id" => Ok(GeneratedField::DatabaseId),
6357                            "name" => Ok(GeneratedField::Name),
6358                            "owner" => Ok(GeneratedField::Owner),
6359                            "properties" => Ok(GeneratedField::Properties),
6360                            "sql" => Ok(GeneratedField::Sql),
6361                            "dependentRelations" | "dependent_relations" => Ok(GeneratedField::DependentRelations),
6362                            "columns" => Ok(GeneratedField::Columns),
6363                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
6364                        }
6365                    }
6366                }
6367                deserializer.deserialize_identifier(GeneratedVisitor)
6368            }
6369        }
6370        struct GeneratedVisitor;
6371        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
6372            type Value = View;
6373
6374            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6375                formatter.write_str("struct catalog.View")
6376            }
6377
6378            fn visit_map<V>(self, mut map_: V) -> std::result::Result<View, V::Error>
6379                where
6380                    V: serde::de::MapAccess<'de>,
6381            {
6382                let mut id__ = None;
6383                let mut schema_id__ = None;
6384                let mut database_id__ = None;
6385                let mut name__ = None;
6386                let mut owner__ = None;
6387                let mut properties__ = None;
6388                let mut sql__ = None;
6389                let mut dependent_relations__ = None;
6390                let mut columns__ = None;
6391                while let Some(k) = map_.next_key()? {
6392                    match k {
6393                        GeneratedField::Id => {
6394                            if id__.is_some() {
6395                                return Err(serde::de::Error::duplicate_field("id"));
6396                            }
6397                            id__ = 
6398                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
6399                            ;
6400                        }
6401                        GeneratedField::SchemaId => {
6402                            if schema_id__.is_some() {
6403                                return Err(serde::de::Error::duplicate_field("schemaId"));
6404                            }
6405                            schema_id__ = 
6406                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
6407                            ;
6408                        }
6409                        GeneratedField::DatabaseId => {
6410                            if database_id__.is_some() {
6411                                return Err(serde::de::Error::duplicate_field("databaseId"));
6412                            }
6413                            database_id__ = 
6414                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
6415                            ;
6416                        }
6417                        GeneratedField::Name => {
6418                            if name__.is_some() {
6419                                return Err(serde::de::Error::duplicate_field("name"));
6420                            }
6421                            name__ = Some(map_.next_value()?);
6422                        }
6423                        GeneratedField::Owner => {
6424                            if owner__.is_some() {
6425                                return Err(serde::de::Error::duplicate_field("owner"));
6426                            }
6427                            owner__ = 
6428                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
6429                            ;
6430                        }
6431                        GeneratedField::Properties => {
6432                            if properties__.is_some() {
6433                                return Err(serde::de::Error::duplicate_field("properties"));
6434                            }
6435                            properties__ = Some(
6436                                map_.next_value::<std::collections::BTreeMap<_, _>>()?
6437                            );
6438                        }
6439                        GeneratedField::Sql => {
6440                            if sql__.is_some() {
6441                                return Err(serde::de::Error::duplicate_field("sql"));
6442                            }
6443                            sql__ = Some(map_.next_value()?);
6444                        }
6445                        GeneratedField::DependentRelations => {
6446                            if dependent_relations__.is_some() {
6447                                return Err(serde::de::Error::duplicate_field("dependentRelations"));
6448                            }
6449                            dependent_relations__ = 
6450                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
6451                                    .into_iter().map(|x| x.0).collect())
6452                            ;
6453                        }
6454                        GeneratedField::Columns => {
6455                            if columns__.is_some() {
6456                                return Err(serde::de::Error::duplicate_field("columns"));
6457                            }
6458                            columns__ = Some(map_.next_value()?);
6459                        }
6460                    }
6461                }
6462                Ok(View {
6463                    id: id__.unwrap_or_default(),
6464                    schema_id: schema_id__.unwrap_or_default(),
6465                    database_id: database_id__.unwrap_or_default(),
6466                    name: name__.unwrap_or_default(),
6467                    owner: owner__.unwrap_or_default(),
6468                    properties: properties__.unwrap_or_default(),
6469                    sql: sql__.unwrap_or_default(),
6470                    dependent_relations: dependent_relations__.unwrap_or_default(),
6471                    columns: columns__.unwrap_or_default(),
6472                })
6473            }
6474        }
6475        deserializer.deserialize_struct("catalog.View", FIELDS, GeneratedVisitor)
6476    }
6477}
6478impl serde::Serialize for WatermarkDesc {
6479    #[allow(deprecated)]
6480    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6481    where
6482        S: serde::Serializer,
6483    {
6484        use serde::ser::SerializeStruct;
6485        let mut len = 0;
6486        if self.watermark_idx != 0 {
6487            len += 1;
6488        }
6489        if self.expr.is_some() {
6490            len += 1;
6491        }
6492        let mut struct_ser = serializer.serialize_struct("catalog.WatermarkDesc", len)?;
6493        if self.watermark_idx != 0 {
6494            struct_ser.serialize_field("watermarkIdx", &self.watermark_idx)?;
6495        }
6496        if let Some(v) = self.expr.as_ref() {
6497            struct_ser.serialize_field("expr", v)?;
6498        }
6499        struct_ser.end()
6500    }
6501}
6502impl<'de> serde::Deserialize<'de> for WatermarkDesc {
6503    #[allow(deprecated)]
6504    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6505    where
6506        D: serde::Deserializer<'de>,
6507    {
6508        const FIELDS: &[&str] = &[
6509            "watermark_idx",
6510            "watermarkIdx",
6511            "expr",
6512        ];
6513
6514        #[allow(clippy::enum_variant_names)]
6515        enum GeneratedField {
6516            WatermarkIdx,
6517            Expr,
6518        }
6519        impl<'de> serde::Deserialize<'de> for GeneratedField {
6520            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
6521            where
6522                D: serde::Deserializer<'de>,
6523            {
6524                struct GeneratedVisitor;
6525
6526                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
6527                    type Value = GeneratedField;
6528
6529                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6530                        write!(formatter, "expected one of: {:?}", &FIELDS)
6531                    }
6532
6533                    #[allow(unused_variables)]
6534                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
6535                    where
6536                        E: serde::de::Error,
6537                    {
6538                        match value {
6539                            "watermarkIdx" | "watermark_idx" => Ok(GeneratedField::WatermarkIdx),
6540                            "expr" => Ok(GeneratedField::Expr),
6541                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
6542                        }
6543                    }
6544                }
6545                deserializer.deserialize_identifier(GeneratedVisitor)
6546            }
6547        }
6548        struct GeneratedVisitor;
6549        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
6550            type Value = WatermarkDesc;
6551
6552            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6553                formatter.write_str("struct catalog.WatermarkDesc")
6554            }
6555
6556            fn visit_map<V>(self, mut map_: V) -> std::result::Result<WatermarkDesc, V::Error>
6557                where
6558                    V: serde::de::MapAccess<'de>,
6559            {
6560                let mut watermark_idx__ = None;
6561                let mut expr__ = None;
6562                while let Some(k) = map_.next_key()? {
6563                    match k {
6564                        GeneratedField::WatermarkIdx => {
6565                            if watermark_idx__.is_some() {
6566                                return Err(serde::de::Error::duplicate_field("watermarkIdx"));
6567                            }
6568                            watermark_idx__ = 
6569                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
6570                            ;
6571                        }
6572                        GeneratedField::Expr => {
6573                            if expr__.is_some() {
6574                                return Err(serde::de::Error::duplicate_field("expr"));
6575                            }
6576                            expr__ = map_.next_value()?;
6577                        }
6578                    }
6579                }
6580                Ok(WatermarkDesc {
6581                    watermark_idx: watermark_idx__.unwrap_or_default(),
6582                    expr: expr__,
6583                })
6584            }
6585        }
6586        deserializer.deserialize_struct("catalog.WatermarkDesc", FIELDS, GeneratedVisitor)
6587    }
6588}
6589impl serde::Serialize for WebhookSourceInfo {
6590    #[allow(deprecated)]
6591    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6592    where
6593        S: serde::Serializer,
6594    {
6595        use serde::ser::SerializeStruct;
6596        let mut len = 0;
6597        if self.secret_ref.is_some() {
6598            len += 1;
6599        }
6600        if self.signature_expr.is_some() {
6601            len += 1;
6602        }
6603        if self.wait_for_persistence {
6604            len += 1;
6605        }
6606        let mut struct_ser = serializer.serialize_struct("catalog.WebhookSourceInfo", len)?;
6607        if let Some(v) = self.secret_ref.as_ref() {
6608            struct_ser.serialize_field("secretRef", v)?;
6609        }
6610        if let Some(v) = self.signature_expr.as_ref() {
6611            struct_ser.serialize_field("signatureExpr", v)?;
6612        }
6613        if self.wait_for_persistence {
6614            struct_ser.serialize_field("waitForPersistence", &self.wait_for_persistence)?;
6615        }
6616        struct_ser.end()
6617    }
6618}
6619impl<'de> serde::Deserialize<'de> for WebhookSourceInfo {
6620    #[allow(deprecated)]
6621    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6622    where
6623        D: serde::Deserializer<'de>,
6624    {
6625        const FIELDS: &[&str] = &[
6626            "secret_ref",
6627            "secretRef",
6628            "signature_expr",
6629            "signatureExpr",
6630            "wait_for_persistence",
6631            "waitForPersistence",
6632        ];
6633
6634        #[allow(clippy::enum_variant_names)]
6635        enum GeneratedField {
6636            SecretRef,
6637            SignatureExpr,
6638            WaitForPersistence,
6639        }
6640        impl<'de> serde::Deserialize<'de> for GeneratedField {
6641            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
6642            where
6643                D: serde::Deserializer<'de>,
6644            {
6645                struct GeneratedVisitor;
6646
6647                impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
6648                    type Value = GeneratedField;
6649
6650                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6651                        write!(formatter, "expected one of: {:?}", &FIELDS)
6652                    }
6653
6654                    #[allow(unused_variables)]
6655                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
6656                    where
6657                        E: serde::de::Error,
6658                    {
6659                        match value {
6660                            "secretRef" | "secret_ref" => Ok(GeneratedField::SecretRef),
6661                            "signatureExpr" | "signature_expr" => Ok(GeneratedField::SignatureExpr),
6662                            "waitForPersistence" | "wait_for_persistence" => Ok(GeneratedField::WaitForPersistence),
6663                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
6664                        }
6665                    }
6666                }
6667                deserializer.deserialize_identifier(GeneratedVisitor)
6668            }
6669        }
6670        struct GeneratedVisitor;
6671        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
6672            type Value = WebhookSourceInfo;
6673
6674            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6675                formatter.write_str("struct catalog.WebhookSourceInfo")
6676            }
6677
6678            fn visit_map<V>(self, mut map_: V) -> std::result::Result<WebhookSourceInfo, V::Error>
6679                where
6680                    V: serde::de::MapAccess<'de>,
6681            {
6682                let mut secret_ref__ = None;
6683                let mut signature_expr__ = None;
6684                let mut wait_for_persistence__ = None;
6685                while let Some(k) = map_.next_key()? {
6686                    match k {
6687                        GeneratedField::SecretRef => {
6688                            if secret_ref__.is_some() {
6689                                return Err(serde::de::Error::duplicate_field("secretRef"));
6690                            }
6691                            secret_ref__ = map_.next_value()?;
6692                        }
6693                        GeneratedField::SignatureExpr => {
6694                            if signature_expr__.is_some() {
6695                                return Err(serde::de::Error::duplicate_field("signatureExpr"));
6696                            }
6697                            signature_expr__ = map_.next_value()?;
6698                        }
6699                        GeneratedField::WaitForPersistence => {
6700                            if wait_for_persistence__.is_some() {
6701                                return Err(serde::de::Error::duplicate_field("waitForPersistence"));
6702                            }
6703                            wait_for_persistence__ = Some(map_.next_value()?);
6704                        }
6705                    }
6706                }
6707                Ok(WebhookSourceInfo {
6708                    secret_ref: secret_ref__,
6709                    signature_expr: signature_expr__,
6710                    wait_for_persistence: wait_for_persistence__.unwrap_or_default(),
6711                })
6712            }
6713        }
6714        deserializer.deserialize_struct("catalog.WebhookSourceInfo", FIELDS, GeneratedVisitor)
6715    }
6716}