private static int toSQLType(MinorType minorType) { String sqlTypeName = Types.getSqlTypeName(Types.optional(minorType)); return Types.getJdbcTypeCode(sqlTypeName); } }
/** * Gets AvaticaType carrying both JDBC {@code java.sql.Type.*} type code * and SQL type name for given RPC-level type (from batch schema). */ private static AvaticaType getAvaticaType( MajorType rpcDateType ) { final String sqlTypeName = Types.getSqlTypeName( rpcDateType ); final int jdbcTypeId = Types.getJdbcTypeCode( sqlTypeName ); return ColumnMetaData.scalar( jdbcTypeId, sqlTypeName, Rep.BOOLEAN /* dummy value, unused */ ); }
/** * Extend decimal type with precision and scale. * * @param type major type * @return type name augmented with precision and scale, * if type is a decimal */ public static String getExtendedSqlTypeName(MajorType type) { String typeName = getSqlTypeName(type); switch (type.getMinorType()) { case DECIMAL9: case DECIMAL18: case DECIMAL28SPARSE: case DECIMAL28DENSE: case DECIMAL38SPARSE: case DECIMAL38DENSE: case VARDECIMAL: // Disabled for now. See DRILL-6378 if (type.getPrecision() > 0) { typeName += String.format("(%d, %d)", type.getPrecision(), type.getScale()); } default: } return typeName; }
private static int toSQLType(MinorType minorType) { String sqlTypeName = Types.getSqlTypeName(Types.optional(minorType)); return Types.getJdbcTypeCode(sqlTypeName); } }
/** * Gets AvaticaType carrying both JDBC {@code java.sql.Type.*} type code * and SQL type name for given RPC-level type (from batch schema). */ private static AvaticaType getAvaticaType( MajorType rpcDateType ) { final String sqlTypeName = Types.getSqlTypeName( rpcDateType ); final int jdbcTypeId = Types.getJdbcTypeCode( sqlTypeName ); return ColumnMetaData.scalar( jdbcTypeId, sqlTypeName, Rep.BOOLEAN /* dummy value, unused */ ); }
/** * Extend decimal type with precision and scale. * * @param type major type * @return type name augmented with precision and scale, * if type is a decimal */ public static String getExtendedSqlTypeName(MajorType type) { String typeName = getSqlTypeName(type); switch (type.getMinorType()) { case DECIMAL9: case DECIMAL18: case DECIMAL28SPARSE: case DECIMAL28DENSE: case DECIMAL38SPARSE: case DECIMAL38DENSE: case VARDECIMAL: // Disabled for now. See DRILL-6378 if (type.getPrecision() > 0) { typeName += String.format("(%d, %d)", type.getPrecision(), type.getScale()); } default: } return typeName; }
builder.setDataType(Types.getSqlTypeName(majorType));