-
Notifications
You must be signed in to change notification settings - Fork 304
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
[#233] test (trino-connector): Add SQL interface tests for trino-connector. #524
Conversation
Code Coverage Report
Files
|
...in/java/com/datastrato/graviton/trino/connector/catalog/CatalogConnectorMetadataAdapter.java
Outdated
Show resolved
Hide resolved
...main/java/com/datastrato/graviton/trino/connector/catalog/memory/MemoryConnectorAdapter.java
Outdated
Show resolved
Hide resolved
.../main/java/com/datastrato/graviton/trino/connector/catalog/memory/MemoryMetadataAdapter.java
Outdated
Show resolved
Hide resolved
...o-connector/src/test/java/com/datastrato/graviton/trino/connector/TestGravitonConnector.java
Outdated
Show resolved
Hide resolved
...o-connector/src/test/java/com/datastrato/graviton/trino/connector/TestGravitonConnector.java
Outdated
Show resolved
Hide resolved
...o-connector/src/test/java/com/datastrato/graviton/trino/connector/TestGravitonConnector.java
Outdated
Show resolved
Hide resolved
...in/java/com/datastrato/graviton/trino/connector/catalog/CatalogConnectorMetadataAdapter.java
Outdated
Show resolved
Hide resolved
...o-connector/src/test/java/com/datastrato/graviton/trino/connector/TestGravitonConnector.java
Outdated
Show resolved
Hide resolved
trino-connector/src/test/java/com/datastrato/graviton/trino/connector/util/GravitonRestApi.java
Outdated
Show resolved
Hide resolved
trino-connector/src/test/java/com/datastrato/graviton/trino/connector/util/GravitonRestApi.java
Outdated
Show resolved
Hide resolved
Is it ready for review? |
Yes |
@yuqi1129 can you please help to review? |
@@ -51,7 +55,11 @@ subprojects { | |||
tasks.configureEach<Test> { | |||
val skipTests = project.hasProperty("skipTests") | |||
if (!skipTests) { | |||
useJUnitPlatform() | |||
if (project.name == "trino-connector") { | |||
useTestNG() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason to use testNG?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trino connector testing framework requires the use of TestNG.
import java.util.Map; | ||
|
||
@Path("/") | ||
public class GravitinoRestApi { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the usage of this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It simulates a Gravitino server to support Trino connector operations. To enable the Trino Connector to perform full functionality tests using the embedded memory connector within Trino.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worrying that if we change the protocol in Gravitino server, it should also be changed here, otherwise it will not align and lead to failure, which makes this code hard to maintain, do we have any better solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better solution is to simulate some interfaces of GravitinoClient, GravitinoMetalake, and RelationalCatalog for the Trino connector. If there were a Graviton JDBC interface, it would make the implementation much easier. We will improve it later.
|
||
public class TestGravitinoConnector extends BaseConnectorTest { | ||
@Parameters({"-Xmx1G"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to limit the memory usage deliberately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Trino connector test need about 1G memory to run
/** Normalize gravitino attributes for trino */ | ||
protected Map<String, Object> normalizeProperties( | ||
Map<String, String> properties, List<PropertyMetadata<?>> propertyTemplate) { | ||
// TODO yuhui redo this function once graviton table properties are supported.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
graviton -> gravitino
trino-connector/build.gradle.kts
Outdated
testImplementation(libs.trino.testing) { | ||
exclude("org.apache.logging.log4j") | ||
} | ||
testImplementation("io.trino:trino-memory:426") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you define this dependency in version file?
DataTypeTransformer.getGravitinoType(column.getType(), column.isNullable()), | ||
index, | ||
column.getComment())); | ||
index++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the difference between i
and index
, why don't you directly use i
?
import java.util.Map; | ||
|
||
@Path("/") | ||
public class GravitinoRestApi { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worrying that if we change the protocol in Gravitino server, it should also be changed here, otherwise it will not align and lead to failure, which makes this code hard to maintain, do we have any better solution?
I have no further comments, @yuqi1129 please also take a look again. |
BTW, the code need to rebase. |
gradle/libs.versions.toml
Outdated
@@ -30,6 +30,7 @@ trino = '426' | |||
spark = "3.4.1" | |||
scala-collection-compat = "2.7.0" | |||
sqlite-jdbc = "3.42.0.0" | |||
testng = "7.4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does trino-connector
use this version? I noticed that there is a vulnerability for this version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change it to 7.7.1
The rest are LGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ector. (#524) ### What changes were proposed in this pull request? Add SQL interface end to end UT for trino-connector. It uses the Graviton connector to load the memory catalog and execute basic SQL tests. ### Why are the changes needed? Fix: #523 Add SQL interface end to end UT for trino-connector
What changes were proposed in this pull request?
Add SQL interface end to end UT for trino-connector. It uses the Graviton connector to load the memory catalog and execute basic SQL tests.
Why are the changes needed?
Fix: #523 Add SQL interface end to end UT for trino-connector