Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion wren-core-py/tests/test_modeling_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def test_rlac():
rewritten_sql = session_context.transform_sql(sql)
assert (
rewritten_sql
== "SELECT customer.c_custkey, customer.c_name FROM (SELECT customer.c_custkey, customer.c_name FROM (SELECT __source.c_custkey AS c_custkey, __source.c_name AS c_name FROM main.customer AS __source) AS customer) AS customer WHERE customer.c_name = 'test_user'"
== "SELECT customer.c_custkey, customer.c_name FROM (SELECT customer.c_custkey, customer.c_name FROM (SELECT customer.c_custkey, customer.c_name FROM (SELECT __source.c_custkey AS c_custkey, __source.c_name AS c_name FROM main.customer AS __source) AS customer) AS customer WHERE customer.c_name = 'test_user') AS customer"
)


Expand Down
7 changes: 6 additions & 1 deletion wren-core/core/src/logical_plan/analyze/model_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ impl ModelGenerationRule {
// The filter should be on on the top of the model plan
// and the model plan should be another subquery alias
if let Some(filter) = rls_filter {
builder = builder.alias(model_plan.plan_name())?.filter(filter)?
builder =
builder.alias(model_plan.plan_name())?.filter(filter)?;
// Following the DataFusion planning behavior, we need to
// add a projection behind the filter to ensure the unparsing is correct.
let indices = 0..builder.schema().fields().len();
builder = builder.select(indices)?;
}

// calculated field scope
Expand Down
Loading