Repository navigation
Add interface to return queries by oracles - #648
Conversation
mrigger
left a comment
There was a problem hiding this comment.
I think we should aim for a more general solution here. Kareem recently added a class that can be used to return reproducers from oracles:
sqlancer/src/sqlancer/Reproducer.java
Line 4 in a3357c1
We could add a method String[] getQueriesAsString() that returns the test oracle queries as strings (QPG would only use one of them). For example, the constructor could take an array containing the optimizedQueryString and unoptimizedQueryString:
We could create the reducer every time check() is called, not only when a bug is encountered. I think this solution would be more elegant and general (especially considering that most methods currently return a "Not implemented!" string). What do you think about this?
| } catch (AssertionError e) { | ||
| Reproducer<G> reproducer = oracle.getLastReproducer(); | ||
| if (reproducer != null) { | ||
| if (reproducer.getReproducerState()) { |
There was a problem hiding this comment.
Is there any reason why need this method? I think it would be better to check for null: either we have the reproducer, or it is null. Having a reproducer object that indicates that we don't have the actual state is a bit confusing, I think.
There was a problem hiding this comment.
reproducer is returned by each call of check, instead of bug only, so we need to distinguish the returned reproduer denotes a bug or not.
|
|
||
| List<String> getQueriesAsString(); | ||
|
|
||
| void addQuery(String query); |
There was a problem hiding this comment.
Perhaps addQueryString to match the above method?
| import java.util.List; | ||
|
|
||
| public interface Reproducer<G extends GlobalState<?, ?, ?>> { | ||
| boolean bugStillTriggers(G globalState); |
There was a problem hiding this comment.
Perhaps now, we can rename this method to bugTriggers, given that we create the reproducer also if no bug was triggered?
| @@ -90,11 +116,12 @@ public void check() throws SQLException { | |||
| throw new IgnoreMeException(); | |||
| } | |||
| if (optimizedCount != unoptimizedCount) { | |||
There was a problem hiding this comment.
I think we could simplify the code by adding reproducer = new SQLite3NoRECReproducer(optimizedQuery, unoptimizedQuery, Arrayas.asList(optimizedQueryString, unoptimizedQueryString)); above the if check and removing the other parts.
Co-authored-by: Manuel Rigger <rigger@nus.edu.sg>
For QPG, we need to obtain the queries that are returned from oracles to measure query plans.