Repository navigation
Support CnosDB - #697
Support CnosDB#697
Conversation
|
Awesome, thanks for the PR! Starting to review the PR asap. In the meanwhile, could you please execute |
Thank you for reminding |
mrigger
left a comment
There was a problem hiding this comment.
Thanks a lot for the PR! Could you please take a look at my comments, which are minor issues and suggestions?
Currently, the implementation contains much effectively dead code, namely the getExpectedValue methods needed for Pivoted Query Synthesis (PQS), which is not supported as a test oracle. Would it be possible to remove these methods?
| private CnosDBComparatorHelper() { | ||
| } | ||
|
|
||
| public static boolean isEqualDouble(String first, String second) { |
There was a problem hiding this comment.
For this and other methods, is there actually a need to re-implement them? It seems that, at least for this method and the one below, the code is the same as for
sqlancer/src/sqlancer/ComparatorHelper.java
Lines 21 to 37 in 67751dc
| String queryString = query.getLogString(); | ||
| String newQueryString = "-- " + queryString; | ||
| ExpectedErrors errors = new ExpectedErrors(); | ||
| errors.addAll(CnosDBExpectedError.expectedErrors()); |
There was a problem hiding this comment.
I believe that commenting out a SQL statement should not result in any errors, so the expected errors could be empty here?
| import sqlancer.common.query.ExpectedErrors; | ||
| import sqlancer.common.query.Query; | ||
|
|
||
| public class CnosDBLoggableFactory extends LoggableFactory { |
There was a problem hiding this comment.
I think inheriting from
and overriding methods whose implementation differs would prevent some code duplication here.There was a problem hiding this comment.
I noticed that this is still unaddressed. Is it not possible to inherit because of some reason related to not using JDBC?
There was a problem hiding this comment.
At present, our implementation does not use JDBC. At the beginning of development, JDBC support was not perfect, so we used the http interface, and we will optimize it later.
| }, | ||
| SUM(CnosDBDataType.INT, CnosDBDataType.DOUBLE, CnosDBDataType.UINT), APPROX_MEDIAN(CnosDBDataType.DOUBLE); | ||
|
|
||
| // Currently these aggregate functions have bugs https://github.com/cnosdb/cnosdb/issues/786 |
There was a problem hiding this comment.
As an optional suggestion, I think it would be more elegant to include the currently commented-out code. If, for example, you require a random aggregate function, you could still remove the buggy aggregate functions from the selection. The general pattern is described at https://github.com/sqlancer/sqlancer/blob/67751dc3d83b880cd8c7ed53416b8b157a2ba2ea/CONTRIBUTING.md#implementing-support-for-a-new-dbms, and I see you added a CnosDBBugs class already.
There was a problem hiding this comment.
Thanks. I removed the comment and applied that pattern.
| } | ||
|
|
||
| @Override | ||
| public CnosDBConstant getExpectedValue() { |
There was a problem hiding this comment.
Currently, the PR includes many getExpectedValue implementations, but does not support PQS, for which they are needed. Perhaps we can remove these implementations?
There was a problem hiding this comment.
Thanks, I remove those dead code.
| } | ||
|
|
||
| }; | ||
| // NULL_IF(2, "nullif") { |
There was a problem hiding this comment.
Perhaps we can remove this commented-out code?
There was a problem hiding this comment.
Thanks, I remove those comment.
| DATA_PART("date_part", CnosDBDataType.INT, CnosDBDataType.STRING, CnosDBDataType.TIMESTAMP); | ||
|
|
||
| // because bug of arrow-csv https://github.com/apache/arrow-rs/issues/3547 | ||
| // NOW("now", CnosDBDataType.TIMESTAMP), |
There was a problem hiding this comment.
As an optional suggestion, as in the other instance, we could apply the CnosDBBugs pattern here.
There was a problem hiding this comment.
Thanks, I remove those comment.
|
Thanks for your review, I removed some dead code. |
| } | ||
|
|
||
| public static List<String> expectedErrors() { | ||
| List<String> errors = new ArrayList<>(); |
There was a problem hiding this comment.
Here, it would be ideal to directly create an ExpectedError object rather than a list.
mrigger
left a comment
There was a problem hiding this comment.
Almost ready to merge! Could you please still have a look at the other comments?
| state.getState().getLocalState().log(String.format("%s\n%s", firstQueryString, secondQueryString)); | ||
| String assertionMessage = String.format("the size of the result sets mismatch (%d and %d)!\n%s\n%s", | ||
| resultSet.size(), secondResultSet.size(), firstQueryString, secondQueryString); | ||
| Main.nrUnsuccessfulActions.addAndGet(1); |
There was a problem hiding this comment.
The most recent commit added a couple of Main.nrUnsuccessfulActions.addAndGet(1); and similar calls like this. I believe we should remove them to not let the two comparator helper classes diverge until we fix the code duplication problem.
| ERRORS.add("Coercion from"); | ||
| } | ||
|
|
||
| public static ExpectedErrors expectedErrors() { |
There was a problem hiding this comment.
I think that this method should be called getExpectedExpressionErrors since all the errors seem specific to expressions? This is something that could be done in a future PR.
mrigger
left a comment
There was a problem hiding this comment.
LGTM, thanks a lot again for your contribution! It would be great to add CI tests (e.g., see
sqlancer/.github/workflows/main.yml
Line 105 in 39c48cd
|
The branch is currently out-of-date. Could please merge latest the latest master? It seems I don't have permissions to do so. |
Add Cnosdb
* add query execute count * refactor expectedError
we'll add it soon |
|
Thanks a lot! |
Hello, I am from the CnosDB development team. We implemented Sqlancer of CnosDB referring to the code of Postgres in Sqlancer. This tool helped us find some bugs.