Skip to content

Commit

Permalink
maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
gtarpenning committed Oct 25, 2024
1 parent 3cfa0ec commit 11e6aa5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions tests/trace_server/test_calls_query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ def assert_sql(cq: CallsQuery, exp_queries, exp_params):
queries = cq.as_sql(pb)
params = pb.get_params()

assert exp_params == params
assert len(queries) == len(exp_queries)

for qr, qe in zip(queries, exp_queries):
exp_formatted = sqlparse.format(qe, reindent=True)
found_formatted = sqlparse.format(qr, reindent=True)

assert exp_formatted == found_formatted

assert exp_params == params


def test_query_baseline() -> None:
cq = CallsQuery(project_id="project")
Expand Down
6 changes: 3 additions & 3 deletions weave/trace_server/calls_query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ def as_sql(self, pb: ParamBuilder, table_alias: str = "calls_merged") -> list[st
)
)

should_optimize = (
should_optimize = self.should_do_two_step_query() or (
has_heavy_fields and do_predicate_pushdown
) or self.include_costs
if not should_optimize:
)
if not should_optimize and not self.include_costs:
return [self._as_sql_base_format(pb, table_alias)]

# Build the two queries
Expand Down

0 comments on commit 11e6aa5

Please sign in to comment.