Skip to content

Commit

Permalink
create a method for execution changes
Browse files Browse the repository at this point in the history
  • Loading branch information
EpsilonPrime committed Sep 20, 2024
1 parent b4927d2 commit 6f6ad9d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gateway/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def reset(self):
self.reattach_requests = 0
self.release_requests = 0
self.database_resets = 0
self.engine_changes = 0

self.requests = []
self.plans = []
Expand Down Expand Up @@ -234,6 +235,11 @@ def _ReinitializeExecution(self) -> None:
self._sql_backend.reset_connection()
return None

def _ChangeExecution(self) -> None:
self._statistics.engine_changes += 1
self._backend = None
self._sql_backend = None

def ExecutePlan(
self, request: pb2.ExecutePlanRequest, context: grpc.RpcContext
) -> Generator[pb2.ExecutePlanResponse, None, None]:
Expand Down Expand Up @@ -401,8 +407,7 @@ def Config(self, request, context):
case _:
raise ValueError(f"Unknown backend: {pair.value}")
if need_reset:
self._backend = None
self._sql_backend = None
self._ChangeExecution()
elif pair.key == "spark-substrait-gateway.reset_statistics":
self._statistics.reset()
response.pairs.extend(request.operation.set.pairs)
Expand Down

0 comments on commit 6f6ad9d

Please sign in to comment.