You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WITH t0 AS (
SELECT *
FROM t4
WHERE `PARTITIONTIME` < '2017-01-01'
),
t1 AS (
SELECT CAST(`file_date` AS DATE) AS `file_date`, `PARTITIONTIME`, `val`
FROM t0
),
t2 AS (
SELECT t1.*, t0.`val` * 2 AS `XYZ`
FROM t1
WHERE t1.`file_date` < '2017-01-01'
)
SELECT t2.*
FROM t2
CROSS JOIN t2 t3
The text was updated successfully, but these errors were encountered:
This isn't actually a bug, but t4 is appearing because the way we generate names for tables created with ibis.table is the same way we generate aliases for subqueries. If you pass name='foobar' to ibis.table, for example, then you'll get this output:
WITH t0 AS (
SELECT*FROM foobar
WHERE`PARTITIONTIME`<DATE'2017-01-01'
),
t1 AS (
SELECT CAST(`file_date`ASDATE) AS`file_date`, `PARTITIONTIME`, `val`FROM t0
),
t2 AS (
SELECT t1.*, t0.`val`*2AS`XYZ`FROM t1
WHERE t1.`file_date`<DATE'2017-01-01'
)
SELECT t2.*FROM t2
CROSS JOIN t2 t3
@seibs Finally got around to fixing this. The issue here is that we're fusing across projections without considering the immediate parent table. What happens is that when we're looking for fusion opportunities in a project we look for common expressions in the deepest base table in the tree and assume that we can substitute in the matching columns from that in whatever query we're projecting. This is invalid because there may be other non-fused relations in between. For now, the fix is to only allow fusing with the immediate parent.
When a series of mutates/filters are moved to "WITH" statements, the compiled statement sometimes includes incorrect table references.
Expression
Compiled
The text was updated successfully, but these errors were encountered: