-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Raise error instead of panicking for unsupported SQL operations #20789
base: main
Are you sure you want to change the base?
fix: Raise error instead of panicking for unsupported SQL operations #20789
Conversation
as its actually reachable and causes a panic when attempting unsupported ops like INSERT, UPDATE, DELETE, etc.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #20789 +/- ##
==========================================
- Coverage 79.78% 79.63% -0.15%
==========================================
Files 1561 1571 +10
Lines 221982 223153 +1171
Branches 2531 2546 +15
==========================================
+ Hits 177107 177719 +612
- Misses 44293 44850 +557
- Partials 582 584 +2 ☔ View full report in Codecov by Sentry. |
Nice, could you add a test on the python side for this? E.g. testing you get the error you expect. |
unreachable
with polars_bail
FYI: the I think it's likely an artefact from an earlier version of Anyway, you can simplify that final catch-all match branch to this now: op => {
polars_bail!(SQLInterface: "'{}' operation is currently unsupported", op)
}, No need for any special |
Thanks for the clarification @alexander-beedie. I was actually puzzling why it was so and was thinking of adding match arms specifically for |
If you simplify as above and add a test, we can get this one merged (though does make me think the panic you mentioned must be coming from elsewhere, as UPDATE, INSERT, and DELETE aren't set ops and wouldn't have hit that |
Yes. As I was creating the test for the fix, the error is being caused by something else other than INSERT or UPDATE as I originally suspected, as the use of both invalid operations are already being handled by polars/crates/polars-sql/src/context.rs Lines 193 to 209 in 24fccc4
If you look at dathere/qsv#2450, this is the SQL that's causing us to trigger the WITH u AS (
SELECT
small.FQDN,
small.NS1,
small.NS2,
small.NS3,
small.NS4,
small.NS5,
small.NS6,
small.NS7,
small.NS8,
small.NS9,
small.NS10,
small.NS11,
small.NS12
FROM
small
INNER JOIN large ON small.FQDN = large.FQDN
)
UPDATE
large
SET
FQDN = u.FQDN,
NS1 = u.NS1,
NS2 = u.NS2,
NS3 = u.NS3,
NS4 = u.NS4,
NS5 = u.NS5,
NS6 = u.NS6,
NS7 = u.NS7,
NS8 = u.NS8,
NS9 = u.NS9,
NS10 = u.NS10,
NS11 = u.NS11,
NS12 = u.NS12
FROM
u
WHERE
large.FQDN = u.FQDN; |
the test may be more complicated than required, but I wanted to base the test case on the bug report here - dathere/qsv#2450
as its actually reachable and causes a panic when attempting unsupported ops like INSERT, UPDATE, DELETE, etc.