You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/07 12:03:10 UTC

[GitHub] [flink] fpompermaier commented on a change in pull request #11986: [FLINK-17361] [jdbc] Added custom query on JDBC tables

fpompermaier commented on a change in pull request #11986:
URL: https://github.com/apache/flink/pull/11986#discussion_r421450567



##########
File path: flink-connectors/flink-jdbc/src/test/java/org/apache/flink/api/java/io/jdbc/JDBCTableSourceITCase.java
##########
@@ -153,4 +153,34 @@ public void testProjectableJDBCSource() throws Exception {
 				"2020-01-01T15:36:01.123456,101.1234");
 		StreamITCase.compareWithList(expected);
 	}
+
+	@Test
+	public void testScanQueryJDBCSource() throws Exception {
+		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
+		EnvironmentSettings envSettings = EnvironmentSettings.newInstance()
+			.useBlinkPlanner()
+			.inStreamingMode()
+			.build();
+		StreamTableEnvironment tEnv = StreamTableEnvironment.create(env, envSettings);
+
+		final String testQuery = "SELECT id FROM " + INPUT_TABLE;
+		tEnv.sqlUpdate(
+			"CREATE TABLE test(" +
+				"id BIGINT" +
+				") WITH (" +
+				"  'connector.type'='jdbc'," +
+				"  'connector.url'='" + DB_URL + "'," +
+				"  'connector.table'='whatever'," +
+				"  'connector.read.query'='" + testQuery + "'" +
+				")"
+		);
+
+		StreamITCase.clear();

Review comment:
       I just copied the code from another test and I modifier it. I didn't ask myself too much why there's the need to call StreamITCase.clear()




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org