alamb commented on code in PR #8993:
URL: https://github.com/apache/arrow-datafusion/pull/8993#discussion_r1466618879
##########
datafusion/core/src/catalog/information_schema.rs:
##########
@@ -115,6 +117,33 @@ impl InformationSchemaConfig {
DF_SETTINGS,
TableType::View,
);
+ builder.add_table(
+ &catalog_name,
+ INFORMATION_SCHEMA,
+ SCHEMATA,
+ TableType::View,
+ );
+ }
+ }
+
+ async fn make_schemata(&self, builder: &mut InformationSchemataBuilder) {
+ for catalog_name in self.catalog_list.catalog_names() {
+ let catalog = self.catalog_list.catalog(&catalog_name).unwrap();
+
+ for schema_name in catalog.schema_names() {
+ if schema_name != INFORMATION_SCHEMA {
+ // schema name may not exist in the catalog, so we need to
check
+ // then get user from env
+ let schema_owner = match std::env::var("USER") {
+ Ok(user) => user,
+ Err(_) => match std::env::var("USERNAME") {
+ Ok(user) => user,
+ Err(_) => "".to_owned(),
+ },
+ };
Review Comment:
I agree pulling from the environment is not consistent with how the rest of
DataFusion works. I think the owner should come from the `SchemaProvider`
However there is no notion of `owner` on `SchemaProvider` now
Thus, I suggest either:
1. Leaving owner `NULL` for now
2. Add a function to the `SchemaProvider` to optionally provide a an owner
For example
```rust
trait SchemaProvider {
// return the "schema owner" of known, reported in
`information_schema.schemata`
// Returns `None` by default
fn owner_name(&self) -> Option<&str> {
None
}
}
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]