-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[native] Add e2e native function validation tests with Presto sidecar
Co-authored-by: Tim Meehan <[email protected]>
- Loading branch information
1 parent
e3d2ccf
commit 6421091
Showing
11 changed files
with
310 additions
and
258 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
48 changes: 48 additions & 0 deletions
48
...ecar-plugin/src/test/java/com/facebook/presto/sidecar/NativeSidecarPluginQueryRunner.java
This file contains 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,48 @@ | ||
/* | ||
* 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.sidecar; | ||
|
||
import com.facebook.airlift.log.Logger; | ||
import com.facebook.airlift.log.Logging; | ||
import com.facebook.presto.nativeworker.NativeQueryRunnerUtils; | ||
import com.facebook.presto.nativeworker.PrestoNativeQueryRunnerUtils; | ||
import com.facebook.presto.testing.QueryRunner; | ||
import com.facebook.presto.tests.DistributedQueryRunner; | ||
|
||
import static com.facebook.presto.sidecar.NativeSidecarPluginQueryRunnerUtils.setupNativeSidecarPlugin; | ||
|
||
public class NativeSidecarPluginQueryRunner | ||
{ | ||
private NativeSidecarPluginQueryRunner() {} | ||
|
||
public static void main(String[] args) | ||
throws Exception | ||
{ | ||
// You need to add "--user user" to your CLI for your queries to work. | ||
Logging.initialize(); | ||
|
||
// Create tables before launching distributed runner. | ||
QueryRunner javaQueryRunner = PrestoNativeQueryRunnerUtils.createJavaQueryRunner(false); | ||
NativeQueryRunnerUtils.createAllTables(javaQueryRunner); | ||
javaQueryRunner.close(); | ||
|
||
// Launch distributed runner. | ||
DistributedQueryRunner queryRunner = (DistributedQueryRunner) PrestoNativeQueryRunnerUtils.createQueryRunner(false, true); | ||
setupNativeSidecarPlugin(queryRunner); | ||
Thread.sleep(10); | ||
Logger log = Logger.get(DistributedQueryRunner.class); | ||
log.info("======== SERVER STARTED ========"); | ||
log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...plugin/src/test/java/com/facebook/presto/sidecar/NativeSidecarPluginQueryRunnerUtils.java
This file contains 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,33 @@ | ||
/* | ||
* 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.sidecar; | ||
import com.facebook.presto.sidecar.functionNamespace.NativeFunctionNamespaceManagerFactory; | ||
import com.facebook.presto.testing.QueryRunner; | ||
import com.google.common.collect.ImmutableMap; | ||
|
||
public class NativeSidecarPluginQueryRunnerUtils | ||
{ | ||
private NativeSidecarPluginQueryRunnerUtils() {}; | ||
|
||
public static void setupNativeSidecarPlugin(QueryRunner queryRunner) | ||
{ | ||
queryRunner.installCoordinatorPlugin(new NativeSidecarPlugin()); | ||
queryRunner.loadNativeFunctionNamespaceManager( | ||
NativeFunctionNamespaceManagerFactory.NAME, | ||
"native", | ||
ImmutableMap.of( | ||
"supported-function-languages", "CPP", | ||
"function-implementation-type", "CPP")); | ||
} | ||
} |
Oops, something went wrong.