TsReaper commented on a change in pull request #9029: [FLINK-13118][jdbc]
Introduce JDBC table factory and bridge JDBC table source with streaming table
source
URL: https://github.com/apache/flink/pull/9029#discussion_r302573571
##########
File path:
flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCTableSource.java
##########
@@ -18,43 +18,91 @@
package org.apache.flink.api.java.io.jdbc;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.java.io.jdbc.dialect.JDBCDialect;
+import
org.apache.flink.api.java.io.jdbc.split.NumericBetweenParametersProvider;
+import org.apache.flink.api.java.typeutils.RowTypeInfo;
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.TableSchema;
import org.apache.flink.table.functions.AsyncTableFunction;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.table.sources.LookupableTableSource;
+import org.apache.flink.table.sources.ProjectableTableSource;
+import org.apache.flink.table.sources.StreamTableSource;
import org.apache.flink.table.sources.TableSource;
import org.apache.flink.types.Row;
+import java.util.Arrays;
+import java.util.Objects;
+
import static org.apache.flink.util.Preconditions.checkNotNull;
/**
* {@link TableSource} for JDBC.
- * Now only support {@link LookupableTableSource}.
*/
-public class JDBCTableSource implements LookupableTableSource<Row> {
+public class JDBCTableSource implements
+ StreamTableSource<Row>,
+ ProjectableTableSource<Row>,
+ LookupableTableSource<Row> {
private final JDBCOptions options;
+ private final JDBCScanOptions scanOptions;
private final JDBCLookupOptions lookupOptions;
private final TableSchema schema;
- public JDBCTableSource(
- JDBCOptions options, JDBCLookupOptions lookupOptions,
TableSchema schema) {
+ // index of fields selected, null means that all fields are selected
+ private final int[] selectFields;
+ private RowTypeInfo returnType;
+
+ private JDBCTableSource(
Review comment:
We've provide builders for users. No need to make this public.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services