-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jay Chia
committed
Oct 21, 2024
1 parent
9bd00db
commit b0c2036
Showing
13 changed files
with
504 additions
and
130 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[dependencies] | ||
aws-config = {version = "0.55.3", features = ["native-tls", "rt-tokio", "client-hyper", "credentials-sso"], default-features = false} | ||
aws-sdk-glue = {version = "1.66.0", features = ["rt-tokio"], default-features = false} | ||
daft-catalog = {path = "..", default-features = false} | ||
daft-catalog-pyiceberg = {path = "../pyiceberg", optional = true} | ||
pyo3 = {workspace = true, optional = true} | ||
|
||
[features] | ||
python = ["dep:pyo3", "dep:daft-catalog-pyiceberg"] | ||
|
||
[package] | ||
name = "daft-catalog-aws-glue" | ||
edition.workspace = true | ||
version.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#[cfg(feature = "python")] | ||
pub mod python; | ||
|
||
struct AWSGlueCatalog {} | ||
|
||
impl daft_catalog::DataCatalog for AWSGlueCatalog { | ||
fn list_tables(&self, _prefix: &str) -> Vec<String> { | ||
todo!(); | ||
} | ||
|
||
fn get_table(&self, _name: &str) -> Option<Box<dyn daft_catalog::DataCatalogTable>> { | ||
// Make a request to AWS Glue to find the table | ||
// If the table metadata indicates that this is an iceberg table, then delegate to PyIceberg to read | ||
// NOTE: we have to throw an import error if the pyiceberg_catalog isn't instantiated, indicating that PyIceberg | ||
// is not installed. | ||
todo!("Detect from the table metadata that this is an iceberg table, then delegate to pyiceberg"); | ||
} | ||
} | ||
|
||
impl AWSGlueCatalog { | ||
pub fn new() -> Self { | ||
// Naively instantiate this, which under the hood may naively be a no-op if PyIceberg isn't installed | ||
// let pyiceberg_catalog = PyIcebergCatalog::new_glue(); // TODO | ||
|
||
AWSGlueCatalog {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use std::sync::Arc; | ||
|
||
use pyo3::prelude::*; | ||
|
||
use crate::AWSGlueCatalog; | ||
|
||
/// Registers an AWS Glue catalog instance with Daft | ||
#[pyfunction] | ||
#[pyo3(name = "register_aws_glue_catalog")] | ||
pub fn register_aws_glue_catalog(name: Option<&str>) -> PyResult<()> { | ||
let catalog = AWSGlueCatalog::new(); | ||
daft_catalog::global_catalog::register_catalog(Arc::new(catalog), name); | ||
Ok(()) | ||
} | ||
|
||
pub fn register_modules(parent: &Bound<PyModule>) -> PyResult<()> { | ||
parent.add_wrapped(wrap_pyfunction!(register_aws_glue_catalog))?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[dependencies] | ||
daft-catalog = {path = "..", default-features = false} | ||
daft-plan = {path = "../../daft-plan", default-features = false} | ||
pyo3 = {workspace = true} | ||
|
||
[package] | ||
description = "PyIceberg implementations of Daft DataCatalogTable (backed by a PyIceberg table)" | ||
name = "daft-catalog-pyiceberg" | ||
edition.workspace = true | ||
version.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use daft_catalog::{errors::Result, DataCatalogTable}; | ||
use daft_plan::LogicalPlanBuilder; | ||
|
||
/// Wrapper around PyIceberg, or None if PyIceberg is not installed | ||
pub struct PyIcebergTable {} // TODO: Add a PyObject in here | ||
|
||
/// Wrapper around PyIceberg, or None if PyIceberg is not installed | ||
pub struct PyIcebergCatalog {} // TODO: Add a PyObject in here | ||
|
||
impl DataCatalogTable for PyIcebergTable { | ||
fn to_logical_plan_builder(&self) -> Result<LogicalPlanBuilder> { | ||
todo!(); | ||
} | ||
} | ||
|
||
impl PyIcebergCatalog { | ||
pub fn new_glue() -> Self { | ||
todo!("import the pyiceberg library and initialize a GlueCatalog"); | ||
} | ||
|
||
pub fn load_table(&self) -> PyIcebergTable { | ||
todo!("Load a PyIcebergTable from the inner catalog object") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
use daft_plan::LogicalPlanBuilder; | ||
|
||
use crate::errors; | ||
|
||
/// A Table in a Data Catalog | ||
/// | ||
/// This is a trait because there are many different implementations of this, for example | ||
/// Iceberg, DeltaLake, Hive and more. | ||
pub trait DataCatalogTable {} | ||
pub trait DataCatalogTable { | ||
fn to_logical_plan_builder(&self) -> errors::Result<LogicalPlanBuilder>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters