public final class SocketDynamicTableSource extends Object implements ScanTableSource
SocketDynamicTableSource
is used during planning.
In our example, we don't implement any of the available ability interfaces such as SupportsFilterPushDown
or SupportsProjectionPushDown
. Therefore, the main logic can be
found in ScanTableSource.getScanRuntimeProvider(ScanContext)
where we instantiate the required Source
and its DeserializationSchema
for runtime. Both instances are parameterized to
return internal data structures (i.e. RowData
).
Note: This is only an example and should not be used in production. The source is not fault-tolerant and can only work with a parallelism of 1.
ScanTableSource.ScanContext, ScanTableSource.ScanRuntimeProvider
DynamicTableSource.Context, DynamicTableSource.DataStructureConverter
Constructor and Description |
---|
SocketDynamicTableSource(String hostname,
int port,
byte byteDelimiter,
DecodingFormat<DeserializationSchema<RowData>> decodingFormat,
DataType producedDataType) |
Modifier and Type | Method and Description |
---|---|
String |
asSummaryString()
Returns a string that summarizes this source for printing to a console or log.
|
DynamicTableSource |
copy()
Creates a copy of this instance during planning.
|
ChangelogMode |
getChangelogMode()
Returns the set of changes that the planner can expect during runtime.
|
ScanTableSource.ScanRuntimeProvider |
getScanRuntimeProvider(ScanTableSource.ScanContext runtimeProviderContext)
Returns a provider of runtime implementation for reading the data.
|
public SocketDynamicTableSource(String hostname, int port, byte byteDelimiter, DecodingFormat<DeserializationSchema<RowData>> decodingFormat, DataType producedDataType)
public ChangelogMode getChangelogMode()
ScanTableSource
getChangelogMode
in interface ScanTableSource
RowKind
public ScanTableSource.ScanRuntimeProvider getScanRuntimeProvider(ScanTableSource.ScanContext runtimeProviderContext)
ScanTableSource
There might exist different interfaces for runtime implementation which is why ScanTableSource.ScanRuntimeProvider
serves as the base interface. Concrete ScanTableSource.ScanRuntimeProvider
interfaces might be located in other Flink modules.
Independent of the provider interface, the table runtime expects that a source
implementation emits internal data structures (see RowData
for more information).
The given ScanTableSource.ScanContext
offers utilities by the planner for creating runtime
implementation with minimal dependencies to internal data structures.
SourceProvider
is the recommended core interface. SourceFunctionProvider
in flink-table-api-java-bridge
and InputFormatProvider
are available for
backwards compatibility.
getScanRuntimeProvider
in interface ScanTableSource
SourceProvider
public DynamicTableSource copy()
DynamicTableSource
copy
in interface DynamicTableSource
public String asSummaryString()
DynamicTableSource
asSummaryString
in interface DynamicTableSource
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.