jorgecarleitao commented on a change in pull request #9840:
URL: https://github.com/apache/arrow/pull/9840#discussion_r605123656



##########
File path: rust/datafusion/src/catalog/information_schema.rs
##########
@@ -221,3 +262,226 @@ impl InformationSchemaTablesBuilder {
         MemTable::try_new(schema, vec![vec![batch]]).unwrap()
     }
 }
+
+/// Builds the `information_schema.COLUMNS` table row by row
+///
+/// Columns are based on 
https://www.postgresql.org/docs/current/infoschema-columns.html
+struct InformationSchemaColumnsBuilder {
+    catalog_names: StringBuilder,
+    schema_names: StringBuilder,
+    table_names: StringBuilder,
+    column_names: StringBuilder,
+    ordinal_positions: UInt64Builder,
+    column_defaults: StringBuilder,
+    is_nullables: StringBuilder,
+    data_types: StringBuilder,
+    character_maximum_lengths: UInt64Builder,
+    character_octet_lengths: UInt64Builder,
+    numeric_precisions: UInt64Builder,
+    numeric_precision_radixes: UInt64Builder,
+    numeric_scales: UInt64Builder,
+    datetime_precisions: UInt64Builder,
+    interval_types: StringBuilder,
+}
+
+impl InformationSchemaColumnsBuilder {
+    fn new() -> Self {
+        // StringBuilder requires providing an initial capacity, so
+        // pick 10 here arbitrarily as this is not performance
+        // critical code and the number of tables is unavailable here.
+        let default_capacity = 10;
+        Self {
+            catalog_names: StringBuilder::new(default_capacity),
+            schema_names: StringBuilder::new(default_capacity),
+            table_names: StringBuilder::new(default_capacity),
+            column_names: StringBuilder::new(default_capacity),
+            ordinal_positions: UInt64Builder::new(default_capacity),
+            column_defaults: StringBuilder::new(default_capacity),
+            is_nullables: StringBuilder::new(default_capacity),
+            data_types: StringBuilder::new(default_capacity),
+            character_maximum_lengths: UInt64Builder::new(default_capacity),
+            character_octet_lengths: UInt64Builder::new(default_capacity),
+            numeric_precisions: UInt64Builder::new(default_capacity),
+            numeric_precision_radixes: UInt64Builder::new(default_capacity),
+            numeric_scales: UInt64Builder::new(default_capacity),
+            datetime_precisions: UInt64Builder::new(default_capacity),
+            interval_types: StringBuilder::new(default_capacity),
+        }
+    }
+
+    fn add_column(
+        &mut self,
+        catalog_name: impl AsRef<str>,
+        schema_name: impl AsRef<str>,
+        table_name: impl AsRef<str>,
+        column_name: impl AsRef<str>,

Review comment:
       yeah, it was really just if you had not though about it. No need to 
change anything imo 👍 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to