Append a row
(
&mut self,
catalog_name: impl AsRef<str>,
schema_name: impl AsRef<str>,
table_name: impl AsRef<str>,
table_type: impl AsRef<str>,
table_schema: &Schem
| 133 | |
| 134 | /// Append a row |
| 135 | pub fn append( |
| 136 | &mut self, |
| 137 | catalog_name: impl AsRef<str>, |
| 138 | schema_name: impl AsRef<str>, |
| 139 | table_name: impl AsRef<str>, |
| 140 | table_type: impl AsRef<str>, |
| 141 | table_schema: &Schema, |
| 142 | ) -> Result<()> { |
| 143 | self.catalog_name.append_value(catalog_name); |
| 144 | self.db_schema_name.append_value(schema_name); |
| 145 | self.table_name.append_value(table_name); |
| 146 | self.table_type.append_value(table_type); |
| 147 | if let Some(self_table_schema) = self.table_schema.as_mut() { |
| 148 | let options = IpcWriteOptions::default(); |
| 149 | // encode the schema into the correct form |
| 150 | let message: std::result::Result<IpcMessage, _> = |
| 151 | SchemaAsIpc::new(table_schema, &options).try_into(); |
| 152 | let IpcMessage(schema) = message?; |
| 153 | self_table_schema.append_value(schema); |
| 154 | } |
| 155 | |
| 156 | Ok(()) |
| 157 | } |
| 158 | |
| 159 | /// builds a `RecordBatch` for `CommandGetTables` |
| 160 | pub fn build(self) -> Result<RecordBatch> { |