Repository navigation
fix(text2sql): isolate missing databases in batch query comparison - #557
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DatabaseManager.batch_compare_queriesreturns an error result for every triple in the batch as soon as any onedb_idis not registered. One row that points at a missing database makes all the other comparisons fail too, even when their database exists and the SQL matches.SQLExecutionClassifierpasses the whole dataframe in a single call, so in practice one baddb_idmarks every row as"Predicted SQL failed; Ground truth SQL failed"withcnt_true = 0.Fix
The missing-database check now happens per triple. A triple whose
db_idis not registered gets the same"Database '<id>' not found"error result as before. The other triples are executed and compared as usual, and results stay in input order. If every database exists, the behaviour doesn't change.Tests
I added
test/cpu_only/test_text2sql_compare_missing_db.py. It builds a small SQLite database undertmp_pathand compares three triples: a matching pair, a pair on a missing database, and a non-matching pair. It checks that only the missing-database triple gets the error and the other two keep their real results in order.equal=False)I also checked
SQLExecutionClassifier.execute_model_batchwith the same data. The row on the existing database now getscnt_true = 1instead of being reported as failed.Fixes #556