Skip to content
The official home of the Presto distributed SQL query engine for big data
Java JavaScript TSQL Shell ANTLR HTML
Branch: master
Clone or download

Latest commit

caithagoras Fix session properties for query execution
- Apply session properties only to control and test main queries.
- Ignore query max run time session property.
Latest commit 21ca972 Jun 12, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Improve stale bot message Apr 11, 2019
.mvn Remove maven-buildtime-extension Oct 5, 2017
presto-accumulo Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-array Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-atop Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-base-jdbc Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-benchmark-driver Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-benchmark-runner Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-benchmark Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-benchto-benchmarks Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-blackhole Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-bytecode Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-cache Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-cassandra Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-cli Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-client Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-common Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-docs Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-druid Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-elasticsearch Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-example-http Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-expressions Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-function-namespace-managers Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-geospatial-toolkit Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-geospatial Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-hive-common Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-hive-hadoop2 Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-hive-metastore Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-hive Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-i18n-functions Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-jdbc Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-jmx Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-kafka Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-kudu Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-local-file Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-main Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-matching Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-memory-context Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-memory Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-ml Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-mongodb Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-mysql Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-orc Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-parquet Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-parser Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-password-authenticators Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-pinot-toolkit Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-pinot Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-plugin-toolkit Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-postgresql Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-product-tests Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-proxy Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-raptor Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-rcfile Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-record-decoder Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-redis Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-redshift Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-resource-group-managers Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-server-rpm Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-server Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-session-property-managers Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-spark-base Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-spark-classloader-interface Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-spark-launcher Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-spark-package Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-spark-testing Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-spark Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-spi Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-sqlserver Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-teradata-functions Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-testing-docker Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-testing-server-launcher Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-tests Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-thrift-connector-api Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-thrift-connector Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-thrift-testing-server Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-tpcds Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-tpch Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
presto-verifier Fix session properties for query execution Jun 14, 2020
src Add release notes collection script May 7, 2020
.gitattributes Migrate index page for WebUI to new javascript workflow Oct 18, 2018
.gitignore Migrate index page for WebUI to new javascript workflow Oct 18, 2018
.mailmap Add .mailmap to increase release stats accuracy Aug 27, 2019
.travis.yml Run presto-spark-base tests in a separate travis job May 11, 2020
CODE_OF_CONDUCT.md OSS Automated Fix: Addition of Code of Conduct Mar 28, 2019
CONTRIBUTING.md Fix minor typo in CLA instructions Nov 21, 2019
LICENSE Add LICENSE file Oct 1, 2013
NOTICES Add NOTICES file Jul 20, 2019
README.md Point release notes template and README to Release Notes Guidelines Aug 14, 2019
mvnw Update Maven wrapper to 3.5.0 Apr 12, 2017
pom.xml Prepare for next development iteration - 0.238-SNAPSHOT Jun 13, 2020
pull_request_template.md Mention formatting guidelines in the pull request template Oct 1, 2019

README.md

Presto Build Status

Presto is a distributed SQL query engine for big data.

See the User Manual for deployment instructions and end user documentation.

Requirements

  • Mac OS X or Linux
  • Java 8 Update 151 or higher (8u151+), 64-bit. Both Oracle JDK and OpenJDK are supported.
  • Maven 3.3.9+ (for building)
  • Python 2.4+ (for running with the launcher script)

Building Presto

Presto is a standard Maven project. Simply run the following command from the project root directory:

./mvnw clean install

On the first build, Maven will download all the dependencies from the internet and cache them in the local repository (~/.m2/repository), which can take a considerable amount of time. Subsequent builds will be faster.

Presto has a comprehensive set of unit tests that can take several minutes to run. You can disable the tests when building:

./mvnw clean install -DskipTests

Running Presto in your IDE

Overview

After building Presto for the first time, you can load the project into your IDE and run the server. We recommend using IntelliJ IDEA. Because Presto is a standard Maven project, you can import it into your IDE using the root pom.xml file. In IntelliJ, choose Open Project from the Quick Start box or choose Open from the File menu and select the root pom.xml file.

After opening the project in IntelliJ, double check that the Java SDK is properly configured for the project:

  • Open the File menu and select Project Structure
  • In the SDKs section, ensure that a 1.8 JDK is selected (create one if none exist)
  • In the Project section, ensure the Project language level is set to 8.0 as Presto makes use of several Java 8 language features

