-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add udfs to pinot image #33
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3526556
feat: add udfs to pinot image
aaron-steinfeld 291ec07
Fixes broken project setup
569b3ee
remove copy/pasta
adriancole ec9d693
Merge remote-tracking branch 'origin/main' into add-pinot-udfs
aaron-steinfeld 9e21d87
Merge branch 'add-pinot-udfs' of github.com:hypertrace/pinot into add…
aaron-steinfeld 808ed96
feat: add udfs and upgrade to java 11 non-bundled image
aaron-steinfeld bd59ea9
Merge remote-tracking branch 'origin/main' into add-pinot-udfs
aaron-steinfeld 361b3cd
Merge remote-tracking branch 'origin/main' into add-pinot-udfs
aaron-steinfeld 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,14 @@ | ||
| plugins { | ||
| `java-library` | ||
| } | ||
|
|
||
| dependencies { | ||
| compileOnly("org.apache.pinot:pinot-spi:0.5.0") | ||
| compileOnly("org.apache.pinot:pinot-avro-base:0.5.0") | ||
| compileOnly("org.apache.kafka:kafka-streams:5.5.1-ccs") | ||
| compileOnly("org.apache.kafka:kafka-clients:5.5.1-ccs") | ||
| implementation("org.hypertrace.core.kafkastreams.framework:kafka-streams-serdes:0.1.11") { | ||
| // disable the transitive dependencies and use them from pinot itself. | ||
| isTransitive = false | ||
| } | ||
| } |
File renamed without changes.
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 |
|---|---|---|
| @@ -1,41 +1,23 @@ | ||
| plugins { | ||
| `java-library` | ||
| id("org.hypertrace.docker-publish-plugin") | ||
| } | ||
|
|
||
| hypertraceDocker { | ||
| defaultImage { | ||
| imageName.set("pinot-servicemanager") | ||
| tasks.named(buildTaskName) { | ||
| dependsOn("copyPlugins") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| configure<JavaPluginExtension> { | ||
| sourceCompatibility = JavaVersion.VERSION_11 | ||
| targetCompatibility = JavaVersion.VERSION_11 | ||
| } | ||
|
|
||
| val plugins by configurations.creating | ||
|
|
||
| dependencies { | ||
| compileOnly("org.apache.pinot:pinot-spi:0.5.0") | ||
| compileOnly("org.apache.pinot:pinot-avro-base:0.5.0") | ||
| compileOnly("org.apache.kafka:kafka-streams:5.5.1-ccs") | ||
| compileOnly("org.apache.kafka:kafka-clients:5.5.1-ccs") | ||
| implementation("org.hypertrace.core.kafkastreams.framework:kafka-streams-serdes:0.1.11") { | ||
| // disable the transitive dependencies and use them from pinot itself. | ||
| isTransitive = false | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| plugins(project(":${project.name}")) | ||
| plugins(project(":pinot-udf")) | ||
| plugins(project(":pinot-avro-serde")) | ||
| } | ||
|
|
||
| tasks.register<Sync>("copyPlugins") { | ||
| from(plugins) | ||
| into("${buildDir}/plugins") | ||
| } | ||
|
|
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,20 @@ | ||
| # Pinot UDFs | ||
|
|
||
| ## Requirements | ||
| These UDFs should have a minimal dependency tree and be compiled to support a java target no | ||
| higher than our pinot images use as a runtime. Currently, that means java 11. Any common dependencies | ||
| in the dependency tree (which can be seen via `gradlew dependencies --configuration runtimeClasspath`) | ||
| must be shaded, so should be avoided. | ||
|
|
||
| ## Warning on versions | ||
| As of [2379791](https://github.com/apache/incubator-pinot/commit/23797914c6fea24e34f3ebfca9a73e0fff72c2b7) | ||
| (between 0.5.0 and 0.6.0) pinot introduces a breaking change moving the ScalarFunction annotation to | ||
| a new packacge. Because these UDFs are used by both the main pinot image and the | ||
| pinot-servicemanager image, both images must use either an earlier version or a later version | ||
| (although they should be in sync regardless), and the compile dependency on pinot in this module | ||
| should reflect that same version. | ||
|
|
||
| ## Rationale | ||
| This UDF jar is added as a plugin to the pinot images built in this repository. The UDFs are used to | ||
| support projected attributes, where we support creating new attributes as read time-only projections, | ||
| using a combination of custom UDFs and those built in to pinot. |
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,8 @@ | ||
| plugins { | ||
| `java-library` | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation("org.hypertrace.core.attribute.service:attribute-projection-functions:0.4.1") | ||
| compileOnly("org.apache.pinot:pinot-common:0.5.0") | ||
| } | ||
34 changes: 34 additions & 0 deletions
34
.../src/main/java/org/apache/pinot/scalar/function/hypertrace/HypertraceScalarFunctions.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,34 @@ | ||
| package org.apache.pinot.scalar.function.hypertrace; | ||
|
|
||
| import static java.util.Objects.isNull; | ||
|
|
||
| import org.apache.pinot.common.function.annotations.ScalarFunction; | ||
| import org.hypertrace.core.attribute.service.projection.functions.DefaultValue; | ||
| import org.hypertrace.core.attribute.service.projection.functions.Hash; | ||
|
|
||
| public class HypertraceScalarFunctions { | ||
|
|
||
| private static final String NULL_STRING = "null"; | ||
| public static final String HASH_FUNCTION_NAME = "hash"; | ||
| public static final String DEFAULT_STRING_FUNCTION_NAME = "defaultString"; | ||
|
|
||
| @ScalarFunction(name = HASH_FUNCTION_NAME) | ||
| public static String hash(String value) { | ||
| return replaceNullWithNullString(Hash.hash(replaceNullStringWithNull(value))); | ||
| } | ||
|
|
||
| @ScalarFunction(name = DEFAULT_STRING_FUNCTION_NAME) | ||
| public static String defaultString(String value, String defaultValue) { | ||
| return replaceNullWithNullString( | ||
| DefaultValue.defaultString( | ||
| replaceNullStringWithNull(value), replaceNullStringWithNull(defaultValue))); | ||
| } | ||
|
|
||
| private static String replaceNullStringWithNull(String value) { | ||
| return NULL_STRING.equals(value) ? null : value; | ||
| } | ||
|
|
||
| private static String replaceNullWithNullString(String value) { | ||
| return isNull(value) ? NULL_STRING : value; | ||
| } | ||
| } |
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 |
|---|---|---|
|
|
@@ -11,3 +11,5 @@ plugins { | |
| } | ||
|
|
||
| include(":pinot-servicemanager") | ||
| include(":pinot-udf") | ||
| include(":pinot-avro-serde") | ||
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.
Uh oh!
There was an error while loading. Please reload this page.