Example #1
0
 public static int tajoTypeToSqlType(TajoDataTypes.DataType type) throws SQLException {
   switch (type.getType()) {
     case BOOLEAN:
       return Types.BOOLEAN;
     case INT1:
       return Types.TINYINT;
     case INT2:
       return Types.SMALLINT;
     case INT4:
       return Types.INTEGER;
     case INT8:
       return Types.BIGINT;
     case FLOAT4:
       return Types.FLOAT;
     case FLOAT8:
       return Types.DOUBLE;
     case NUMERIC:
       return Types.NUMERIC;
     case DATE:
       return Types.DATE;
     case TIMESTAMP:
       return Types.TIMESTAMP;
     case TIME:
       return Types.TIME;
     case VARCHAR:
       return Types.VARCHAR;
     case TEXT:
       return Types.VARCHAR;
     default:
       throw new SQLException("Unrecognized column type: " + type);
   }
 }
Example #2
0
 public static String toSqlType(TajoDataTypes.DataType type) {
   switch (type.getType()) {
     case BOOLEAN:
       return "boolean";
     case INT1:
       return "tinyint";
     case INT2:
       return "smallint";
     case INT4:
       return "integer";
     case INT8:
       return "bigint";
     case FLOAT4:
       return "float";
     case FLOAT8:
       return "float8";
     case NUMERIC:
       return "numeric";
     case VARBINARY:
       return "bytea";
     case CHAR:
       return "character";
     case DATE:
       return "date";
     case TIMESTAMP:
       return "timestamp";
     case TIME:
       return "time";
     case VARCHAR:
       return "varchar";
     case TEXT:
       return "varchar";
     default:
       throw new UnsupportedException("Unrecognized column type:" + type);
   }
 }