Skip to content

Instantly share code, notes, and snippets.

@wuchong
Created February 18, 2020 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wuchong/d08ba195e283c4a6b5ec87049edd6994 to your computer and use it in GitHub Desktop.
Save wuchong/d08ba195e283c4a6b5ec87049edd6994 to your computer and use it in GitHub Desktop.
public interface TableReader {
/**
* Whether the data is bounded or not.
*/
boolean isBounded();
/**
* Returns what kind of changes are produced by this reader.
*
* @see ChangelogRow.Kind
*/
ChangeMode getChangeMode();
}
public interface ScanTableReader extends TableReader {
SourceFunction createSourceFunction();
}
/**
* TODO: We can figure out a better interface name.
*/
public interface RichScanTableReader extends TableReader {
SourceFunction createSourceFunction(Context context);
// future work...
// boolean isVectorized();
// --------------------------------------------------------------------------------------------
// Helper Interfaces
// --------------------------------------------------------------------------------------------
interface Context {
/**
* Creates type information describing the internal format of the given {@link DataType}.
*/
TypeInformation<Object> createTypeInformation(DataType producedDataType);
/**
* Creates type information describing the internal format of the given ROW {@link DataType}.
*/
TypeInformation<ChangelogRow> createRowTypeInformation(DataType producedRowDataType);
/**
* Creates a runtime data format converter that converts data of the given {@link DataType}
* to Flink's internal data structures.
*/
DataFormatConverter createDataFormatConverter(DataType producedDataType);
/**
* Creates a runtime row producer. Useful in cases where additional logic is required within
* field data format conversion.
*
* <p>Note: This is low-level API. For most of the cases, {@link #createDataFormatConverter(DataType)}
* should be sufficient.
*/
RowFormatProducer createRowFormatProducer(DataType producedDataType);
/**
* Creates a runtime array producer. Useful in cases where additional logic is required within
* element data format conversion.
*
* <p>Note: This is low-level API. For most of the cases, {@link #createDataFormatConverter(DataType)}
* should be sufficient.
*/
ArrayFormatProducer createArrayFormatProducer(DataType producedDataType);
/**
* Creates a runtime map producer. Useful in cases where additional logic is required within
* entry data format conversion.
*
* <p>Note: This is low-level API. For most of the cases, {@link #createDataFormatConverter(DataType)}
* should be sufficient.
*/
MapFormatProducer createMapFormatProducer(ArrayFormatProducer keyArrayProducer, ArrayFormatProducer valueArrayProducer);
// future work...
// VectorizedRowProducer createVectorizedRowProducer(...);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment