How to develop impala fe code using vscode plugins - MicePilot/vscode-impala-pack GitHub Wiki

How to develop impala fe code using vscode plugins

Developing java in vscode requires the use of a series of plugins:

Steps

  1. Download and install jdk

    • Language Support for Java™ by Red Hat is implemented based on Eclipse, and it's language server startup depends on a higher jdk version, generally above jdk11, and the latest version depends on jdk17. You can download jdk on this page.

    • The jdk that the development depends on can be different from the jdk that the plugin depends on, that is, jdk 1.8, etc. can be used.

  2. Configure the plugin

    You can write in settings json as follows:

    "java.autobuild.enabled": false,
    // Configure language server startup parameters to avoid its oom
    "java.jdt.ls.vmargs": "-Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication",
    // Configure the language server to start the dependent jdk
    "java.jdt.ls.java.home": "/opt/impala/jdk-17.0.4.1+1",
    // Configure the jdk used by impala for development
    "java.configuration.runtimes": [
       
       {
           "name": "JavaSE-1.8",
           "path": "/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64"
       }
    ],
    

    Or you can also configure in the settings interface: image

  3. Restart vscode and open the java file, you can see the java index is being built, this is a long process, when it is done, you can use ctrl/control + left mouse button to jump to the code

    image image

Problems

  1. The code cannot jump

You have to wait for the index build to finish, if ths language server is not building, or language server is not started for unknown reasons, you can restart it using the vscode command:

image

  1. How to debug

Use the Debugger for Java plugin,edit the .vscode/launch.json file in the project directory and add the following settings,then start the impala cluster and select the debug window attach in vscode to debug:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "java",
      "name": "FE Debug (Attach) - Process catalogd",
      "request": "attach",
      "hostName": "127.0.0.1",
      "port": 30030,
      "projectName": "impala-frontend"
    },
    {
      "type": "java",
      "name": "FE Debug (Attach) - Process impalad",
      "request": "attach",
      "hostName": "127.0.0.1",
      "port": 30000,
      "projectName": "impala-frontend"
    },
  ]
}

image