Skip to content

Commit

Permalink
delta lake and iceberg table support (#43)
Browse files Browse the repository at this point in the history
* delta support

* imports
  • Loading branch information
raviranak committed Nov 19, 2023
1 parent 2afe45e commit b473f53
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion raysql/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import raysql
from raysql import Context, ExecutionGraph, QueryStage

from typing import List

def schedule_execution(
graph: ExecutionGraph,
Expand Down Expand Up @@ -203,6 +203,9 @@ def register_csv(self, table_name: str, path: str, has_header: bool):
def register_parquet(self, table_name: str, path: str):
self.ctx.register_parquet(table_name, path)

def register_data_lake(self, table_name: str, paths: List[str]):
self.ctx.register_datalake_table(table_name, paths)

def sql(self, sql: str) -> pa.RecordBatch:
# TODO we should parse sql and inspect the plan rather than
# perform a string comparison here
Expand Down
10 changes: 10 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ impl PyContext {
Ok(())
}

pub fn register_datalake_table(&self, name: &str, path: Vec<&str>, py: Python) -> PyResult<()> {
let options = ParquetReadOptions::default();
let listing_options = options.to_listing_options(&self.ctx.state().config());
wait_for_future(py, self.ctx.register_listing_table(name, path, listing_options, None, None))?;
Ok(())
}




/// Execute SQL directly against the DataFusion context. Useful for statements
/// such as "create view" or "drop view"
pub fn sql(&self, sql: &str, py: Python) -> PyResult<()> {
Expand Down

0 comments on commit b473f53

Please sign in to comment.