Skip to content
Open
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
19 changes: 19 additions & 0 deletions presto-native-execution/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM presto/prestissimo-dependency:centos9

# Install necesary packages to run dev containers in CLion
# https://www.jetbrains.com/help/clion/prerequisites-for-dev-containers.html#remote_container
RUN dnf -y update && dnf -y install epel-release
RUN dnf -y --skip-broken install \
curl \
unzip \
procps \
libXext \
libXrender \
libXtst \
libXi \
freetype \
procps \
java-17-openjdk-headless \
python3.12

RUN pip3 install pre-commit
34 changes: 34 additions & 0 deletions presto-native-execution/.devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# How to develop Presto C++ with dev-containers in CLion

> **_NOTE:_** For this to work you need CLion 2025.2.2 or greater.

If you can't build, or want to build the development environment on your machine, you can use dev-containers. With them, you can have your IDE frontend working against a CLion backend running on a docker container. To set it up, run the following command:

```sh
docker compose build centos-native-dependency
```
Once the image is built, open the `presto-native-execution` module on CLion.

Right-click on `.devcontainer\devcontainer.json`, and in the contextual menu select `Dev Containers->Create Dev Container and mount sources...->CLion`. Wait for the container to be up and running before you continue.

The source code is mounted from your machine so any change made into it from the dev-container will also be on your machine.

## Debug or execute `presto_server`

Reload CMake project and configure the `presto_server` executable. See [Setup Presto with IntelliJ IDEA and Prestissimo with CLion](https://github.com/prestodb/presto/tree/master/presto-native-execution#setup-presto-with-intellij-idea-and-prestissimo-with-clion). Compile the project as needed.

Then, execute the script `./devcontainer/install-shared-libs.sh` inside the container. This will create a directory `/runtime-libraries` and copy all the shared libraries needed for your compilation runtime in there.

Edit the `presto_server` configuration to add the environment variable `LD_LIBRARY_PATH=/runtime-libraries`. This way, you'll have the same environment as distributed prestissimo images.

## Known errors
- In some cases an error such as `Computing backend... error. Collection contains no element matching the predicate` can appear. The feature is still in beta. In this case, the container will be created and running, but there might have been an issue starting the CLion backend inside the container.

To resolve this issue, close CLion and reopen it.

In the `Welcome to CLion` window go to `Remote Development (beta)->Dev Containers`. You should see that the container `Presto C++ Dev Container` is up and running, so connect to it. In this case, the backend should start properly and the project should be opened.

- In you can't use git inside the container, you need to manually add the mounted repo to the trusted directories for the dev-container
```sh
git config --global --add safe.directory /workspace/presto
```
8 changes: 8 additions & 0 deletions presto-native-execution/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Presto C++ Dev Container",
"build": {
"dockerfile": "Dockerfile"
},
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspace/presto,type=bind",
"workspaceFolder": "/workspace/presto/presto-native-execution"
}
17 changes: 17 additions & 0 deletions presto-native-execution/.devcontainer/install-shared-libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# 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.
# Before executing this script, you should compile presto_server
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you don't. Will CLion throw an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is only to match the release environment, making sure that you're executing the server this the same libraries as the release version. This way, if your compilation lacks any library, you should see failures during the execution before the code is integrated into master

# Copy shared libs to the directory /runtime-libraries
mkdir /runtime-libraries &&
bash -c '!(LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd ../cmake-build-debug/presto_cpp/main/presto_server | grep "not found")' &&
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd ../cmake-build-debug/presto_cpp/main/presto_server | awk 'NF == 4 { system("cp " $3 " /runtime-libraries") }'
4 changes: 4 additions & 0 deletions presto-native-execution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ Run CLion:

![ScreenShot](docs/images/cl_clangformat_switcherenable.png)

### Setup Presto C ++ with dev containers using [CLion](https://www.jetbrains.com/clion/)

See [How to develop Presto C++ with dev-containers in CLion](.devcontainer/README.md).

### Run Presto Coordinator + Worker
* Note that everything below can be done without using IDEs by running command line commands (not in this readme).
* Run QueryRunner as per your choice,
Expand Down
Loading