Welcome to the world of Trino! Trino is a robust distributed SQL query engine designed for big data analytics, providing a fast and efficient way to analyze vast datasets. In this guide, we will walk you through the steps required to build and run Trino in your development environment, ensuring a smooth experience.
Prerequisites
Before we dive into building Trino, you need to ensure that your development environment is set up correctly. Here are the requirements:
- Mac OS X or Linux
- Java 22.0.0+, 64-bit
- Docker
- Ensure SELinux or similar systems do not disable write access to your local checkout
Building Trino
Trino uses Maven for building. Think of Maven as a chef in a grand kitchen, checking the recipe (code) and gathering all necessary ingredients (dependencies) to prepare a delightful dish (the final product).
To build Trino, follow these simple steps:
./mvnw clean install -DskipTests
On your first build, Maven will download all necessary dependencies from the internet, storing them in your local repository (~/.m2/repository). Depending on your connection speed, this could take a bit of time.
Subsequent builds will be faster since Maven uses the cached dependencies. Since Trino has many tests that can take time to run, they are skipped by the command above. It is advisable to run tests only for the specific parts of code that you have modified.
Running Trino in Your IDE
After successfully building Trino, it’s time to open the project in your IDE (we recommend IntelliJ IDEA). You can think of your IDE as a control center where you’ll monitor and manage your built project.
- From the *Quick Start* box or the *File* menu, select *Open Project* and choose the root
pom.xml
file. - Ensure the Java SDK is correctly configured:
- Go to the File menu and select *Project Structure*.
- In the SDKs section, ensure JDK 22 is selected (create one if it doesn’t exist).
- In the Project section, ensure the Project language level is set to 22.
Running a Development Server
The easiest way to run Trino for development purposes is by utilizing the TpchQueryRunner
class. It’s like starting the engine of a race car to begin your journey. This will launch a development version of the server configured with the TPCH connector.
To run the server:
- Use the following configuration options:
- Main Class:
io.trino.server.DevelopmentServer
- VM Options:
-ea
-Dconfig=etc/config.properties
-Dlog.levels-file=etc/log.properties
-Djdk.attach.allowAttachSelf=true
- Working directory:
$MODULE_DIR$
- Select classpath of module:
trino-server-dev
- Main Class:
- If the VM options dialog does not appear, select Modify options and ensure Add VM options is enabled.
Running the CLI
With the server running, you can now connect to it using the CLI. This interface will allow you to run SQL queries as you assess the health and performance of your data:
client/trino-cli/target/trino-cli-*-executable.jar
To inspect the nodes in the cluster, execute the following query:
SELECT * FROM system.runtime.nodes;
Alternatively, to run a query against the TPCH connector, use:
SELECT * FROM tpch.tiny.region;
Troubleshooting
If you encounter issues during the build or execution, consider the following solutions:
- Ensure that your Java version is compatible (22.0.0+).
- Check that Docker is properly installed and running.
- Ensure that SELinux or other security settings are not restricting write access to your files.
- If you face connection issues, make sure your server is running correctly.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
You’ve successfully learned how to build and run Trino, a powerful tool for big data analytics. Remember, technology is always evolving, and such advancements are fundamental for the future of AI, enabling more comprehensive and effective solutions. At fxis.ai, our team is dedicated to exploring new methodologies to push the envelope in artificial intelligence, ensuring our clients benefit from the latest technological innovations.