forked from prestodb/presto
-
Notifications
You must be signed in to change notification settings - Fork 3
test: Add E2E unit tests for CLP connector. #54
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
Merged
anlowee
merged 19 commits into
y-scope:release-0.293-clp-connector
from
anlowee:xwei/presto-e2e-unit-test
Sep 3, 2025
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
4ddd424
Make maven work
anlowee 16e7bf6
Merge branch 'release-0.293-clp-connector' into xwei/presto-e2e-unit-…
anlowee dbd1c49
Fix another maven issue
anlowee 9ae9d0e
Merge branch 'release-0.293-clp-connector' into xwei/presto-e2e-unit-…
anlowee 64713dc
Fix maven issue
anlowee 13962cb
Get it work
anlowee 59d7898
Replace with single file archive
anlowee 55d3a9f
WIP: refactor
anlowee a186ee5
Fix format
anlowee c7aac44
Revert velox change
anlowee 8cc8e90
Revert unnecessary changes
anlowee bd25ca8
Add docstrings
anlowee ec7ded5
Address coderabbitai comments
anlowee 455f5a6
Merge branch 'release-0.293-clp-connector' into xwei/presto-e2e-unit-…
anlowee 7b8a9cd
Address comments
anlowee 96e7bd7
Address comments
anlowee 7c60cee
Address comments
anlowee d1ec5cd
Address comments
anlowee 8abeb89
Merge branch 'release-0.293-clp-connector' into xwei/presto-e2e-unit-…
anlowee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
101 changes: 101 additions & 0 deletions
101
presto-clp/src/test/java/com/facebook/presto/plugin/clp/ClpQueryRunner.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.facebook.presto.plugin.clp; | ||
|
|
||
| import com.facebook.airlift.log.Logger; | ||
| import com.facebook.presto.Session; | ||
| import com.facebook.presto.tests.DistributedQueryRunner; | ||
| import com.google.common.collect.ImmutableMap; | ||
|
|
||
| import java.net.URI; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
| import java.util.function.BiFunction; | ||
|
|
||
| import static com.facebook.presto.testing.TestingSession.testSessionBuilder; | ||
|
|
||
| public class ClpQueryRunner | ||
| { | ||
| private static final Logger log = Logger.get(ClpQueryRunner.class); | ||
anlowee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public static final String CLP_CATALOG = "clp"; | ||
| public static final String CLP_CONNECTOR = CLP_CATALOG; | ||
| public static final int DEFAULT_NUM_OF_WORKERS = 1; | ||
| public static final String DEFAULT_SCHEMA = "default"; | ||
|
|
||
| public static DistributedQueryRunner createQueryRunner( | ||
| String metadataDbUrl, | ||
| String metadataDbUser, | ||
| String metadataDbPassword, | ||
| String metadataDbTablePrefix, | ||
| Optional<Integer> workerCount, | ||
| Optional<BiFunction<Integer, URI, Process>> externalWorkerLauncher) | ||
| throws Exception | ||
| { | ||
| log.info("Creating CLP query runner with default session"); | ||
| return createQueryRunner( | ||
| createDefaultSession(), | ||
| metadataDbUrl, | ||
| metadataDbUser, | ||
| metadataDbPassword, | ||
| metadataDbTablePrefix, | ||
| workerCount, | ||
| externalWorkerLauncher); | ||
| } | ||
|
|
||
| public static DistributedQueryRunner createQueryRunner( | ||
| Session session, | ||
| String metadataDbUrl, | ||
| String metadataDbUser, | ||
| String metadataDbPassword, | ||
| String metadataDbTablePrefix, | ||
| Optional<Integer> workerCount, | ||
| Optional<BiFunction<Integer, URI, Process>> externalWorkerLauncher) | ||
| throws Exception | ||
| { | ||
| DistributedQueryRunner clpQueryRunner = DistributedQueryRunner.builder(session) | ||
| .setNodeCount(workerCount.orElse(DEFAULT_NUM_OF_WORKERS)) | ||
| .setExternalWorkerLauncher(externalWorkerLauncher) | ||
| .build(); | ||
| Map<String, String> clpProperties = ImmutableMap.<String, String>builder() | ||
| .put("clp.metadata-provider-type", "mysql") | ||
| .put("clp.metadata-db-url", metadataDbUrl) | ||
| .put("clp.metadata-db-user", metadataDbUser) | ||
| .put("clp.metadata-db-password", metadataDbPassword) | ||
| .put("clp.metadata-table-prefix", metadataDbTablePrefix) | ||
| .put("clp.split-provider-type", "mysql") | ||
| .build(); | ||
|
|
||
| clpQueryRunner.installPlugin(new ClpPlugin()); | ||
| clpQueryRunner.createCatalog(CLP_CATALOG, CLP_CONNECTOR, clpProperties); | ||
| return clpQueryRunner; | ||
| } | ||
|
|
||
| /** | ||
| * Creates a default mock session for query use. | ||
| * | ||
| * @return a default session | ||
| */ | ||
| private static Session createDefaultSession() | ||
| { | ||
| return testSessionBuilder() | ||
| .setCatalog(CLP_CATALOG) | ||
| .setSchema(DEFAULT_SCHEMA) | ||
| .build(); | ||
| } | ||
|
|
||
| private ClpQueryRunner() | ||
| { | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
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.
We should probably make it more general since there's a chance the udf test will use this QueryRunner