Skip to content

Commit

Permalink
Merge pull request trinodb#11 from operator-framework/metering-master…
Browse files Browse the repository at this point in the history
…-315

Update Metering master to presto 315
  • Loading branch information
openshift-merge-robot authored Jun 17, 2019
2 parents 16f321d + 8f58dc4 commit 4a71e77
Show file tree
Hide file tree
Showing 608 changed files with 12,550 additions and 5,647 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ script:
fi
- |
if [[ -v BUILD_PRESTO_DOCKER ]]; then
presto-docker-image/build-local.sh
docker/build-local.sh
fi
- |
if [[ -v WEBUI_CHECKS ]]; then
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ COPY presto-parquet /build/presto-parquet
COPY presto-proxy /build/presto-proxy
COPY presto-hive-hadoop2 /build/presto-hive-hadoop2
COPY presto-benchto-benchmarks /build/presto-benchto-benchmarks
COPY presto-docker-image /build/presto-docker-image
COPY presto-testing-docker /build/presto-testing-docker
COPY presto-memory-context /build/presto-memory-context
COPY presto-benchmark /build/presto-benchmark
Expand Down Expand Up @@ -94,7 +93,7 @@ RUN yum -y install --setopt=skip_missing_names_on_install=False \

RUN mkdir -p /opt/presto

ENV PRESTO_VERSION 313
ENV PRESTO_VERSION 315
ENV PRESTO_HOME /opt/presto/presto-server
ENV PRESTO_CLI /opt/presto/presto-cli
ENV PROMETHEUS_JMX_EXPORTER /opt/jmx_exporter/jmx_exporter.jar
Expand Down
37 changes: 37 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# 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.
#
FROM centos:centos7
LABEL maintainer="Presto community <https://prestosql.io/community.html>"

