Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions datafusion_ray/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,11 @@ 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
sql_str = sql.lower()
if "create view" in sql_str or "drop view" in sql_str:
self.ctx.sql(sql)
return []

df = self.df_ctx.sql(sql)
return self.plan(df.execution_plan())
execution_plan = df.execution_plan()
if execution_plan.display().strip() == "EmptyExec":
return [] # No ray scheduling for DDL statements
return self.plan(execution_plan)

def plan(self, execution_plan: Any) -> pa.RecordBatch:

Expand Down