Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-22064][sql-client] Support ADD JAR command in sql client #15558

Closed
wants to merge 1 commit into from

Conversation

xiangtao
Copy link

@xiangtao xiangtao commented Apr 12, 2021

What is the purpose of the change

this change is to support "ADD JAR" statement in the SQL Client

Brief change log

  • Add a method addJars in Executor
  • Add a method addJars in SessionContext
  • Add a class AddJarOperationParseStrategy for ADD JAR statement

Verifying this change

This change added tests and can be verified as follows:

  • Added grammar test in SqlToOperationConverterTest
  • Add single statement test in SessionContextTest
  • Added integration tests for add jar statement in resources/sql/add.q

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Apr 12, 2021

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit e97df4a (Sat Aug 28 12:15:22 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Apr 12, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

@fsk119
Copy link
Member

fsk119 commented May 7, 2021

Sorry for the late response... Could you rebase your branch to the master? I am ready to review recently.

@fsk119
Copy link
Member

fsk119 commented May 7, 2021

Hi, @xiangtao. After quick review, I think it's better to use calcite parser to parse the command. We can throw exception early if users only input ADD JAR and users can get more specific error messages. What's more, some other ecosystems that needs ADD JAR prefer to use the CalciteParser to parse the sqls. It's more friendly for them if we can add these features in the CalciteParser.

You can refer to #15087 about how to extends the grammer in CalciteParser.

@fsk119
Copy link
Member

fsk119 commented May 7, 2021

The current test only tells us we can ADD JAR into the classloader. But does it really means whether we can load the function from the added jars? The most convenient way to verify is to use CliClientITCase to test funciton.q. In CliClientITCase#setup we mannualy register the jar into the client, I find add jar doesn't work for the test.

The ADD JAR has two parts in SQL client actually:

  • add the url to the classloader. When compile the sql to job graph, the classloader will find the defination of the reference functions/connectors in the resources
  • add the urls to PipelineOptions#Jars. The ExecutionEnvironment will upload the jars to the remote, e.g. YarnClusterDescriptor#startAppMaster. Therefore, you are responsible to set the jar files into the Configuratition. Please refer to DefaultContext#createExecutionConfig for more details.

By the way, you should also consider RESET to rollback the added jar files.

Also I am confused why do you use list as the input of the Executor#addJars. The API in the doc we only support to add one jar.

@fsk119
Copy link
Member

fsk119 commented May 11, 2021

@xiangtao Are you still working on this branch? I am willing to help.

@fsk119
Copy link
Member

fsk119 commented May 17, 2021

CC #15925

@xiangtao
Copy link
Author

@fsk119 sorry , i can help to test code

@xiangtao xiangtao closed this Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants