pub fn metadata_columns(&self, include_defaults: bool) -> Vec<(&str, ColumnType)> {
        let mut columns = Vec::new();
        let default_col = |name| (name, ScalarType::Int64.nullable(false));
        match self {
            Self::Kafka(KafkaSourceConnector {
                include_partition: part,
                include_timestamp: time,
                include_topic: topic,
                include_offset: offset,
                ..
            }) => {
                let mut items = BTreeMap::new();
                // put the offset at the end if necessary
                if include_defaults && offset.is_none() {
                    items.insert(4, default_col("mz_offset"));
                }

                for (include, ty) in [
                    (offset, ScalarType::Int64),
                    (part, ScalarType::Int32),
                    (time, ScalarType::Timestamp),
                    (topic, ScalarType::String),
                ] {
                    if let Some(include) = include {
                        items.insert(include.pos + 1, (&include.name, ty.nullable(false)));
                    }
                }

                items.into_values().collect()
            }
            Self::File(_) => {
                if include_defaults {
                    columns.push(default_col("mz_line_no"));
                }
                columns
            }
            Self::Kinesis(_) => {
                if include_defaults {
                    columns.push(default_col("mz_offset"))
                };
                columns
            }
            Self::AvroOcf(_) => {
                if include_defaults {
                    columns.push(default_col("mz_obj_no"))
                };
                columns
            }
            // TODO: should we include object key and possibly object-internal offset here?
            Self::S3(_) => {
                if include_defaults {
                    columns.push(default_col("mz_record"))
                };
                columns
            }
            Self::Postgres(_) => vec![],
            Self::PubNub(_) => vec![],
        }
    }
/// Returns the name and type of each additional metadata column that
/// Materialize will automatically append to the source's inherent columns.
///
/// Presently, each source type exposes precisely one metadata column that
/// corresponds to some source-specific record counter. For example, file
/// sources use a line number, while Kafka sources use a topic offset.
///
/// The columns declared here must be kept in sync with the actual source
/// implementations that produce these columns.
Returns the name and type of each additional metadata column that
Materialize will automatically append to the source's inherent columns.

Presently, each source type exposes precisely one metadata column that
corresponds to some source-specific record counter. For example, file
sources use a line number, while Kafka sources use a topic offset.

The columns declared here must be kept in sync with the actual source
implementations that produce these columns.
Returns the name and type of each additional metadata column that Materialize will automatically append to the source ' s inherent columns . Presently each source type exposes precisely one metadata column that corresponds to some source - specific record counter . For example file sources use a line number while Kafka sources use a topic offset . The columns declared here must be kept in sync with the actual source implementations that produce these columns .
pub fn metadata_columns(&self, include_defaults: bool) -> Vec<(&str, ColumnType)> {
        let mut columns = Vec::new();
        let default_col = |name| (name, ScalarType::Int64.nullable(false));
        match self {
            Self::Kafka(KafkaSourceConnector {
                include_partition: part,
                include_timestamp: time,
                include_topic: topic,
                include_offset: offset,
                ..
            }) => {
                let mut items = BTreeMap::new();
                // put the offset at the end if necessary
                if include_defaults && offset.is_none() {
                    items.insert(4, default_col("mz_offset"));
                }
                for (include, ty) in [
                    (offset, ScalarType::Int64),
                    (part, ScalarType::Int32),
                    (time, ScalarType::Timestamp),
                    (topic, ScalarType::String),
                ] {
                    if let Some(include) = include {
                        items.insert(include.pos + 1, (&include.name, ty.nullable(false)));
                    }
                }
                items.into_values().collect()
            }
            Self::File(_) => {
                if include_defaults {
                    columns.push(default_col("mz_line_no"));
                }
                columns
            }
            Self::Kinesis(_) => {
                if include_defaults {
                    columns.push(default_col("mz_offset"))
                };
                columns
            }
            Self::AvroOcf(_) => {
                if include_defaults {
                    columns.push(default_col("mz_obj_no"))
                };
                columns
            }
            // TODO: should we include object key and possibly object-internal offset here?
            Self::S3(_) => {
                if include_defaults {
                    columns.push(default_col("mz_record"))
                };
                columns
            }
            Self::Postgres(_) => vec![],
            Self::PubNub(_) => vec![],
        }
    }
pub fn metadata_columns ( & self , include_defaults : bool ) -> Vec < ( & str , ColumnType ) > { let mut columns = Vec :: new ( ) ; let default_col = | name | ( name , ScalarType :: Int64 . nullable ( false ) ) ; match self { Self :: Kafka ( KafkaSourceConnector { include_partition : part , include_timestamp : time , include_topic : topic , include_offset : offset , .. } ) => { let mut items = BTreeMap :: new ( ) ; // put the offset at the end if necessary if include_defaults && offset . is_none ( ) { items . insert ( 4 , default_col ( " " ) ) ; } for ( include , ty ) in [ ( offset , ScalarType :: Int64 ) , ( part , ScalarType :: Int32 ) , ( time , ScalarType :: Timestamp ) , ( topic , ScalarType :: String ) , ] { if let Some ( include ) = include { items . insert ( include . pos + 1 , ( & include . name , ty . nullable ( false ) ) ) ; } } items . into_values ( ) . collect ( ) } Self :: File ( _ ) => { if include_defaults { columns . push ( default_col ( " " ) ) ; } columns } Self :: Kinesis ( _ ) => { if include_defaults { columns . push ( default_col ( " " ) ) } ; columns } Self :: AvroOcf ( _ ) => { if include_defaults { columns . push ( default_col ( " " ) ) } ; columns } // TODO: should we include object key and possibly object-internal offset here? Self :: S3 ( _ ) => { if include_defaults { columns . push ( default_col ( " " ) ) } ; columns } Self :: Postgres ( _ ) => vec ! [ ] , Self :: PubNub ( _ ) => vec ! [ ] , } }
Returns the name and type of each additional metadata column that
Materialize will automatically append to the source's inherent columns.
Returns the name and type of each additional metadata column that Materialize will automatically append to the source ' s inherent columns .
&self
include_defaults
bool
&self
include_defaults
bool