DEV Community

Cover image for How to Build Presto from Source - OSS Contribution Guide (Step by Step Tutorial)
Saurabh Mahawar
Saurabh Mahawar

Posted on • Originally published at prestodb.io

How to Build Presto from Source - OSS Contribution Guide (Step by Step Tutorial)

PrestoDB logo

This step-by-step tutorial is designed specifically for beginners and first-time contributors who want to build Presto from source, run the Presto server locally, understand the codebase, and successfully submit their first pull request. By the end of this guide, you will have a fully working local Presto setup and a clear understanding of the complete contribution workflow, from Git setup to PR merge.

Prerequisites

Requirement Details
Operating System macOS or Linux (Windows via WSL2)
Java Java 17 (64-bit) - OpenJDK or Oracle JDK
Python Python 2.4+ (for launcher scripts), Not Required for Development
Git Latest version
RAM Minimum 8GB (16GB recommended)
Disk Space At least 10GB free

[Tip]
IntelliJ IDEA is recommended for Presto development.

Knowledge Prerequisites

  • Java Programming Knowledge.
  • Familiarity with command-line tools
  • Git & Version Control Basics.
  • Maven Build Tool.
  • SQL & Distributed Systems knowledge (helpful but not required).

Required Accounts

  • GitHub Account
  • Slack Account (To Join Presto Slack Community, ask in #general or #dev for any help)

Configuring Git

If you are a macOS user, use the pre-installed Git . But, if you are using Linux or Windows, download the latest version of Git from here.

Open the terminal and run the below command.

git --version
Enter fullscreen mode Exit fullscreen mode

Configure Git with your name and email.

  • Set your name
git config --global user.name "Your Name"
Enter fullscreen mode Exit fullscreen mode
  • Set your email
git config --global user.email "example@gmail.com"
Enter fullscreen mode Exit fullscreen mode

Installing Java Development Kit (JDK)

  • Download and Install Java 17 (either OpenJDK or Oracle JDK).
  • Download .dmg file (if you are on macOS), download link.
  • Set JAVA_HOME (add to ~/.zshrc or ~/.bash_profile).

Verify JDK Installation

java -version
Enter fullscreen mode Exit fullscreen mode

Forking and Cloning the Repository

Forking The Repository

  • Navigate to the Presto GitHub repository
  • Click the "Fork" button in the top-right corner
  • Create a copy of the Presto repository under your GitHub account.

    Cloning Your Forked Repository
  • Navigate to the directory where you want to store the project on your local machine.

cd ~/ Desktop (or your preferred Directory)
Enter fullscreen mode Exit fullscreen mode
  • Clone the project
git clone https://github.com/YOUR_USERNAME/presto.git
Enter fullscreen mode Exit fullscreen mode
  • Navigate to the directory
cd ~/ presto
Enter fullscreen mode Exit fullscreen mode
  • Verify the cloned repository.
ls -la
Enter fullscreen mode Exit fullscreen mode

Understanding the Presto Project Structure (Codebase)

Understand the key modules in the Presto codebase:

presto/
├── .github/              # GitHub workflows and templates
├── docker/               # Docker configurations
├── presto-accumulo/      # Accumulo connector
├── presto-analyzer/      # Semantic analysis and query validation
├── presto-base-jdbc/     # Base JDBC connector
├── presto-cli/           # Command-line interface
├── presto-client/        # Client libraries
├── presto-common/        # Common utilities
├── presto-docs/          # Documentation (Sphinx/RST)
├── presto-hive/          # Hive connector
├── presto-main/          # Core engine
├── presto-parser/        # SQL parser
├── presto-server/        # Server packaging
├── presto-spi/           # Service Provider Interface
├── presto-tests/         # Integration tests
├── pom.xml               # Root Maven configuration
├── CONTRIBUTING.md       # Contribution guidelines
└── README.md             # Project overview
Enter fullscreen mode Exit fullscreen mode
File Purpose
README.md Project overview and build instructions
CONTRIBUTING.md Contribution guidelines
ARCHITECTURE.md Mission and technical architecture
pom.xml Maven project configuration
CODEOWNERS Code ownership and module maintainers

[Info]
Note that each module has its own pom.xml and follows Maven’s standard directory structure.

Setting Up IntelliJ IDEA for Presto

1. Configure Maven:

  • Go to IntelliJ IDEA → Settings → Build, Execution, Deployment → Build Tools → Maven → Use Maven wrapper

  • Go to Maven → Runner → Enable Skip Tests → Click Apply → OK

2. Configure JDK
  • Go to File → Project Structure → Project

  • Set SDK to Java 17 (or download directly)

  • Go to Run → Edit Configurations

  • Set Java 17 as SDK and presto-main as class path.

  • Add below configurations in VM Options.

-ea  
-XX:+UseG1GC  
-XX:G1HeapRegionSize=32M  
-XX:+UseGCOverheadLimit  
-XX:+ExplicitGCInvokesConcurrent  
-Xmx2G  
-Dconfig=/Users/your-complete-path/presto/presto-main/etc/config.properties  
-Dlog.levels-file=etc/log.properties  
-Djdk.attach.allowAttachSelf=true   
--add-opens=java.base/java.io=ALL-UNNAMED  
--add-opens=java.base/java.lang=ALL-UNNAMED  
--add-opens=java.base/java.lang.ref=ALL-UNNAMED  
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED  
--add-opens=java.base/java.net=ALL-UNNAMED  
--add-opens=java.base/java.nio=ALL-UNNAMED  
--add-opens=java.base/java.security=ALL-UNNAMED  
--add-opens=java.base/javax.security.auth=ALL-UNNAMED  
--add-opens=java.base/javax.security.auth.login=ALL-UNNAMED  
--add-opens=java.base/java.text=ALL-UNNAMED  
--add-opens=java.base/java.util=ALL-UNNAMED  
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED  
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED  
--add-opens=java.base/java.util.regex=ALL-UNNAMED  
--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED  
--add-opens=java.base/sun.security.action=ALL-UNNAMED  
--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED
Enter fullscreen mode Exit fullscreen mode
  • Set Main Class to com.facebook.presto.server.PrestoServer

  • Set Working Directory $MODULE_DIR$

  • Click on Modify Options and check the options

  • Click Apply to save the configuration. IntelliJ is now set up and ready for Presto development.

Building Presto from Source

Build Presto from source to verify your environment and test your changes.

  • Navigate to the directory where presto is cloned.
cd ~/Desktop/presto
Enter fullscreen mode Exit fullscreen mode
  • Run the following command to build Presto for the first time.
./mvnw clean install -DskipTests
Enter fullscreen mode Exit fullscreen mode

[Info]

  1. mvnw: Runs Maven Wrapper
  2. clean: Removes previous build artifacts
  3. install: Compiles code, packages it, and installs to local Maven repository
  4. DskipTests: Skips running tests (faster for initial build)

[Important]
Skipping tests is acceptable only for initial setup or local exploration.

All PRs must pass tests and should be built without -DskipTests before submission.

Build Success Logs

  • Verify the setup and run the Presto server directly from IntelliJ.

  • Confirm that the Presto server is running on localhost:8080

[Success]
Server is running on localhost:8080

Connect with Presto CLI

  • Open a new terminal, navigate to the presto-cli directory, and then move into the target directory. Run below command.
cd presto-cli/target
Enter fullscreen mode Exit fullscreen mode
java -jar presto-cli-*-SNAPSHOT-executable.jar \
  --server localhost:8080
Enter fullscreen mode Exit fullscreen mode
  • Verify that the presto prompt appears.
presto> show catalogs;
Enter fullscreen mode Exit fullscreen mode

[Success]
Connected with Presto CLI

Build Specific Modules
  • To build only a specific module, run the below command:
cd presto-cli
./mvnw clean install -DskipTests
Enter fullscreen mode Exit fullscreen mode

Setting Up Upstream Remote

Keep your fork synchronized with the main Presto repository.

  • Add the upstream remote
git remote add upstream https://github.com/prestodb/presto.git
Enter fullscreen mode Exit fullscreen mode
  • Verify your remote
git remote -v
Enter fullscreen mode Exit fullscreen mode
  • origin: Your fork on GitHub (where you push changes)
  • upstream: The main Presto repository (where you pull updates)

[NOTE]
Do not commit changes directly to master. Always create a feature branch.

Making Code Contributions

Syncing Your Fork

  • Before creating a new branch, ensure your fork is up to date:
#Make sure you're on master
git checkout master 

#Fetch updates from upstream
git fetch upstream 

#Merge upstream changes into your master
git merge upstream/master 

#Push updates to your fork
git push origin master 
Enter fullscreen mode Exit fullscreen mode

[Tip]
Sync your fork regularly to avoid merge conflicts.

Find an Issue to Fix
  • Visit the Presto Issues Page, or
  • Look for issues that interest you, or
  • Find an Issue to fix with labels like good first issues, documentation, etc

[Important]
Comment on the issue to let others know you're working on it.

Creating a Feature Branch
  • Create and switch to a new branch, use descriptive branch names that indicate what you're working on:
git checkout -b feature/meaningful-branch-name
Enter fullscreen mode Exit fullscreen mode

[Example]

  1. feature/add-trim-function
  2. bugfix/fix-null-pointer-in-parser
  3. docs/update-contribution-guide
  4. refactor/simplify-planner-logic
  5. test/add-hive-connector-tests
  • Verify that you are on the new branch.
git branch
Enter fullscreen mode Exit fullscreen mode
  • Make Your Changes in the Code
  • Write or Update Tests
  • Run Tests Locally
# Run tests for the module you changed
cd presto-main
../mvnw test

# If all pass, run full build
cd ..
./mvnw clean install
Enter fullscreen mode Exit fullscreen mode
  • Commit your changes
# Stage your changes
git add .

# Commit with proper format
git commit -m "Your Message"
Enter fullscreen mode Exit fullscreen mode
  • Write clear and descriptive commit messages.

[Example]
Commit Message Format:

<type> [(scope)]: <subject>
[optional body]
[optional footer]

Types:

  1. feat: New feature
  2. fix: Bug fix
  3. docs: Documentation only
  4. refactor: Code refactoring
  5. perf: Performance improvement
  6. test: Adding or modifying tests
  7. build: Build system changes

[ToDo]
Subject Line Rules:

  1. Start with capital letter
  2. Use imperative mood ("Add feature" not "Added feature")
  3. No period at the end
  4. Be concise but descriptive
  5. Limit to 50-72 characters when possible

[Example]

  1. git commit -m "feat(function): Add trim function with custom characters"
  2. git commit -m "fix(parser): Handle null values in WHERE clause"
  3. git commit -m "docs(connector): Update Hive connector configuration guide"
  • Push to your Fork
git push origin feature/meaningful-branch-name
Enter fullscreen mode Exit fullscreen mode
  • Create a Pull Request (PR)
  1. Go to your fork on GitHub: https://github.com/YOUR_USERNAME/presto
  2. Click "Compare & pull request"
  3. Set: Base repo: prestodb/presto, Base branch: master, Head repo: your fork, Compare branch: your feature branch
  4. Fill out PR Template.
  • Sign the CLA

[Important]
On your first PR, the CLA bot will comment asking you to sign the Contributor License Agreement:

  1. Click the link provided by the bot
  2. Sign the CLA electronically
  3. The bot will update your PR status

[Success]
You have successfully contributed to Presto Open Source

After Your PR is Merged

Congratulations! You are now a contributor to the Presto project.

[Important Links]
Presto Website: https://prestodb.io
Join Slack: https://communityinviter.com/apps/prestodb/prestodb

GitHub logo prestodb / presto

The official home of the Presto distributed SQL query engine for big data

Presto

LFX Health Score

Presto is a distributed SQL query engine for big data.

See the Presto installation documentation for deployment instructions.

See the Presto documentation for general documentation.

Mission and Architecture

See PrestoDB: Mission and Architecture.

Requirements

  • Mac OS X or Linux
  • Java 17 64-bit. Both Oracle JDK and OpenJDK are supported.
  • Maven 3.6.3+ (for building)
  • Python 2.4+ (for running with the launcher script)


Overview (Java)

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.

When building multiple Presto projects locally, each project may write updates to the user's global M2 cache, which could cause build issues. You can configure your local .mvn/maven.config

Top comments (0)