-
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.
Introduce a new CoordinatorPlugin interface for native clusters
- Loading branch information
Showing
10 changed files
with
181 additions
and
17 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
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
26 changes: 26 additions & 0 deletions
26
presto-spi/src/main/java/com/facebook/presto/spi/CoordinatorPlugin.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,26 @@ | ||
/* | ||
* 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.spi; | ||
|
||
import com.facebook.presto.spi.function.FunctionNamespaceManagerFactory; | ||
|
||
import static java.util.Collections.emptyList; | ||
|
||
public interface CoordinatorPlugin | ||
{ | ||
default Iterable<FunctionNamespaceManagerFactory> getFunctionNamespaceManagerFactories() | ||
{ | ||
return emptyList(); | ||
} | ||
} |
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
27 changes: 27 additions & 0 deletions
27
presto-tests/src/main/java/com/facebook/presto/tests/TestingCoordinatorPlugin.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,27 @@ | ||
/* | ||
* 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.tests; | ||
|
||
import com.facebook.presto.spi.CoordinatorPlugin; | ||
import com.facebook.presto.spi.function.FunctionNamespaceManagerFactory; | ||
|
||
public class TestingCoordinatorPlugin | ||
implements CoordinatorPlugin | ||
{ | ||
@Override | ||
public Iterable<FunctionNamespaceManagerFactory> getFunctionNamespaceManagerFactories() | ||
{ | ||
throw new RuntimeException(String.format("This exception confirms that %s was called.", this.getClass().getSimpleName())); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
presto-tests/src/main/resources/META-INF/services/com.facebook.presto.spi.CoordinatorPlugin
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 @@ | ||
com.facebook.presto.tests.TestingCoordinatorPlugin |
46 changes: 46 additions & 0 deletions
46
presto-tests/src/test/java/com/facebook/presto/server/TestCoordinatorPluginIntegration.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,46 @@ | ||
/* | ||
* 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.server; | ||
|
||
import com.facebook.presto.server.testing.TestingPrestoServer; | ||
import com.facebook.presto.sql.parser.SqlParserOptions; | ||
import com.google.common.collect.ImmutableList; | ||
import com.google.common.collect.ImmutableMap; | ||
import org.testng.annotations.Test; | ||
|
||
public class TestCoordinatorPluginIntegration | ||
{ | ||
private final TestingPrestoServer testingPrestoServer; | ||
|
||
private TestCoordinatorPluginIntegration() | ||
throws Exception | ||
{ | ||
this.testingPrestoServer = new TestingPrestoServer( | ||
true, | ||
ImmutableMap.<String, String>builder() | ||
.put("native-execution-enabled", "true") | ||
.put("plugin.bundles", "../presto-tests/target/") | ||
.build(), | ||
null, null, new SqlParserOptions(), ImmutableList.of()); | ||
} | ||
|
||
@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = | ||
"This exception confirms that TestingCoordinatorPlugin was called.") | ||
public void testCoordinatorPluginIntegration() | ||
throws Exception | ||
{ | ||
PluginManager pluginManager = testingPrestoServer.getPluginManager(); | ||
pluginManager.loadPlugins(); | ||
} | ||
} |