Add reusable connector smoke test#7155
Conversation
|
Based on #6874 to avoid conflicts. |
There was a problem hiding this comment.
Should it be TestGlobalTransactionMySqlConnectorSmokeTest or TestGlobalTransactionMySqlSmokeTest?
There is Smoke in class name for Oracle.
There was a problem hiding this comment.
TestMySqlGlobalTransactionMyConnectorSmokeTest
hashhar
left a comment
There was a problem hiding this comment.
Reviewed last two commits since the rest seems to come from another PR. Looks very reasonable.
Thanks a lot for adding this.
...e/src/test/java/io/trino/plugin/oracle/TestRemarksReportingOraclePoolConnectorSmokeTest.java
Outdated
Show resolved
Hide resolved
...e/src/test/java/io/trino/plugin/oracle/TestRemarksReportingOraclePoolConnectorSmokeTest.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/TestingConnectorBehavior.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/TestingConnectorBehavior.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Even if it's not a public API, maybe a doc comment here and/or on the class would make this easier to understand.
"Return whether this behavior is enabled by default. If this behavior is based on another behavior, use the given function to determine whether that behavior is enabled."
There was a problem hiding this comment.
Does the new method name (hasBehaviorByDefault) help alleviate the concern?
There was a problem hiding this comment.
The names on the test class are better, but it doesn't help much on the enum. It's hard to convey the correct meaning of the fallback parameter. Even though the end effect is pretty simple, the way hasBehavior passes itself as a parameter to the enum's method makes me look twice to make sure I'm not confused every time I see it.
I'd probably call it getDefault and give it a doc comment like "get the default setting for this behavior or check the parent behavior using the given function."
There was a problem hiding this comment.
Adding
/**
* Determines whether a connector should be assumed to have this behavior.
*
* @param fallback callback to be used to inspect connector behaviors, if this behavior is assumed to be had conditionally
*/
here
c9a136b to
6cc69b0
Compare
|
AC @losipiuk @hashhar @jirassimok thank you for the review! PTAL |
58b2dc6 to
d42c941
Compare
|
Rebased after #6874 merged, no changes otherwise. |
| SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_EQUALITY, | ||
| SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY, | ||
| SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_EQUALITY(SUPPORTS_PREDICATE_PUSHDOWN), | ||
| SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY(SUPPORTS_PREDICATE_PUSHDOWN), |
There was a problem hiding this comment.
These three are on the same axis. Three flavors of the same feature. It looks like having support of something does not fit into boolean domain.
There was a problem hiding this comment.
I don't understand the comment. What do you suggest here?
| this(true); | ||
| } | ||
|
|
||
| TestingConnectorBehavior(boolean defaultBehavior) |
There was a problem hiding this comment.
What do you mean by default? Connector default? Engine default? Each connector could have different default.
There was a problem hiding this comment.
it's whether behavior should be assumed to be had by default
There was a problem hiding this comment.
renaming to hasBehaviorByDefault, as the method name it fules
| throws Exception | ||
| { | ||
| oracleServer = new TestingOracleServer(); | ||
| oracleServer = closeAfterClass(new TestingOracleServer()); |
There was a problem hiding this comment.
that's a mistake, i will take it back
| SUPPORTS_INSERT, | ||
|
|
||
| SUPPORTS_DELETE(false), | ||
| SUPPORTS_ROW_LEVEL_DELETE(SUPPORTS_DELETE), |
There was a problem hiding this comment.
I don't get. Feature SUPPORTS_ROW_LEVEL_DELETE is by default set to SUPPORTS_DELETE which is by default disabled. How should I read this?
There was a problem hiding this comment.
You should read this as:
- if connector declares that it supports row level delete, then it should be expected to work
- if connector declares it supports delete (and doesn't say anything about row level delete), then it should be expected to work
- if connector declares it supports delete, but declares no support for row level delete, then it should be expected not to work
- if connector declares nothing, no delete should be expected to work
There was a problem hiding this comment.
if connector declares it supports delete, but declares no support for row level delete, then it should be expected not to work
You mean it supports delete and does not support row level delete. Does row level delete indicates delete?
Did you mean delete -> metadata delete and row level delete -> delete?
There was a problem hiding this comment.
Does row level delete indicates delete?
yes, if a connector supports row level delete, then it does support delete in general
|
AC |
|
@kokosing PTAL |
| SUPPORTS_JOIN_PUSHDOWN_WITH_DISTINCT_FROM(SUPPORTS_JOIN_PUSHDOWN), | ||
|
|
||
| SUPPORTS_CREATE_TABLE, | ||
| SUPPORTS_CREATE_TABLE_WITH_DATA(SUPPORTS_CREATE_TABLE), |
There was a problem hiding this comment.
Why not SUPPORTS_CREATE_TABLE_AS?
There was a problem hiding this comment.
"AS" is too short, "WITH DATA" may be confusing... any other options?
There was a problem hiding this comment.
SUPPORTS_CREATE_TABLE_AS_SELECT is probably better than just _AS.
Though I think WITH_DATA is probably fine. Maybe it could have a doc comment to help anyone who gets confused (some of the others would probably also benefit from doc comments, like JOIN_PUSHDOWN_WITH_DISTINCT_FROM).
(A doc comment for this one could just be {@code CREATE TABLE name AS query}.)
There was a problem hiding this comment.
yes, we can add comments here!
|
CI #5758 |
c5417d8 to
8249f87
Compare
Add
BaseConnectorSmokeTest, a reusable, slim, fast connector smoke test everyone always wanted, but never dared to ask for one.