-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Transport UDF plugin to create platform SourceSets and generate w…
…rappers
- Loading branch information
1 parent
35a3ffc
commit 50a05ab
Showing
33 changed files
with
706 additions
and
74 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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,6 +1,5 @@ | ||
#Wed Aug 08 12:17:32 PDT 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip |
This file contains 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 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 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 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 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 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 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 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 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 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 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
65 changes: 13 additions & 52 deletions
65
transportable-udfs-examples/transportable-udfs-example-udfs/build.gradle
This file contains 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 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,36 @@ | ||
plugins { | ||
id 'java' | ||
id 'java-gradle-plugin' | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
simplePlugin { | ||
id = 'com.linkedin.transport.plugin' | ||
implementationClass = 'com.linkedin.transport.plugin.TransportPlugin' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile project(':transportable-udfs-api') | ||
compile project(':transportable-udfs-codegen') | ||
compile ('com.google.guava:guava:24.1-jre') | ||
compile ('com.google.code.gson:gson:2.8.5') | ||
testCompile('org.spockframework:spock-core:1.1-groovy-2.4') { | ||
exclude group: 'org.codehaus.groovy' | ||
} | ||
} | ||
|
||
def writeVersionInfo = { file -> | ||
ant.propertyfile(file: file) { | ||
entry(key: "transport-version", value: version) | ||
entry(key: "hive-version", value: '1.2.2') | ||
entry(key: "presto-version", value: '0.203') | ||
entry(key: "spark-version", value: '2.3.0') | ||
} | ||
} | ||
|
||
processResources.doLast { | ||
writeVersionInfo(new File(sourceSets.main.output.resourcesDir, "version-info.properties")) | ||
} |
100 changes: 100 additions & 0 deletions
100
transportable-udfs-plugin/src/main/java/com/linkedin/transport/plugin/Defaults.java
This file contains 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,100 @@ | ||
/** | ||
* Copyright 2019 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.plugin; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.linkedin.transport.codegen.HiveWrapperGenerator; | ||
import com.linkedin.transport.codegen.PrestoWrapperGenerator; | ||
import com.linkedin.transport.codegen.SparkWrapperGenerator; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Properties; | ||
|
||
import static com.linkedin.transport.plugin.DependencyConfigurationName.*; | ||
|
||
|
||
/** | ||
* Stores default configurations for the Transport UDF plugin | ||
*/ | ||
class Defaults { | ||
|
||
private Defaults() { | ||
} | ||
|
||
// The versions of the Transport and supported platforms to apply corresponding versions of the platform dependencies | ||
private static final Properties DEFAULT_VERSIONS; | ||
|
||
static { | ||
DEFAULT_VERSIONS = new Properties(); | ||
try { | ||
DEFAULT_VERSIONS.load( | ||
Thread.currentThread().getContextClassLoader().getResourceAsStream("version-info.properties")); | ||
} catch (IOException e) { | ||
throw new RuntimeException("Error loading version-info.properties", e); | ||
} | ||
} | ||
|
||
static final List<DependencyConfiguration> MAIN_SOURCE_SET_DEPENDENCIES = ImmutableList.of( | ||
getDependencyConfiguration(IMPLEMENTATION, "com.linkedin.transport:transportable-udfs-api", "transport"), | ||
getDependencyConfiguration(ANNOTATION_PROCESSOR, "com.linkedin.transport:transportable-udfs-annotation-processor", | ||
"transport") | ||
); | ||
|
||
static final List<DependencyConfiguration> TEST_SOURCE_SET_DEPENDENCIES = ImmutableList.of( | ||
getDependencyConfiguration(IMPLEMENTATION, "com.linkedin.transport:transportable-udfs-test-api", "transport"), | ||
getDependencyConfiguration(RUNTIME_ONLY, "com.linkedin.transport:transportable-udfs-test-generic", "transport") | ||
); | ||
|
||
static final List<PlatformConfiguration> DEFAULT_PLATFORMS = ImmutableList.of( | ||
new PlatformConfiguration( | ||
"presto", | ||
Language.JAVA, | ||
PrestoWrapperGenerator.class, | ||
ImmutableList.of( | ||
getDependencyConfiguration(IMPLEMENTATION, "com.linkedin.transport:transportable-udfs-presto", | ||
"transport"), | ||
getDependencyConfiguration(COMPILE_ONLY, "com.facebook.presto:presto-main", "presto") | ||
), | ||
ImmutableList.of( | ||
getDependencyConfiguration(RUNTIME_ONLY, "com.linkedin.transport:transportable-udfs-test-presto", | ||
"transport") | ||
) | ||
), | ||
new PlatformConfiguration( | ||
"hive", | ||
Language.JAVA, | ||
HiveWrapperGenerator.class, | ||
ImmutableList.of( | ||
getDependencyConfiguration(IMPLEMENTATION, "com.linkedin.transport:transportable-udfs-hive", "transport"), | ||
getDependencyConfiguration(COMPILE_ONLY, "org.apache.hive:hive-exec", "hive") | ||
), | ||
ImmutableList.of( | ||
getDependencyConfiguration(RUNTIME_ONLY, "com.linkedin.transport:transportable-udfs-test-hive", | ||
"transport") | ||
) | ||
), | ||
new PlatformConfiguration( | ||
"spark", | ||
Language.SCALA, | ||
SparkWrapperGenerator.class, | ||
ImmutableList.of( | ||
getDependencyConfiguration(IMPLEMENTATION, "com.linkedin.transport:transportable-udfs-spark", | ||
"transport"), | ||
getDependencyConfiguration(COMPILE_ONLY, "org.apache.spark:spark-sql_2.11", "spark") | ||
), | ||
ImmutableList.of( | ||
getDependencyConfiguration(RUNTIME_ONLY, "com.linkedin.transport:transportable-udfs-test-spark", | ||
"transport") | ||
) | ||
) | ||
); | ||
|
||
private static DependencyConfiguration getDependencyConfiguration(DependencyConfigurationName configurationName, | ||
String moduleCoordinate, String platform) { | ||
return new DependencyConfiguration(configurationName, | ||
moduleCoordinate + ":" + DEFAULT_VERSIONS.getProperty(platform + "-version")); | ||
} | ||
} |
Oops, something went wrong.