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
SELECTt_program.c_name,
t_program.c_program_idFROM
t_program
INNER JOIN (
SELECT
DISTINCT ON ((t_program.c_program_id COLLATE "C"))(t_program.c_program_id COLLATE "C")
FROM
t_program
LEFT JOIN t_program_user ON (
t_program_user.c_program_id=t_program.c_program_id
)
WHERE
(
(
(
(t_program_user.c_user_id= $1)
OR (t_program.c_pi_user_id= $2)
)
AND (t_program.c_existence= $3)
)
)
AND (t_program.c_program_idIS NOT NULL)
ORDER BY
(t_program.c_program_id COLLATE "C") NULLS LAST
) AS t_program_pred ON (
t_program_pred.c_program_id=t_program.c_program_id
)
java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:264)
at edu.gemini.grackle.sql.SqlMapping$SqlQuery$SqlSelect.addFilterOrderByOffsetLimit(SqlMapping.scala:1717)
...
due to (I assume) the already-present ORDER BY caused by the joins ... ?
Whilst there is a bug here, I think you almost certainly want to swap the order of the Filter and the Limit.
In general, given a child query yielding a list of values, you would first filter, then order, then offset, then limit, ie. (filter compose order compose offset compose limit)(child) or limit(offset(order(filter(child)))).
So what's happened is that the FilterOrderOffsetLimit extractor sees this as two separate operations, an inner one which is a Limit only and an outer one which is a Filter only. That shouldn't result in an assert, however, as I said above, it most likely isn't what you want here.
The following query
produces the following SQL.
Adding a
Limit
to the child query, thusresults in
due to (I assume) the already-present
ORDER BY
caused by the joins ... ?Relevant [abbreviated] definitions:
The text was updated successfully, but these errors were encountered: