Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following basic flink data types are supported to convert to sql data type in this FLIP, and more types can be supported as needed in the future.

Flink Data Type

Jdbc

Java Sql Data Type

Java Data Type

CharType/VarCharType

CHAR/VARCHAR

String

BooleanType

BOOLEAN

Boolean

TinyIntType

TINYINT

Byte

SmallIntType

SMALLINT

Short

IntType

INTEGER

Int

BigIntType

BIGINT

Long

FloatType

FLOAT

Float

DoubleType

DOUBLE

Double

DecimalType

DECIMAL

BigDecimal

BinaryType/VarBinaryType

(

BINARY/VARBINARY

byte[]

) Bytes

DateType

DATE

Date

TimeType

TIME

Time

TimestampType

TIMESTAMP

Timestamp

ZonedTimestapType

TIMESTAMP_WITH_TIMEZONE

ZonedDateTime

ArrayType

ARRAY

Array

RowType

ROW

Row(Flink Row Data)

MapType

MAP

Map<K, V>

ArrayType

Array

Public Interface

There are many methods in Jdbc Driver, while this FLIP only implement the basic methods first and more methods will be implemented later when they are needed. 

...

  • Methods in FlinkResultSet : FlinkResultSet only supports fetching data from iterator StatementResult , it supports getXXX methods and doesn't support deleting, updating or moving the cursor. Compare with ResultSet , there is getKind method in FlinkResultSet to get the RowKind of current record.
Code Block
languagejava
/* ResultSet for flink jdbc driver. */
public class FlinkResultSet implements ResultSet {
	/* Get the row kind for the current record. */
	public RowKind getKind();

    /* Return true if there are more resuts in result iterator. */
 	@Override 
    public boolean next() throws SQLException;
    
    /* Close the fetch result operation. */
 	@Override 
    public void close() throws SQLException;
    
    /* Get different values according to data type and column index. */
 	@Override 
    public <V> V getXXX(int columnIndex) throws SQLException.
    
    /* Get different values according to data type and column name. */
 	@Override
    public <V> V getXXX(String columnName) throws SQLException.
}

...