Skip to content

Commit feb0dfe

Browse files
authored
Merge pull request #34593: Fix sql:jdbc tests and shell entry
Fix sql:jdbc tests and shell entry
2 parents 9802a06 + 5a4365f commit feb0dfe

File tree

6 files changed

+44
-66
lines changed

6 files changed

+44
-66
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ tasks.register("sqlPreCommit") {
382382
dependsOn(":sdks:java:extensions:sql:jdbc:build")
383383
dependsOn(":sdks:java:extensions:sql:jdbc:preCommit")
384384
dependsOn(":sdks:java:extensions:sql:perf-tests:build")
385-
dependsOn(":sdks:java:extensions:sql:shell:build")
386385
dependsOn(":sdks:java:extensions:sql:udf-test-provider:build")
387386
dependsOn(":sdks:java:extensions:sql:udf:build")
388387
dependsOn(":sdks:java:extensions:sql:zetasql:build")

sdks/java/extensions/sql/jdbc/build.gradle

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ import groovy.json.JsonOutput
1818
* limitations under the License.
1919
*/
2020

21-
plugins { id 'org.apache.beam.module' }
21+
plugins {
22+
id 'org.apache.beam.module'
23+
id 'application'
24+
}
2225
applyJavaNature( automaticModuleName: 'org.apache.beam.sdk.extensions.sql.jdbc',
2326
exportJavadoc: false,
2427
testShadowJar: true,
@@ -37,14 +40,26 @@ dependencies {
3740
implementation "sqlline:sqlline:1.4.0"
3841
implementation library.java.vendored_calcite_1_28_0
3942
permitUnusedDeclared library.java.vendored_calcite_1_28_0
40-
testImplementation project(path: ":sdks:java:io:google-cloud-platform", configuration: "testRuntimeMigration")
43+
testImplementation project(path: ":sdks:java:core", configuration: "shadow")
44+
testImplementation project(path: ":sdks:java:io:google-cloud-platform")
45+
testImplementation project(path: ":sdks:java:extensions:google-cloud-platform-core")
46+
testImplementation library.java.jackson_databind
47+
testImplementation library.java.joda_time
4148
testImplementation library.java.junit
4249
testImplementation library.java.vendored_guava_32_1_2_jre
4350
// Depending on outputs so integrationTest can run with only test dependencies.
4451
// This enables us to test the JDBC jar being loaded on a custom classloader.
4552
integrationTest sourceSets.test.output
4653
integrationTest sourceSets.main.output
4754
integrationTest library.java.junit
55+
56+
if (project.hasProperty("beam.sql.shell.bundled")) {
57+
project.getProperty("beam.sql.shell.bundled").tokenize(",").each {
58+
subproject ->
59+
implementation project(path: subproject)
60+
permitUnusedDeclared project(path: subproject)
61+
}
62+
}
4863
}
4964

5065
processResources {
@@ -107,3 +122,29 @@ task postCommit {
107122
description = "Various integration tests"
108123
dependsOn endToEndTest
109124
}
125+
126+
processResources {
127+
filter org.apache.tools.ant.filters.ReplaceTokens, tokens: [
128+
'beam.version': version,
129+
]
130+
}
131+
132+
/**
133+
* Gradle console will interfere with SQL shell, so to run this command
134+
* we need to configure it:
135+
* - disable daemon with '--no-daemon';
136+
* - decrease verbosity with '--console plain';
137+
* - quiet it with '-q';
138+
*
139+
* So, correct gradle invocation to start the SQL shell
140+
* looks something like this:
141+
*
142+
* ./gradlew :sdks:java:extensions:sql:jdbc:run --console plain -q --no-daemon
143+
*
144+
* To add extra Beam project, set subproject property like
145+
* `-Pbeam.sql.shell.bundled="sdks:java:extensions:sql:hcatalog"`
146+
*/
147+
run {
148+
mainClassName = "org.apache.beam.sdk.extensions.sql.jdbc.BeamSqlLine"
149+
standardInput System.in
150+
}

sdks/java/extensions/sql/jdbc/src/test/java/org/apache/beam/sdk/extensions/sql/jdbc/BeamSqlLineIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import org.junit.After;
4949
import org.junit.Before;
5050
import org.junit.BeforeClass;
51-
import org.junit.Ignore;
5251
import org.junit.Rule;
5352
import org.junit.Test;
5453

@@ -103,7 +102,6 @@ public void tearDown() {
103102
}
104103

105104
@Test
106-
@Ignore("https://jira.apache.org/jira/browse/BEAM-7582")
107105
public void testSelectFromPubsub() throws Exception {
108106
String[] args =
109107
buildArgs(
@@ -138,7 +136,6 @@ public void testSelectFromPubsub() throws Exception {
138136
}
139137

140138
@Test
141-
@Ignore("https://jira.apache.org/jira/browse/BEAM-7582")
142139
public void testFilterForSouthManhattan() throws Exception {
143140
String[] args =
144141
buildArgs(

sdks/java/extensions/sql/shell/build.gradle

Lines changed: 0 additions & 59 deletions
This file was deleted.

settings.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ include(":sdks:java:extensions:sql")
198198
include(":sdks:java:extensions:sql:payloads")
199199
include(":sdks:java:extensions:sql:perf-tests")
200200
include(":sdks:java:extensions:sql:jdbc")
201-
include(":sdks:java:extensions:sql:shell")
202201
include(":sdks:java:extensions:sql:hcatalog")
203202
include(":sdks:java:extensions:sql:datacatalog")
204203
include(":sdks:java:extensions:sql:zetasql")

0 commit comments

Comments
 (0)