-
Notifications
You must be signed in to change notification settings - Fork 15
UDF support: CREATE FUNCTION DDL with pipeline SQL integration #198
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
Open
ryannedolan
wants to merge
16
commits into
main
Choose a base branch
from
udfs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
63ebcf0
UDF support: CREATE FUNCTION DDL with pipeline SQL integration
ryannedolan 5af8d9f
Fix k8s-ddl-udf.id expected output: uppercase identifiers, all sessio…
ryannedolan 83a3785
Demo UDFs in Flink data plane with integration test
ryannedolan e00c73f
Route UDF delivery through SqlJob CRD for dynamic file delivery
ryannedolan e0dca08
Merge origin/main into udfs
ryannedolan 851d7c0
Revive hoptimator-flink-adapter: SqlJob controller in the build
ryannedolan fd4c18a
Fix SpotBugs: make UDF directory configurable via system property
ryannedolan bd404b7
Fix integration test expected output: empty files renders as blank
ryannedolan 768ec26
Fix integration test: empty files map renders as indented {}
ryannedolan 6436bb9
Trim trailing newline from SnakeYAML map dump in template engine
ryannedolan 6d2a7ac
FlinkRunner fetches SQL and files from SqlJob via K8s API
ryannedolan d864f5c
Add integration test for SqlJob with inline UDF files
ryannedolan b82d83c
Clean CREATE FUNCTION syntax with dollar-quoting and AS/IN semantics
ryannedolan 5099bbf
Support file paths and URLs in CREATE FUNCTION IN clause
ryannedolan 01d0814
Add USING JAR support for Java UDF archives
ryannedolan 61965bf
Merge branch 'main' into udfs
ryannedolan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ## Grants the Flink service account read access to SqlJob CRs, | ||
| ## so FlinkRunner can fetch SQL and files at runtime. | ||
|
|
||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: sqljob-reader | ||
| rules: | ||
| - apiGroups: ["hoptimator.linkedin.com"] | ||
| resources: ["sqljobs"] | ||
| verbs: ["get"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: flink-sqljob-reader | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: sqljob-reader | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: flink | ||
| namespace: flink |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
hoptimator-api/src/main/java/com/linkedin/hoptimator/UserFunction.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package com.linkedin.hoptimator; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.Map; | ||
|
|
||
|
|
||
| public class UserFunction implements Deployable { | ||
|
|
||
| private final String name; | ||
| private final String as; | ||
| private final String namespace; | ||
| private final Map<String, String> options; | ||
|
|
||
| public UserFunction(String name, String as, String namespace, Map<String, String> options) { | ||
| this.name = name; | ||
| this.as = as; | ||
| this.namespace = namespace; | ||
| this.options = options != null ? options : Collections.emptyMap(); | ||
| } | ||
|
|
||
| public String name() { | ||
| return name; | ||
| } | ||
|
|
||
| public String as() { | ||
| return as; | ||
| } | ||
|
|
||
| public String namespace() { | ||
| return namespace; | ||
| } | ||
|
|
||
| public Map<String, String> options() { | ||
| return options; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "UserFunction[" + name + "]"; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 11 additions & 8 deletions
19
...adapter/src/main/java/com/linkedin/hoptimator/operator/flink/FlinkControllerProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 5 additions & 20 deletions
25
hoptimator-flink-adapter/src/main/resources/FlinkStreamingSqlJob.yaml.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,14 @@ | ||
| apiVersion: flink.apache.org/v1beta1 | ||
| kind: FlinkDeployment | ||
| kind: FlinkSessionJob | ||
| metadata: | ||
| namespace: {{namespace}} | ||
| name: {{name}}-flink-job | ||
| name: {{name}} | ||
| spec: | ||
| image: docker.io/library/hoptimator-flink-runner | ||
| imagePullPolicy: Never | ||
| flinkVersion: v1_18 | ||
| flinkConfiguration: | ||
| taskmanager.numberOfTaskSlots: "1" | ||
| serviceAccount: flink | ||
| jobManager: | ||
| resource: | ||
| memory: "2048m" | ||
| cpu: 0.1 | ||
| taskManager: | ||
| resource: | ||
| memory: "2048m" | ||
| cpu: 0.1 | ||
| deploymentName: basic-session-deployment | ||
| job: | ||
| entryClass: com.linkedin.hoptimator.flink.runner.FlinkRunner | ||
| args: | ||
| - {{sql}} | ||
| jarURI: local:///opt/hoptimator-flink-runner.jar | ||
| - --sqljob={{namespace}}/{{name}} | ||
| jarURI: file:///opt/hoptimator-flink-runner.jar | ||
| parallelism: 1 | ||
| upgradeMode: stateless | ||
| state: running | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is namespace used for? The only UserFunction caller seems to set it as null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I think that's a holdover from
IN <namespace>that got copied fromcreate trigger. Will fix.