Skip to content

Commit

Permalink
implement schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jychen7 committed Feb 28, 2022
1 parent d6f05d0 commit f49aac1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/datasource.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use std::any::Any;
use std::sync::Arc;
use std::collections::HashMap;

use async_trait::async_trait;

use arrow::datatypes::SchemaRef;
use arrow::datatypes::{SchemaRef, Schema, Field};
use datafusion::datasource::TableProvider;
use datafusion::datasource::datasource::TableProviderFilterPushDown;
use datafusion::error::Result;
Expand All @@ -18,7 +19,14 @@ pub struct BigtableTable {
}

impl BigtableTable {
pub fn new(schema: SchemaRef) -> Self {
pub fn new(instance: &str, table: &str, column_family: &str, columns: Vec<Field>, only_read_latest: bool) -> Self {
let metadata = HashMap::from([
("instance".to_string(), instance.to_string()),
("table".to_string(), table.to_string()),
("column_family".to_string(), column_family.to_string()),
("only_read_latest".to_string(), only_read_latest.to_string()),
]);
let schema = Arc::new(Schema::new_with_metadata(columns, metadata));
Self { schema }
}
}
Expand Down

0 comments on commit f49aac1

Please sign in to comment.