使用Intellij idea调试presto

首先clone presto源代码:

1
git clone https://github.com/prestodb/presto.git

然后使用idea打开presto:

image.png | left | 747x676

然后idea会自动开始使用maven下载依赖。

添加执行配置

image.png | left | 486x622

进一步配置

image.png | left | 747x540

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.

然后就可以愉快地Debug了。
注意可以自定义 -Dconfig 来指定自己的配置文件,这样也会更好。

当然也可以本地弄个Maven私服开始搞presto插件开发。