JdbcToDataFrameConverter

class JdbcToDataFrameConverter<J, D, P>(val expectedJdbcType: KType, val resultSetReader: DbResultSetReader<J>?, val preprocessedValueType: KType, val valuePreprocessor: DbValuePreprocessor<J, D>?, val targetSchema: ColumnSchema?, val columnBuilder: DbColumnBuilder<D, P>?)

Represents all type information that can be retrieved from an SQL column. This can be extended for your specific DbType if you need extra information.

This class needs to be stateless, so it can be memoized in AdvancedDbType.generateConverter.

Use jdbcToDfConverterFor to create an instance.

This API is experimental and subject to change.

Type Parameters

J

the type of the value coming from the JDBC driver, expectedJdbcType.

D

the type of the column values after preprocessing, preprocessedValueType. Will be equal to J if valuePreprocessor is null.

P

the type of the column values after postprocessing, comparable to DataColumn<P> of targetSchema. Will be equal to D if columnBuilder is null.

Constructors

Link copied to clipboard
constructor(expectedJdbcType: KType, resultSetReader: DbResultSetReader<J>?, preprocessedValueType: KType, valuePreprocessor: DbValuePreprocessor<J, D>?, targetSchema: ColumnSchema?, columnBuilder: DbColumnBuilder<D, P>?)

Properties

Link copied to clipboard

an optional function that converts a List with values of type D to a DataColumn of with values of type P.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

the target schema of the column after running the optional valuePreprocessor and columnBuilder. Can be null if the target schema is dependent on the runtime input and thus cannot be determined from input types alone.

Link copied to clipboard

an optional function that converts values from ResultSet.getObject to a cell/row suitable to be put into a DataColumn.

Functions

Link copied to clipboard
fun buildDataColumnOrNull(name: String, values: List<D>, inferNullability: Boolean): DataColumn<P>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun copy(expectedJdbcType: KType = this.expectedJdbcType, resultSetReader: DbResultSetReader<J>? = this.resultSetReader, preprocessedValueType: KType = this.preprocessedValueType, valuePreprocessor: DbValuePreprocessor<J, D>? = this.valuePreprocessor, targetSchema: ColumnSchema? = this.targetSchema, columnBuilder: DbColumnBuilder<D, P>? = this.columnBuilder): JdbcToDataFrameConverter<J, D, P>
Link copied to clipboard
fun getValueFromResultSetOrElse(rs: ResultSet, columnIndex: Int, default: () -> J): J
Link copied to clipboard
fun preprocessOrCast(value: J): D
Link copied to clipboard
fun <J, D, P> JdbcToDataFrameConverter<J, D, *>.withColumnBuilder(targetSchema: ColumnSchema?, canIntroduceNulls: Boolean = false, columnBuilder: DbColumnBuilder<D, P>?): JdbcToDataFrameConverter<J, D, P>
Link copied to clipboard
inline fun <J, reified D> JdbcToDataFrameConverter<J, *, *>.withPreprocessor(canIntroduceNulls: Boolean = false, valuePreprocessor: DbValuePreprocessor<J, D>?): JdbcToDataFrameConverter<J, D, D>
fun <J, D> JdbcToDataFrameConverter<J, *, *>.withPreprocessor(preprocessedValueType: KType, canIntroduceNulls: Boolean = false, valuePreprocessor: DbValuePreprocessor<J, D>?): JdbcToDataFrameConverter<J, D, D>
Link copied to clipboard
Link copied to clipboard