@Test public void convertToAtomicType() { TypeInformation type = DataTypeUtils.convertToAtomicType(" TIMESTAMP "); Assert.assertTrue(type == Types.SQL_TIMESTAMP()); }
public static TypeInformation convertToAtomicType(String string) { switch (normalizeType(string)) { case "VARCHAR": case "STRING": return Types.STRING(); case "BOOLEAN": return Types.BOOLEAN(); case "TINYINT": return Types.BYTE(); case "SMALLINT": return Types.SHORT(); case "INT": case "INTEGER": return Types.INT(); case "BIGINT": return Types.LONG(); case "FLOAT": case "REAL": return Types.FLOAT(); case "DOUBLE": return Types.DOUBLE(); case "DECIMAL": case "DEC": case "NUMERIC": return Types.DECIMAL(); case "DATE": return Types.SQL_DATE(); case "TIME": return Types.SQL_TIME(); case "TIMESTAMP": return Types.SQL_TIMESTAMP(); default: throw new RuntimeException("type " + string + "not supported, please refer to the flink doc!"); } }
DataTypeUtils { public static TypeInformation convertToAtomicType(String string) { switch (normalizeType(string)) { case "VARCHAR": case "STRING": return Types.STRING(); case "BOOLEAN": return Types.BOOLEAN(); case "TINYINT": return Types.BYTE(); case "SMALLINT": return Types.SHORT(); case "INT": case "INTEGER": return Types.INT(); case "BIGINT": return Types.LONG(); case "FLOAT": case "REAL": return Types.FLOAT(); case "DOUBLE": return Types.DOUBLE(); case "DECIMAL": case "DEC": case "NUMERIC": return Types.DECIMAL(); case "DATE": return Types.SQL_DATE(); case "TIME": return Types.SQL_TIME(); case "TIMESTAMP": return Types.SQL_TIMESTAMP(); default: throw new RuntimeException("type " + string + "not supported, please refer to the flink doc!"); } } }
DataTypeUtils { public static TypeInformation convertToAtomicType(String string) { switch (normalizeType(string)) { case "VARCHAR": case "STRING": return Types.STRING(); case "BOOLEAN": return Types.BOOLEAN(); case "TINYINT": return Types.BYTE(); case "SMALLINT": return Types.SHORT(); case "INT": case "INTEGER": return Types.INT(); case "BIGINT": return Types.LONG(); case "FLOAT": case "REAL": return Types.FLOAT(); case "DOUBLE": return Types.DOUBLE(); case "DECIMAL": case "DEC": case "NUMERIC": return Types.DECIMAL(); case "DATE": return Types.SQL_DATE(); case "TIME": return Types.SQL_TIME(); case "TIMESTAMP": return Types.SQL_TIMESTAMP(); default: throw new RuntimeException("type " + string + "not supported, please refer to the flink doc!"); } } private  DataTypeUtils(); }
DataTypeUtils { public static TypeInformation convertToAtomicType(String string) { switch (normalizeType(string)) { case "VARCHAR": case "STRING": return Types.STRING(); case "BOOLEAN": return Types.BOOLEAN(); case "TINYINT": return Types.BYTE(); case "SMALLINT": return Types.SHORT(); case "INT": case "INTEGER": return Types.INT(); case "BIGINT": return Types.LONG(); case "FLOAT": case "REAL": return Types.FLOAT(); case "DOUBLE": return Types.DOUBLE(); case "DECIMAL": case "DEC": case "NUMERIC": return Types.DECIMAL(); case "DATE": return Types.SQL_DATE(); case "TIME": return Types.SQL_TIME(); case "TIMESTAMP": return Types.SQL_TIMESTAMP(); default: throw new RuntimeException("type " + string + "not supported, please refer to the flink doc!"); } } private  DataTypeUtils(); static TypeInformation convertToCompositeType(String compositeTypeString); static TypeInformation convertToArray(String arrayTypeString); static RowTypeInfo convertToRow(String rowTypeString); static TypeInformation convertToAtomicType(String string); }
DataTypeUtils { public static TypeInformation convertToAtomicType(String string) { switch (normalizeType(string)) { case "VARCHAR": case "STRING": return Types.STRING(); case "BOOLEAN": return Types.BOOLEAN(); case "TINYINT": return Types.BYTE(); case "SMALLINT": return Types.SHORT(); case "INT": case "INTEGER": return Types.INT(); case "BIGINT": return Types.LONG(); case "FLOAT": case "REAL": return Types.FLOAT(); case "DOUBLE": return Types.DOUBLE(); case "DECIMAL": case "DEC": case "NUMERIC": return Types.DECIMAL(); case "DATE": return Types.SQL_DATE(); case "TIME": return Types.SQL_TIME(); case "TIMESTAMP": return Types.SQL_TIMESTAMP(); default: throw new RuntimeException("type " + string + "not supported, please refer to the flink doc!"); } } private  DataTypeUtils(); static TypeInformation convertToCompositeType(String compositeTypeString); static TypeInformation convertToArray(String arrayTypeString); static RowTypeInfo convertToRow(String rowTypeString); static TypeInformation convertToAtomicType(String string);  }