Class AbstractDialect
- java.lang.Object
-
- org.apache.flink.connector.jdbc.dialect.AbstractDialect
-
- All Implemented Interfaces:
Serializable,JdbcDialect
- Direct Known Subclasses:
DerbyDialect,MySqlDialect,OracleDialect,PostgresDialect,SqlServerDialect
@PublicEvolving public abstract class AbstractDialect extends Object implements JdbcDialect
Base class forJdbcDialectsthat implements basic data type validation and the construction of basicINSERT,UPDATE,DELETE, andSELECTstatements.Implementors should be careful to check the default SQL statements are performant for their specific dialect and override them if necessary.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractDialect.RangeA range from [min,max] where min <= max.
-
Constructor Summary
Constructors Constructor Description AbstractDialect()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Optional<AbstractDialect.Range>decimalPrecisionRange()StringgetDeleteStatement(String tableName, String[] conditionFields)A simple single rowDELETEstatement.StringgetInsertIntoStatement(String tableName, String[] fieldNames)A simpleINSERT INTOstatement.StringgetRowExistsStatement(String tableName, String[] conditionFields)A simpleSELECTstatement that checks for the existence of a single row.StringgetSelectFromStatement(String tableName, String[] selectFields, String[] conditionFields)A simpleSELECTstatement.StringgetUpdateStatement(String tableName, String[] fieldNames, String[] conditionFields)A simple single rowUPDATEstatement.abstract Set<org.apache.flink.table.types.logical.LogicalTypeRoot>supportedTypes()Defines the set of supported types for the dialect.Optional<AbstractDialect.Range>timestampPrecisionRange()voidvalidate(org.apache.flink.table.types.logical.RowType rowType)Check if this dialect instance support a specific data type in table schema.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.connector.jdbc.dialect.JdbcDialect
appendDefaultUrlProperties, defaultDriverName, dialectName, getLimitClause, getRowConverter, getUpsertStatement, quoteIdentifier
-
-
-
-
Method Detail
-
validate
public void validate(org.apache.flink.table.types.logical.RowType rowType) throws org.apache.flink.table.api.ValidationExceptionDescription copied from interface:JdbcDialectCheck if this dialect instance support a specific data type in table schema.- Specified by:
validatein interfaceJdbcDialect- Parameters:
rowType- the physical table datatype of a row in the database table.- Throws:
org.apache.flink.table.api.ValidationException- in case of the table schema contains unsupported type.
-
getInsertIntoStatement
public String getInsertIntoStatement(String tableName, String[] fieldNames)
A simpleINSERT INTOstatement.INSERT INTO table_name (column_name [, ...]) VALUES (value [, ...])- Specified by:
getInsertIntoStatementin interfaceJdbcDialect- Returns:
- the dialects
INSERT INTOstatement.
-
getUpdateStatement
public String getUpdateStatement(String tableName, String[] fieldNames, String[] conditionFields)
A simple single rowUPDATEstatement.UPDATE table_name SET col = val [, ...] WHERE cond [AND ...]- Specified by:
getUpdateStatementin interfaceJdbcDialect- Returns:
- A single row update statement.
-
getDeleteStatement
public String getDeleteStatement(String tableName, String[] conditionFields)
A simple single rowDELETEstatement.DELETE FROM table_name WHERE cond [AND ...]- Specified by:
getDeleteStatementin interfaceJdbcDialect- Returns:
- A single row delete statement.
-
getSelectFromStatement
public String getSelectFromStatement(String tableName, String[] selectFields, String[] conditionFields)
A simpleSELECTstatement.SELECT expression [, ...] FROM table_name WHERE cond [AND ...]- Specified by:
getSelectFromStatementin interfaceJdbcDialect- Returns:
- A select statement.
-
getRowExistsStatement
public String getRowExistsStatement(String tableName, String[] conditionFields)
A simpleSELECTstatement that checks for the existence of a single row.SELECT 1 FROM table_name WHERE cond [AND ...]- Specified by:
getRowExistsStatementin interfaceJdbcDialect
-
timestampPrecisionRange
public Optional<AbstractDialect.Range> timestampPrecisionRange()
- Returns:
- The inclusive range [min,max] of supported precisions for
TimestampTypecolumns. None if timestamp type is not supported.
-
decimalPrecisionRange
public Optional<AbstractDialect.Range> decimalPrecisionRange()
- Returns:
- The inclusive range [min,max] of supported precisions for
DecimalTypecolumns. None if decimal type is not supported.
-
supportedTypes
public abstract Set<org.apache.flink.table.types.logical.LogicalTypeRoot> supportedTypes()
Defines the set of supported types for the dialect. If the dialect supportsDECIMALorTIMESTAMPtypes, be sure to overridedecimalPrecisionRange()andtimestampPrecisionRange()respectively.- Returns:
- a set of logical type roots.
-
-