Skip to content

Commit

Permalink
Exclude all DDL statements from Ray scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
ccciudatu committed Nov 24, 2024
1 parent 31f8833 commit 351ba68
Showing 1 changed file with 4 additions and 8 deletions.
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

0 comments on commit 351ba68

Please sign in to comment.