Java Code Examples for com.alibaba.fastsql.sql.ast.SQLDataTypeImpl

The following examples show how to use com.alibaba.fastsql.sql.ast.SQLDataTypeImpl. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Mycat2   Source File: RexTranslator.java    License: GNU General Public License v3.0 5 votes vote down vote up
private Integer getScale(SQLDataType dataType) {
    SQLDataTypeImpl dataType1 = (SQLDataTypeImpl) (dataType);
    return Optional.ofNullable(dataType1.getArguments())
            .filter(i -> i.size() > 1)
            .map(i -> i.get(1))
            .map(i -> (SQLNumericLiteralExpr) i)
            .map(i -> i.getNumber())
            .map(i -> i.intValue()).orElse(null);
}
 
Example 2
Source Project: Mycat2   Source File: RexTranslator.java    License: GNU General Public License v3.0 5 votes vote down vote up
private Integer getPrec(SQLDataType dataType) {
    SQLDataTypeImpl dataType1 = (SQLDataTypeImpl) (dataType);
    return Optional.ofNullable(dataType1.getArguments())
            .filter(i -> i.size() > 0)
            .map(i -> i.get(0))
            .map(i -> (SQLNumericLiteralExpr) i)
            .map(i -> i.getNumber())
            .map(i -> i.intValue()).orElse(null);
}