Skip to content

Commit

Permalink
fix num_ingredients_in_join > 1 post-process logic
Browse files Browse the repository at this point in the history
  • Loading branch information
parkervg committed Jul 30, 2024
1 parent b4e308a commit af86714
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions blendsql/blend.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,14 +758,14 @@ def _blend(
# Since we haven't executed and saved `{{B()}}` to temp table yet,
# we need to keep. So we get:
temp_uuid = str(uuid.uuid4())
query_context.node = query_context.node.transform(
_node = query_context.node.transform(
transform.replace_join_with_ingredient_multiple_ingredient,
ingredient_name=parsed_results_dict["ingredient_aliasname"],
ingredient_alias=alias_function_str,
temp_uuid=temp_uuid,
).transform(prune_true_where)
query_context.node = query_context.parse(
query_context.to_string().replace(f'SELECT "{temp_uuid}", ', "")
).transform(transform.prune_true_where)
query_context.parse(
str(_node).replace(f'SELECT "{temp_uuid}", ', ""), schema=schema
)
else:
# Case where we have
Expand Down
4 changes: 2 additions & 2 deletions blendsql/ingredients/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def unpack_options(
tablename = aliases_to_tablenames.get(tablename, tablename)
# Optionally materialize a CTE
if tablename in db.lazy_tables:
unpacked_options = (
unpacked_options: list = (
db.lazy_tables.pop(tablename).collect()[colname].unique().tolist()
)
else:
unpacked_options = db.execute_to_list(
unpacked_options: list = db.execute_to_list(
f'SELECT DISTINCT "{colname}" FROM "{tablename}"'
)
except ValueError:
Expand Down

0 comments on commit af86714

Please sign in to comment.