Skip to content

[Feature] Java UDF: (1) shared jar instance (2) atomic replace (3) environment variables #59415

@felix021

Description

@felix021

Search before asking

  • I had searched in the issues and found no similar issues.

Description

Scenario 1

Background

I'm developing a UDF, which loads an IP Database in memory on initialization for querying the physical address for a certain IPv4 address.

For example, "123.123.46.46" is located in Chaoyang District, Beijing.

Problem

What I planned is to provide two UDF entry String getProvince(String) and String getCity(String) in one JAR. It works, but it seems that each UDF is supported by a standalone instance of the JAR, which is a waste of resources.

Proposal

  1. Create a jar resource first;
  2. Create Java UDFs based on the jar resource;

This way the two UDFs can share the same in memory database.

Scenario 2

Proposal

Provide a way for atomically replacing Java UDFs to avoid unexpected calls from running queries.

Scenario 3

Proposal

Allow defining environment variables in PROPERTIES when creating a Java UDF, to avoid hard coded parameters (e.g. Certain configuration differ between prod/test deployments.)

Use case

No response

Related issues

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions