public class JdbcLookupFunction
extends org.apache.flink.table.functions.TableFunction<org.apache.flink.types.Row>
TableFunction to query fields from JDBC by keys. The query template like:
SELECT c, d, e, f from T where a = ? and b = ?
Support cache the result to avoid frequent accessing to remote databases. 1.The cacheMaxSize is -1 means not use cache. 2.For real-time data, you need to set the TTL of cache.
| Modifier and Type | Class and Description |
|---|---|
static class |
JdbcLookupFunction.Builder
Builder for a
JdbcLookupFunction. |
| Constructor and Description |
|---|
JdbcLookupFunction(JdbcOptions options,
JdbcLookupOptions lookupOptions,
String[] fieldNames,
org.apache.flink.api.common.typeinfo.TypeInformation[] fieldTypes,
String[] keyNames) |
| Modifier and Type | Method and Description |
|---|---|
static JdbcLookupFunction.Builder |
builder() |
void |
close() |
void |
eval(Object... keys) |
Connection |
getDbConnection() |
org.apache.flink.api.common.typeinfo.TypeInformation<?>[] |
getParameterTypes(Class<?>[] signature) |
org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> |
getResultType() |
void |
open(org.apache.flink.table.functions.FunctionContext context) |
collect, getKind, getTypeInference, setCollectorfunctionIdentifier, toStringpublic JdbcLookupFunction(JdbcOptions options, JdbcLookupOptions lookupOptions, String[] fieldNames, org.apache.flink.api.common.typeinfo.TypeInformation[] fieldTypes, String[] keyNames)
public static JdbcLookupFunction.Builder builder()
public void open(org.apache.flink.table.functions.FunctionContext context)
throws Exception
open in class org.apache.flink.table.functions.UserDefinedFunctionExceptionpublic void eval(Object... keys)
public void close()
throws IOException
close in class org.apache.flink.table.functions.UserDefinedFunctionIOException@VisibleForTesting public Connection getDbConnection()
public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> getResultType()
getResultType in class org.apache.flink.table.functions.TableFunction<org.apache.flink.types.Row>public org.apache.flink.api.common.typeinfo.TypeInformation<?>[] getParameterTypes(Class<?>[] signature)
getParameterTypes in class org.apache.flink.table.functions.TableFunction<org.apache.flink.types.Row>Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.