Presto comes with sample configuration that should work out-of-the-box for development. Use the following options to create a run configuration:

  • Main Class: com.facebook.presto.server.PrestoServer
  • VM Options: -ea -XX:+UseG1GC -XX:G1HeapRegionSize=32M -XX:+UseGCOverheadLimit -XX:+ExplicitGCInvokesConcurrent -Xmx2G -Dconfig=etc/config.properties -Dlog.levels-file=etc/log.properties
  • Working directory: $MODULE_DIR$
  • Use classpath of module: presto-main

The working directory should be the presto-main subdirectory. In IntelliJ, using $MODULE_DIR$ accomplishes this automatically.

Additionally, the Hive plugin must be configured with location of your Hive metastore Thrift service. Add the following to the list of VM options, replacing localhost:9083 with the correct host and port (or use the below value if you do not have a Hive metastore):

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

Using SOCKS for Hive or HDFS

If your Hive metastore or HDFS cluster is not directly accessible to your local machine, you can use SSH port forwarding to access it. Setup a dynamic SOCKS proxy with SSH listening on local port 1080:

ssh -v -N -D 1080 server

Then add the following to the list of VM options:

-Dhive.metastore.thrift.client.socks-proxy=localhost:1080

Running the CLI

Start the CLI to connect to the server and run SQL queries:

presto-cli/target/presto-cli-*-executable.jar

Run a query to see the nodes in the cluster:

SELECT * FROM system.runtime.nodes;

In the sample configuration, the Hive connector is mounted in the hive catalog, so you can run the following queries to show the tables in the Hive database default:

SHOW TABLES FROM hive.default;

Code Style

We recommend you use IntelliJ as your IDE. The code style template for the project can be found in the codestyle repository along with our general programming and Java guidelines. In addition to those you should also adhere to the following:

  • Alphabetize sections in the documentation source files (both in table of contents files and other regular documentation files). In general, alphabetize methods/variables/sections if such ordering already exists in the surrounding code.
  • When appropriate, use the Java 8 stream API. However, note that the stream implementation does not perform well so avoid using it in inner loops or otherwise performance sensitive sections.
  • Categorize errors when throwing exceptions. For example, PrestoException takes an error code as an argument, PrestoException(HIVE_TOO_MANY_OPEN_PARTITIONS). This categorization lets you generate reports so you can monitor the frequency of various failures.
  • Ensure that all files have the appropriate license header; you can generate the license by running mvn license:format.
  • Consider using String formatting (printf style formatting using the Java Formatter class): format("Session property %s is invalid: %s", name, value) (note that format() should always be statically imported). Sometimes, if you only need to append something, consider using the + operator.
  • Avoid using the ternary operator except for trivial expressions.
  • Use an assertion from Airlift's Assertions class if there is one that covers your case rather than writing the assertion by hand. Over time we may move over to more fluent assertions like AssertJ.
  • When writing a Git commit message, follow these guidelines.

Building the Web UI

The Presto Web UI is composed of several React components and is written in JSX and ES6. This source code is compiled and packaged into browser-compatible Javascript, which is then checked in to the Presto source code (in the dist folder). You must have Node.js and Yarn installed to execute these commands. To update this folder after making changes, simply run:

yarn --cwd presto-main/src/main/resources/webapp/src install

If no Javascript dependencies have changed (i.e., no changes to package.json), it is faster to run:

yarn --cwd presto-main/src/main/resources/webapp/src run package

To simplify iteration, you can also run in watch mode, which automatically re-compiles when changes to source files are detected:

yarn --cwd presto-main/src/main/resources/webapp/src run watch

To iterate quickly, simply re-build the project in IntelliJ after packaging is complete. Project resources will be hot-reloaded and changes are reflected on browser refresh.

Release Notes

When authoring a pull request, the PR description should include its relevant release notes. Follow Release Notes Guidelines when authoring release notes.

You can’t perform that action at this time.