Skip to content

Commit 5c3560a

Browse files
pdabre12aditi-pandit
authored andcommitted
Add a new router plugin : presto-plan-checker-router-plugin
1 parent 7587c15 commit 5c3560a

File tree

13 files changed

+767
-4
lines changed

13 files changed

+767
-4
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@
215215
<module>presto-base-arrow-flight</module>
216216
<module>presto-function-server</module>
217217
<module>presto-router-example-plugin-scheduler</module>
218+
<module>presto-plan-checker-router-plugin</module>
218219
</modules>
219220

220221
<dependencyManagement>
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>com.facebook.presto</groupId>
7+
<artifactId>presto-root</artifactId>
8+
<version>0.294-SNAPSHOT</version>
9+
</parent>
10+
11+
<groupId>com.facebook.presto.router</groupId>
12+
<artifactId>presto-plan-checker-router-plugin</artifactId>
13+
<version>0.294-SNAPSHOT</version>
14+
<packaging>jar</packaging>
15+
<name>presto-plan-checker-router-plugin</name>
16+
<description>Presto plan checker router plugin</description>
17+
18+
<properties>
19+
<air.main.basedir>${project.parent.basedir}</air.main.basedir>
20+
<air.test.jvm.additional-arguments>-Xms4g -Xmx4g</air.test.jvm.additional-arguments>
21+
</properties>
22+
23+
<dependencies>
24+
<dependency>
25+
<groupId>com.google.guava</groupId>
26+
<artifactId>guava</artifactId>
27+
</dependency>
28+
29+
<dependency>
30+
<groupId>org.weakref</groupId>
31+
<artifactId>jmxutils</artifactId>
32+
</dependency>
33+
34+
<dependency>
35+
<groupId>com.facebook.airlift</groupId>
36+
<artifactId>stats</artifactId>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>javax.servlet</groupId>
41+
<artifactId>javax.servlet-api</artifactId>
42+
</dependency>
43+
44+
<dependency>
45+
<groupId>com.facebook.airlift</groupId>
46+
<artifactId>configuration</artifactId>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>io.airlift</groupId>
51+
<artifactId>slice</artifactId>
52+
<scope>provided</scope>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>com.fasterxml.jackson.core</groupId>
57+
<artifactId>jackson-annotations</artifactId>
58+
<scope>provided</scope>
59+
</dependency>
60+
61+
<dependency>
62+
<groupId>io.airlift</groupId>
63+
<artifactId>units</artifactId>
64+
<scope>provided</scope>
65+
</dependency>
66+
67+
<dependency>
68+
<groupId>org.openjdk.jol</groupId>
69+
<artifactId>jol-core</artifactId>
70+
<scope>provided</scope>
71+
</dependency>
72+
73+
<dependency>
74+
<groupId>com.facebook.airlift</groupId>
75+
<artifactId>bootstrap</artifactId>
76+
</dependency>
77+
78+
<dependency>
79+
<groupId>com.facebook.airlift</groupId>
80+
<artifactId>json</artifactId>
81+
</dependency>
82+
83+
<dependency>
84+
<groupId>com.facebook.presto</groupId>
85+
<artifactId>presto-parser</artifactId>
86+
</dependency>
87+
88+
<dependency>
89+
<groupId>com.facebook.presto</groupId>
90+
<artifactId>presto-main-base</artifactId>
91+
</dependency>
92+
93+
<dependency>
94+
<groupId>com.facebook.presto</groupId>
95+
<artifactId>presto-client</artifactId>
96+
</dependency>
97+
98+
<dependency>
99+
<groupId>com.facebook.presto</groupId>
100+
<artifactId>presto-main</artifactId>
101+
</dependency>
102+
103+
<dependency>
104+
<groupId>com.squareup.okhttp3</groupId>
105+
<artifactId>okhttp</artifactId>
106+
</dependency>
107+
108+
<dependency>
109+
<groupId>com.google.inject</groupId>
110+
<artifactId>guice</artifactId>
111+
</dependency>
112+
113+
<dependency>
114+
<groupId>javax.inject</groupId>
115+
<artifactId>javax.inject</artifactId>
116+
</dependency>
117+
118+
<dependency>
119+
<groupId>com.facebook.drift</groupId>
120+
<artifactId>drift-api</artifactId>
121+
<scope>provided</scope>
122+
</dependency>
123+
124+
<dependency>
125+
<groupId>com.facebook.airlift</groupId>
126+
<artifactId>log</artifactId>
127+
</dependency>
128+
129+
<!-- Presto SPI -->
130+
<dependency>
131+
<groupId>com.facebook.presto</groupId>
132+
<artifactId>presto-spi</artifactId>
133+
<scope>provided</scope>
134+
</dependency>
135+
136+
<dependency>
137+
<groupId>com.facebook.presto</groupId>
138+
<artifactId>presto-common</artifactId>
139+
<scope>provided</scope>
140+
</dependency>
141+
</dependencies>
142+
143+
<!-- Build configurations -->
144+
<build>
145+
<plugins>
146+
<plugin>
147+
<groupId>com.facebook.presto</groupId>
148+
<artifactId>presto-maven-plugin</artifactId>
149+
<executions>
150+
<execution>
151+
<phase>validate</phase>
152+
<goals>
153+
<goal>check-spi-dependencies</goal>
154+
</goals>
155+
</execution>
156+
</executions>
157+
</plugin>
158+
<plugin>
159+
<groupId>ca.vanzyl.provisio.maven.plugins</groupId>
160+
<artifactId>provisio-maven-plugin</artifactId>
161+
<executions>
162+
<execution>
163+
<phase>package</phase>
164+
<goals>
165+
<goal>provision</goal>
166+
</goals>
167+
</execution>
168+
</executions>
169+
</plugin>
170+
<!-- Disable git-commit-id-plugin plugin to allow for running tests without
171+
a git checkout -->
172+
<plugin>
173+
<groupId>pl.project13.maven</groupId>
174+
<artifactId>git-commit-id-plugin</artifactId>
175+
<configuration>
176+
<skip>true</skip>
177+
</configuration>
178+
</plugin>
179+
<plugin>
180+
<groupId>org.basepom.maven</groupId>
181+
<artifactId>duplicate-finder-maven-plugin</artifactId>
182+
<configuration>
183+
<ignoredResourcePatterns>
184+
<ignoredResourcePattern>parquet.thrift</ignoredResourcePattern>
185+
<ignoredResourcePattern>about.html</ignoredResourcePattern>
186+
<ignoredResourcePattern>mozilla/public-suffix-list.txt</ignoredResourcePattern>
187+
<ignoredResourcePattern>iceberg-build.properties</ignoredResourcePattern>
188+
<ignoredResourcePattern>org.apache.avro.data/Json.avsc</ignoredResourcePattern>
189+
</ignoredResourcePatterns>
190+
<ignoredClassPatterns>
191+
<ignoredClassPattern>com.esotericsoftware.kryo.*</ignoredClassPattern>
192+
<ignoredClassPattern>com.esotericsoftware.minlog.Log</ignoredClassPattern>
193+
<ignoredClassPattern>com.esotericsoftware.reflectasm.*</ignoredClassPattern>
194+
<ignoredClassPattern>module-info</ignoredClassPattern>
195+
<ignoredClassPattern>META-INF.versions.9.module-info</ignoredClassPattern>
196+
<ignoredClassPattern>org.apache.avro.*</ignoredClassPattern>
197+
<ignoredClassPattern>com.github.benmanes.caffeine.*</ignoredClassPattern>
198+
<ignoredClassPattern>org.roaringbitmap.*</ignoredClassPattern>
199+
</ignoredClassPatterns>
200+
</configuration>
201+
</plugin>
202+
<plugin>
203+
<groupId>org.apache.maven.plugins</groupId>
204+
<artifactId>maven-surefire-plugin</artifactId>
205+
<configuration>
206+
<forkCount>1</forkCount>
207+
<reuseForks>false</reuseForks>
208+
<systemPropertyVariables>
209+
<PRESTO_SERVER>/root/project/build/debug/presto_cpp/main/presto_server</PRESTO_SERVER>
210+
</systemPropertyVariables>
211+
</configuration>
212+
</plugin>
213+
</plugins>
214+
</build>
215+
</project>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
package com.facebook.presto.router.scheduler;
15+
16+
import com.facebook.airlift.configuration.Config;
17+
import com.google.common.base.Splitter;
18+
import com.google.common.collect.Streams;
19+
import io.airlift.units.Duration;
20+
import io.airlift.units.MinDuration;
21+
22+
import java.net.URI;
23+
import java.util.List;
24+
25+
import static com.google.common.collect.ImmutableList.toImmutableList;
26+
import static java.util.concurrent.TimeUnit.MINUTES;
27+
28+
public class PlanCheckerRouterPluginConfig
29+
{
30+
private static final Splitter SPLITTER = Splitter.on(',').trimResults().omitEmptyStrings();
31+
32+
private List<URI> planCheckClustersURIs;
33+
private URI javaRouterURI;
34+
private URI nativeRouterURI;
35+
private Duration clientRequestTimeout = new Duration(2, MINUTES);
36+
37+
@Config("plan-check-clusters-uris")
38+
public PlanCheckerRouterPluginConfig setPlanCheckClustersURIs(String uris)
39+
{
40+
if (uris == null) {
41+
this.planCheckClustersURIs = null;
42+
return this;
43+
}
44+
45+
this.planCheckClustersURIs = Streams.stream(SPLITTER.split(uris))
46+
.map(URI::create)
47+
.collect(toImmutableList());
48+
return this;
49+
}
50+
51+
public List<URI> getPlanCheckClustersURIs()
52+
{
53+
return planCheckClustersURIs;
54+
}
55+
56+
@Config("router-java-url")
57+
public PlanCheckerRouterPluginConfig setJavaRouterURI(URI javaRouterURI)
58+
{
59+
this.javaRouterURI = javaRouterURI;
60+
return this;
61+
}
62+
63+
public URI getJavaRouterURI()
64+
{
65+
return javaRouterURI;
66+
}
67+
68+
@Config("router-native-url")
69+
public PlanCheckerRouterPluginConfig setNativeRouterURI(URI nativeRouterURI)
70+
{
71+
this.nativeRouterURI = nativeRouterURI;
72+
return this;
73+
}
74+
75+
public URI getNativeRouterURI()
76+
{
77+
return nativeRouterURI;
78+
}
79+
80+
@MinDuration("0ns")
81+
public Duration getClientRequestTimeout()
82+
{
83+
return clientRequestTimeout;
84+
}
85+
86+
@Config("client-request-timeout")
87+
public PlanCheckerRouterPluginConfig setClientRequestTimeout(Duration clientRequestTimeout)
88+
{
89+
this.clientRequestTimeout = clientRequestTimeout;
90+
return this;
91+
}
92+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
package com.facebook.presto.router.scheduler;
15+
16+
import com.google.inject.Binder;
17+
import com.google.inject.Module;
18+
19+
import static com.facebook.airlift.configuration.ConfigBinder.configBinder;
20+
21+
public class PlanCheckerRouterPluginModule
22+
implements Module
23+
{
24+
@Override
25+
public void configure(Binder binder)
26+
{
27+
configBinder(binder).bindConfig(PlanCheckerRouterPluginConfig.class);
28+
}
29+
}

0 commit comments

Comments
 (0)