...
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 | 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[] |
DateType | DATE | Date |
TimeType | TIME | Time |
TimestampType | TIMESTAMP | Timestamp |
ZonedTimestampType | TIMESTAMP_WITH_TIMEZONE | ZonedDateTime |
LocalZonedTimestampType | TIMESTAMP_LZT(Not in java.sql.Types) | Instant |
ArrayType | ARRAY | Array |
RowType | ROW(Not in java.sql.Types) | Row(Flink Row Data) |
MapType | MAP | Map<K, V> |
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.
...
- Don't support transaction such as commit, rollback
- Don't support prepare statement, prepare call and etc operations
- Don't support management operations such as savepoint and etc
Exception Handling
When an error occurs, Flink Jdbc Driver mainly throws the following exceptions
SQLState Class | SQLState SubClass | Reason | Exception | Operations |
---|---|---|---|---|
22 | 000 to 02H according to different errors | Description of data conversion error | SQLDataException | Get data error from ResultSet in methods getXXX |
0A | 000 | Specific feature is not supported | SQLFeatureNotSupportedException | All unimplemented methods will throw this exception |
58 | 004 | The exception or error message from Gateway | SQLNonTransientException | Gateway throws an exception or returns an error message when executing the query |
08 | 006 | The session is not exist in Gateway and client need to create new connection to it | SQLNonTransientConnectionException | Gateway is restarted and the client need to create new connection |
We can continue to subdivide and throw different exceptions according to the error information returned by the Gateway in Flink Jdbc Driver in the future
[1] https://github.com/ververica/flink-sql-gateway
...