Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
/presto-resource-group-managers @prestodb/committers
/presto-router @prestodb/committers
/presto-server @prestodb/committers
/presto-session-property-managers @prestodb/committers
/presto-session-property-managers-common @prestodb/committers
/presto-file-session-property-manager @prestodb/committers
/presto-db-session-property-manager @prestodb/committers
/presto-singlestore @prestodb/committers
/presto-spi @prestodb/committers
/presto-sqlserver @prestodb/committers
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Additionally, the Hive plugin must be configured with location of your Hive meta

-Dhive.metastore.uri=thrift://localhost:9083

To modify the loaded plugins in IntelliJ, modify the `config.properties` located in `presto-main/etc`. You can modify `plugin.bundles` with the location of the plugin pom.xml

### Additional configuration for Java 17

When running with Java 17, additional `--add-opens` flags are required to allow reflective access used by certain catalogs based on which catalogs are configured.
Expand Down
31 changes: 29 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<dep.commons.lang3.version>3.18.0</dep.commons.lang3.version>
<dep.guice.version>6.0.0</dep.guice.version>
<dep.arrow.version>17.0.0</dep.arrow.version>
<dep.mariadb.version>3.5.4</dep.mariadb.version>

<dep.pos.classloader.module-name.suffix>2</dep.pos.classloader.module-name.suffix>

Expand Down Expand Up @@ -171,7 +172,9 @@
<module>presto-plugin-toolkit</module>
<module>presto-resource-group-managers</module>
<module>presto-password-authenticators</module>
<module>presto-session-property-managers</module>
<module>presto-session-property-managers-common</module>
<module>presto-db-session-property-manager</module>
<module>presto-file-session-property-manager</module>
<module>presto-benchto-benchmarks</module>
<module>presto-thrift-api</module>
<module>presto-thrift-testing-server</module>
Expand Down Expand Up @@ -341,7 +344,26 @@

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-session-property-managers</artifactId>
<artifactId>presto-session-property-managers-common</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-session-property-managers-common</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-db-session-property-manager</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-file-session-property-manager</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down Expand Up @@ -2678,6 +2700,11 @@
<version>${dep.arrow.version}</version>
</dependency>

<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>${dep.mariadb.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
175 changes: 175 additions & 0 deletions presto-db-session-property-manager/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<?xml version="1.0"?>
<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">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-root</artifactId>
<version>0.295-SNAPSHOT</version>
</parent>

<artifactId>presto-db-session-property-manager</artifactId>
<name>presto-db-session-property-manager</name>
<description>Presto - DB Session Property Manager</description>
<packaging>presto-plugin</packaging>

<properties>
<air.main.basedir>${project.parent.basedir}</air.main.basedir>
</properties>

<dependencies>
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-session-property-managers-common</artifactId>
</dependency>

<dependency>
<groupId>com.facebook.airlift</groupId>
<artifactId>bootstrap</artifactId>
</dependency>

<dependency>
<groupId>com.facebook.airlift</groupId>
<artifactId>log</artifactId>
</dependency>

<dependency>
<groupId>com.facebook.airlift</groupId>
<artifactId>json</artifactId>
</dependency>

<dependency>
<groupId>com.facebook.airlift</groupId>
<artifactId>configuration</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>

<dependency>
<groupId>com.facebook.airlift</groupId>
<artifactId>concurrent</artifactId>
</dependency>

<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>

<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-core</artifactId>
</dependency>

<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-sqlobject</artifactId>
</dependency>

<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<optional>true</optional>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<optional>true</optional>
<scope>runtime</scope>
</dependency>

<!-- Presto SPI -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-spi</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-common</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.facebook.airlift</groupId>
<artifactId>units</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>slice</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.openjdk.jol</groupId>
<artifactId>jol-core</artifactId>
<scope>provided</scope>
</dependency>

<!-- for testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-testng-services</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.airlift</groupId>
<artifactId>testing</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>testing-mysql-server-8</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>testing-mysql-server-base</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-session-property-managers-common</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.session;
package com.facebook.presto.session.db;

import com.facebook.presto.spi.Plugin;
import com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory;
import com.google.common.collect.ImmutableList;

public class FileSessionPropertyManagerPlugin
public class DbSessionPropertyConfigurationManagerPlugin
implements Plugin
{
@Override
public Iterable<SessionPropertyConfigurationManagerFactory> getSessionPropertyConfigurationManagerFactories()
{
return ImmutableList.of(new FileSessionPropertyManagerFactory());
return ImmutableList.of(
new DbSessionPropertyManagerFactory());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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.session.db;

import com.facebook.presto.session.AbstractSessionPropertyManager;
import com.facebook.presto.session.SessionMatchSpec;
import com.facebook.presto.spi.session.SessionConfigurationContext;
import com.facebook.presto.spi.session.SessionPropertyConfigurationManager;

import javax.inject.Inject;

import java.util.List;

import static java.util.Objects.requireNonNull;

/**
* A {@link SessionPropertyConfigurationManager} implementation that connects to a database for fetching information
* about session property overrides given {@link SessionConfigurationContext}.
*/
public class DbSessionPropertyManager
extends AbstractSessionPropertyManager
{
private final DbSpecsProvider specsProvider;

@Inject
public DbSessionPropertyManager(DbSpecsProvider specsProvider)
{
this.specsProvider = requireNonNull(specsProvider, "specsProvider is null");
}

@Override
protected List<SessionMatchSpec> getSessionMatchSpecs()
{
return this.specsProvider.get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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.session.db;

import com.facebook.airlift.configuration.Config;
import com.facebook.airlift.units.Duration;
import com.facebook.airlift.units.MinDuration;
import jakarta.validation.constraints.NotNull;

import static java.util.concurrent.TimeUnit.SECONDS;

public class DbSessionPropertyManagerConfig
{
private String configDbUrl;
private Duration specsRefreshPeriod = new Duration(10, SECONDS);

@NotNull
public String getConfigDbUrl()
{
return configDbUrl;
}

@Config("session-property-manager.db.url")
public DbSessionPropertyManagerConfig setConfigDbUrl(String configDbUrl)
{
this.configDbUrl = configDbUrl;
return this;
}

@NotNull
@MinDuration("1ms")
public Duration getSpecsRefreshPeriod()
{
return specsRefreshPeriod;
}

@Config("session-property-manager.db.refresh-period")
public DbSessionPropertyManagerConfig setSpecsRefreshPeriod(Duration specsRefreshPeriod)
{
this.specsRefreshPeriod = specsRefreshPeriod;
return this;
}
}
Loading
Loading