ENV JAVA_HOME /usr/lib/jvm/java-11
RUN \
set -xeu && \
yum -y -q update && \
yum -y -q install java-11-openjdk-devel less && \
yum -q clean all && \
rm -rf /var/cache/yum && \
rm -rf /tmp/* /var/tmp/* && \
groupadd presto --gid 1000 && \
useradd presto --uid 1000 --gid 1000 && \
mkdir -p /usr/lib/presto /data/presto && \
chown -R "presto:presto" /usr/lib/presto /data/presto

ARG PRESTO_VERSION
ARG CLIENT_VERSION=${PRESTO_VERSION}
COPY presto-cli-${CLIENT_VERSION}-executable.jar /usr/bin/presto
COPY --chown=presto:presto presto-server-${PRESTO_VERSION} /usr/lib/presto

EXPOSE 8080
USER presto:presto
CMD ["/usr/lib/presto/bin/run-presto"]
2 changes: 1 addition & 1 deletion presto-docker-image/README.md → docker/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# presto-docker-image
# Presto Docker Image

## About the Container
This Docker image is designed to provide the following
Expand Down
File renamed without changes.
29 changes: 29 additions & 0 deletions docker/build-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -euxo pipefail

# Retrieve the script directory.
SCRIPT_DIR="${BASH_SOURCE%/*}"
cd ${SCRIPT_DIR}

# Move to the root directory to run maven for current version.
pushd ..
PRESTO_VERSION=$(./mvnw --quiet help:evaluate -Dexpression=project.version -DforceStdout)
popd

WORK_DIR="$(mktemp -d)"
cp ../presto-server/target/presto-server-${PRESTO_VERSION}.tar.gz ${WORK_DIR}
tar -C ${WORK_DIR} -xzf ${WORK_DIR}/presto-server-${PRESTO_VERSION}.tar.gz
rm ${WORK_DIR}/presto-server-${PRESTO_VERSION}.tar.gz
cp -R bin default ${WORK_DIR}/presto-server-${PRESTO_VERSION}

cp ../presto-cli/target/presto-cli-${PRESTO_VERSION}-executable.jar ${WORK_DIR}

docker build ${WORK_DIR} -f Dockerfile --build-arg "PRESTO_VERSION=${PRESTO_VERSION}" -t "presto:${PRESTO_VERSION}"

rm -r ${WORK_DIR}

# Source common testing functions
. container-test.sh

test_container "presto:${PRESTO_VERSION}"
35 changes: 35 additions & 0 deletions docker/build-remote.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -euxo pipefail

# Retrieve the script directory.
SCRIPT_DIR="${BASH_SOURCE%/*}"
cd ${SCRIPT_DIR}

if [[ $# -lt 1 ]]; then
echo "Usage: $0 PRESTO_VERSION"
echo "Missing PRESTO_VERSION"
exit 1
fi

PRESTO_VERSION=$1
PRESTO_LOCATION="https://repo1.maven.org/maven2/io/prestosql/presto-server/${PRESTO_VERSION}/presto-server-${PRESTO_VERSION}.tar.gz"
CLIENT_LOCATION="https://repo1.maven.org/maven2/io/prestosql/presto-cli/${PRESTO_VERSION}/presto-cli-${PRESTO_VERSION}-executable.jar"

WORK_DIR="$(mktemp -d)"
curl -o ${WORK_DIR}/presto-server-${PRESTO_VERSION}.tar.gz ${PRESTO_LOCATION}
tar -C ${WORK_DIR} -xzf ${WORK_DIR}/presto-server-${PRESTO_VERSION}.tar.gz
rm ${WORK_DIR}/presto-server-${PRESTO_VERSION}.tar.gz
cp -R bin default ${WORK_DIR}/presto-server-${PRESTO_VERSION}

curl -o ${WORK_DIR}/presto-cli-${PRESTO_VERSION}-executable.jar ${CLIENT_LOCATION}
chmod +x ${WORK_DIR}/presto-cli-${PRESTO_VERSION}-executable.jar

docker build ${WORK_DIR} -f Dockerfile -t "presto:${PRESTO_VERSION}" --build-arg "PRESTO_VERSION=${PRESTO_VERSION}"

rm -r ${WORK_DIR}

# Source common testing functions
. container-test.sh

test_container "presto:${PRESTO_VERSION}"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 5 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>io.prestosql</groupId>
<artifactId>presto-root</artifactId>
<version>313</version>
<version>315</version>
<packaging>pom</packaging>

<name>presto-root</name>
Expand All @@ -30,7 +30,7 @@
<scm>
<connection>scm:git:git://github.com/prestosql/presto.git</connection>
<url>https://github.com/prestosql/presto</url>
<tag>313</tag>
<tag>315</tag>
</scm>

<properties>
Expand All @@ -44,7 +44,7 @@
<air.maven.version>3.3.9</air.maven.version>

<dep.antlr.version>4.7.1</dep.antlr.version>
<dep.airlift.version>0.182</dep.airlift.version>
<dep.airlift.version>0.183</dep.airlift.version>
<dep.packaging.version>${dep.airlift.version}</dep.packaging.version>
<dep.slice.version>0.36</dep.slice.version>
<dep.aws-sdk.version>1.11.445</dep.aws-sdk.version>
Expand Down Expand Up @@ -462,7 +462,7 @@
<dependency>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
<version>0.13</version>
<version>0.15</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -594,7 +594,7 @@
<dependency>
<groupId>io.airlift</groupId>
<artifactId>bytecode</artifactId>
<version>1.1</version>
<version>1.2</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -951,12 +951,6 @@
<version>1.1.2.6</version>
</dependency>

<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
<version>1.3.5-4</version>
</dependency>

<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion presto-accumulo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.prestosql</groupId>
<artifactId>presto-root</artifactId>
<version>313</version>
<version>315</version>
</parent>

<artifactId>presto-accumulo</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
import static io.prestosql.spi.StandardErrorCode.ALREADY_EXISTS;
import static io.prestosql.spi.StandardErrorCode.FUNCTION_IMPLEMENTATION_ERROR;
import static io.prestosql.spi.StandardErrorCode.INVALID_TABLE_PROPERTY;
import static io.prestosql.spi.StandardErrorCode.INVALID_VIEW;
import static io.prestosql.spi.StandardErrorCode.NOT_FOUND;
import static io.prestosql.spi.StandardErrorCode.NOT_SUPPORTED;
import static java.lang.String.format;
Expand Down Expand Up @@ -546,7 +545,7 @@ public void createView(SchemaTableName viewName, String viewData)
}

if (getTableNames(viewName.getSchemaName()).contains(viewName.getTableName())) {
throw new PrestoException(INVALID_VIEW, "View already exists as data table");
throw new PrestoException(ALREADY_EXISTS, "View already exists as data table");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,17 @@
import io.prestosql.plugin.accumulo.model.AccumuloColumnHandle;
import io.prestosql.plugin.accumulo.model.AccumuloSplit;
import io.prestosql.plugin.accumulo.model.AccumuloTableHandle;
import io.prestosql.plugin.accumulo.model.AccumuloTableLayoutHandle;
import io.prestosql.spi.connector.ColumnHandle;
import io.prestosql.spi.connector.ConnectorHandleResolver;
import io.prestosql.spi.connector.ConnectorInsertTableHandle;
import io.prestosql.spi.connector.ConnectorOutputTableHandle;
import io.prestosql.spi.connector.ConnectorSplit;
import io.prestosql.spi.connector.ConnectorTableHandle;
import io.prestosql.spi.connector.ConnectorTableLayoutHandle;
import io.prestosql.spi.connector.ConnectorTransactionHandle;

public class AccumuloHandleResolver
implements ConnectorHandleResolver
{
@Override
public Class<? extends ConnectorTableLayoutHandle> getTableLayoutHandleClass()
{
return AccumuloTableLayoutHandle.class;
}

@Override
public Class<? extends ConnectorTableHandle> getTableHandleClass()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import io.airlift.json.JsonCodec;
import io.airlift.json.JsonCodecFactory;
import io.airlift.json.ObjectMapperProvider;
import io.airlift.slice.Slice;
import io.prestosql.plugin.accumulo.metadata.AccumuloTable;
import io.prestosql.plugin.accumulo.metadata.AccumuloView;
import io.prestosql.plugin.accumulo.model.AccumuloColumnHandle;
import io.prestosql.plugin.accumulo.model.AccumuloTableHandle;
import io.prestosql.plugin.accumulo.model.AccumuloTableLayoutHandle;
import io.prestosql.spi.PrestoException;
import io.prestosql.spi.connector.ColumnHandle;
import io.prestosql.spi.connector.ColumnMetadata;
Expand All @@ -32,15 +33,15 @@
import io.prestosql.spi.connector.ConnectorOutputTableHandle;
import io.prestosql.spi.connector.ConnectorSession;
import io.prestosql.spi.connector.ConnectorTableHandle;
import io.prestosql.spi.connector.ConnectorTableLayout;
import io.prestosql.spi.connector.ConnectorTableLayoutHandle;
import io.prestosql.spi.connector.ConnectorTableLayoutResult;
import io.prestosql.spi.connector.ConnectorTableMetadata;
import io.prestosql.spi.connector.ConnectorTableProperties;
import io.prestosql.spi.connector.ConnectorViewDefinition;
import io.prestosql.spi.connector.Constraint;
import io.prestosql.spi.connector.ConstraintApplicationResult;
import io.prestosql.spi.connector.SchemaTableName;
import io.prestosql.spi.connector.SchemaTablePrefix;
import io.prestosql.spi.connector.TableNotFoundException;
import io.prestosql.spi.predicate.TupleDomain;
import io.prestosql.spi.statistics.ComputedStatistics;

import javax.inject.Inject;
Expand All @@ -66,6 +67,9 @@
public class AccumuloMetadata
implements ConnectorMetadata
{
private static final JsonCodec<ConnectorViewDefinition> VIEW_CODEC =
new JsonCodecFactory(new ObjectMapperProvider()).jsonCodec(ConnectorViewDefinition.class);

private final AccumuloClient client;
private final AtomicReference<Runnable> rollbackAction = new AtomicReference<>();

Expand Down Expand Up @@ -137,8 +141,9 @@ public void renameTable(ConnectorSession session, ConnectorTableHandle tableHand
}

@Override
public void createView(ConnectorSession session, SchemaTableName viewName, String viewData, boolean replace)
public void createView(ConnectorSession session, SchemaTableName viewName, ConnectorViewDefinition definition, boolean replace)
{
String viewData = VIEW_CODEC.toJson(definition);
if (replace) {
client.createOrReplaceView(viewName, viewData);
}
Expand All @@ -154,16 +159,10 @@ public void dropView(ConnectorSession session, SchemaTableName viewName)
}

@Override
public Map<SchemaTableName, ConnectorViewDefinition> getViews(ConnectorSession session, SchemaTablePrefix prefix)
public Optional<ConnectorViewDefinition> getView(ConnectorSession session, SchemaTableName viewName)
{
ImmutableMap.Builder<SchemaTableName, ConnectorViewDefinition> builder = ImmutableMap.builder();
for (SchemaTableName stName : listViews(session, prefix.getSchema())) {
AccumuloView view = client.getView(stName);
if (view != null) {
builder.put(stName, new ConnectorViewDefinition(stName, Optional.empty(), view.getData()));
}
}
return builder.build();
return Optional.ofNullable(client.getView(viewName))
.map(view -> VIEW_CODEC.fromJson(view.getData()));
}

@Override
Expand Down Expand Up @@ -250,24 +249,6 @@ public ConnectorTableHandle getTableHandle(ConnectorSession session, SchemaTable
return null;
}

@Override
public List<ConnectorTableLayoutResult> getTableLayouts(
ConnectorSession session,
ConnectorTableHandle table,
Constraint constraint,
Optional<Set<ColumnHandle>> desiredColumns)
{
AccumuloTableHandle tableHandle = (AccumuloTableHandle) table;
ConnectorTableLayout layout = new ConnectorTableLayout(new AccumuloTableLayoutHandle(tableHandle, constraint.getSummary()));
return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary()));
}

@Override
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle handle)
{
return new ConnectorTableLayout(handle);
}

@Override
public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle table)
{
Expand Down Expand Up @@ -352,6 +333,41 @@ public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSess
return columns.build();
}

@Override
public boolean usesLegacyTableLayouts()
{
return false;
}

@Override
public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(ConnectorSession session, ConnectorTableHandle table, Constraint constraint)
{
AccumuloTableHandle handle = (AccumuloTableHandle) table;

TupleDomain<ColumnHandle> oldDomain = handle.getConstraint();
TupleDomain<ColumnHandle> newDomain = oldDomain.intersect(constraint.getSummary());
if (oldDomain.equals(newDomain)) {
return Optional.empty();
}

handle = new AccumuloTableHandle(
handle.getSchema(),
handle.getTable(),
handle.getRowId(),
newDomain,
handle.isExternal(),
handle.getSerializerClassName(),
handle.getScanAuthorizations());

return Optional.of(new ConstraintApplicationResult<>(handle, constraint.getSummary()));
}

@Override
public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle handle)
{
return new ConnectorTableProperties();
}

private void checkNoRollback()
{
checkState(rollbackAction.get() == null, "Cannot begin a new write while in an existing one");
Expand Down
Loading

0 comments on commit 4a71e77

Please sign in to comment.