Skip to content

Commit

Permalink
Handle empty slices
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffxy committed Dec 4, 2023
1 parent 908c91c commit 6f180d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/brad/planner/scoring/performance/unified_aurora.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ def predict_query_latency_load_resources(
cpu_util: float,
ctx: "ScoringContext",
) -> npt.NDArray:
if base_predicted_latency.shape[0] == 0:
return base_predicted_latency

# 1. Compute each query's expected run time on the given provisioning.
resource_factor = _AURORA_BASE_RESOURCE_VALUE / aurora_num_cpus(to_prov)
basis = np.array([resource_factor, 1.0])
Expand Down
3 changes: 3 additions & 0 deletions src/brad/planner/scoring/performance/unified_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ def predict_query_latency_load_resources(
overall_cpu_denorm: float,
ctx: "ScoringContext",
) -> npt.NDArray:
if base_predicted_latency.shape[0] == 0:
return base_predicted_latency

# 1. Compute each query's expected run time on the given provisioning.
resource_factor = _REDSHIFT_BASE_RESOURCE_VALUE / (
redshift_num_cpus(to_prov) * to_prov.num_nodes()
Expand Down

0 comments on commit 6f180d1

Please sign in to comment.