Class SocketDynamicTableSource

java.lang.Object
org.apache.flink.table.examples.java.connectors.SocketDynamicTableSource
All Implemented Interfaces:
org.apache.flink.table.connector.source.DynamicTableSource, org.apache.flink.table.connector.source.ScanTableSource

public final class SocketDynamicTableSource extends Object implements org.apache.flink.table.connector.source.ScanTableSource
The 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 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.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.flink.table.connector.source.DynamicTableSource

    org.apache.flink.table.connector.source.DynamicTableSource.Context, org.apache.flink.table.connector.source.DynamicTableSource.DataStructureConverter

    Nested classes/interfaces inherited from interface org.apache.flink.table.connector.source.ScanTableSource

    org.apache.flink.table.connector.source.ScanTableSource.ScanContext, org.apache.flink.table.connector.source.ScanTableSource.ScanRuntimeProvider
  • Constructor Summary

    Constructors
    Constructor
    Description
    SocketDynamicTableSource(String hostname, int port, byte byteDelimiter, org.apache.flink.table.connector.format.DecodingFormat<org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>> decodingFormat, org.apache.flink.table.types.DataType producedDataType)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    org.apache.flink.table.connector.source.DynamicTableSource
     
    org.apache.flink.table.connector.ChangelogMode
     
    org.apache.flink.table.connector.source.ScanTableSource.ScanRuntimeProvider
    getScanRuntimeProvider(org.apache.flink.table.connector.source.ScanTableSource.ScanContext runtimeProviderContext)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SocketDynamicTableSource

      public SocketDynamicTableSource(String hostname, int port, byte byteDelimiter, org.apache.flink.table.connector.format.DecodingFormat<org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>> decodingFormat, org.apache.flink.table.types.DataType producedDataType)
  • Method Details

    • getChangelogMode

      public org.apache.flink.table.connector.ChangelogMode getChangelogMode()
      Specified by:
      getChangelogMode in interface org.apache.flink.table.connector.source.ScanTableSource
    • getScanRuntimeProvider

      public org.apache.flink.table.connector.source.ScanTableSource.ScanRuntimeProvider getScanRuntimeProvider(org.apache.flink.table.connector.source.ScanTableSource.ScanContext runtimeProviderContext)
      Specified by:
      getScanRuntimeProvider in interface org.apache.flink.table.connector.source.ScanTableSource
    • copy

      public org.apache.flink.table.connector.source.DynamicTableSource copy()
      Specified by:
      copy in interface org.apache.flink.table.connector.source.DynamicTableSource
    • asSummaryString

      public String asSummaryString()
      Specified by:
      asSummaryString in interface org.apache.flink.table.connector.source.DynamicTableSource