@Override public String getQualifiedName() { return getQualifiedName(precision, scale); }
@Override public String getTypeName() { return getQualifiedName(); }
@Override public String toString() { return getQualifiedName(); }
@Override public String getDisplayString(String[] children) { assert (children.length == 1); StringBuilder sb = new StringBuilder(); sb.append("CAST( "); sb.append(children[0]); sb.append(" AS "); sb.append(typeInfo.getQualifiedName()); sb.append(")"); return sb.toString(); }
@Override public String getDisplayString(String[] children) { assert (children.length == 1); StringBuilder sb = new StringBuilder(); sb.append("CAST( "); sb.append(children[0]); sb.append(" AS "); sb.append(typeInfo.getQualifiedName()); sb.append(")"); return sb.toString(); }
public static DecimalTypeInfo getDecimalTypeInfo(int precision, int scale) { String fullName = DecimalTypeInfo.getQualifiedName(precision, scale); return (DecimalTypeInfo) getPrimitiveTypeInfo(fullName); };
/** * Fix the type name of a column of type decimal w/o precision/scale specified. This makes * the describe table show "decimal(10,0)" instead of "decimal" even if the type stored * in metastore is "decimal", which is possible with previous hive. * * @param cols columns that to be fixed as such */ private static void fixDecimalColumnTypeName(List<FieldSchema> cols) { for (FieldSchema col : cols) { if (serdeConstants.DECIMAL_TYPE_NAME.equals(col.getType())) { col.setType(DecimalTypeInfo.getQualifiedName(HiveDecimal.USER_DEFAULT_PRECISION, HiveDecimal.USER_DEFAULT_SCALE)); } } }
/** * Fix the type name of a column of type decimal w/o precision/scale specified. This makes * the describe table show "decimal(10,0)" instead of "decimal" even if the type stored * in metastore is "decimal", which is possible with previous hive. * * @param cols columns that to be fixed as such */ private static void fixDecimalColumnTypeName(List<FieldSchema> cols) { for (FieldSchema col : cols) { if (serdeConstants.DECIMAL_TYPE_NAME.equals(col.getType())) { col.setType(DecimalTypeInfo.getQualifiedName(HiveDecimal.USER_DEFAULT_PRECISION, HiveDecimal.USER_DEFAULT_SCALE)); } } }
public static String getTypeName(ASTNode node) throws SemanticException { int token = node.getType(); String typeName; // datetime type isn't currently supported if (token == HiveParser.TOK_DATETIME) { throw new SemanticException(ErrorMsg.UNSUPPORTED_TYPE.getMsg()); } switch (token) { case HiveParser.TOK_CHAR: CharTypeInfo charTypeInfo = ParseUtils.getCharTypeInfo(node); typeName = charTypeInfo.getQualifiedName(); break; case HiveParser.TOK_VARCHAR: VarcharTypeInfo varcharTypeInfo = ParseUtils.getVarcharTypeInfo(node); typeName = varcharTypeInfo.getQualifiedName(); break; case HiveParser.TOK_DECIMAL: DecimalTypeInfo decTypeInfo = ParseUtils.getDecimalTypeTypeInfo(node); typeName = decTypeInfo.getQualifiedName(); break; default: typeName = TokenToTypeName.get(token); } return typeName; }
public static String getTypeName(ASTNode node) throws SemanticException { int token = node.getType(); String typeName; // datetime type isn't currently supported if (token == HiveParser.TOK_DATETIME) { throw new SemanticException(ErrorMsg.UNSUPPORTED_TYPE.getMsg()); } switch (token) { case HiveParser.TOK_CHAR: CharTypeInfo charTypeInfo = ParseUtils.getCharTypeInfo(node); typeName = charTypeInfo.getQualifiedName(); break; case HiveParser.TOK_VARCHAR: VarcharTypeInfo varcharTypeInfo = ParseUtils.getVarcharTypeInfo(node); typeName = varcharTypeInfo.getQualifiedName(); break; case HiveParser.TOK_TIMESTAMPLOCALTZ: TimestampLocalTZTypeInfo timestampLocalTZTypeInfo = TypeInfoFactory.getTimestampTZTypeInfo(null); typeName = timestampLocalTZTypeInfo.getQualifiedName(); break; case HiveParser.TOK_DECIMAL: DecimalTypeInfo decTypeInfo = ParseUtils.getDecimalTypeTypeInfo(node); typeName = decTypeInfo.getQualifiedName(); break; default: typeName = TokenToTypeName.get(token); } return typeName; }
@Override public String toString() { return getQualifiedName(); }
@Override public String getQualifiedName() { return getQualifiedName(precision, scale); }
@Override public String getTypeName() { return getQualifiedName(); }
@Override public String toString() { return getQualifiedName(); }
@Override public String toString() { return getQualifiedName(); }
@Override public String getQualifiedName() { return getQualifiedName(precision, scale); }
@Override public String getDisplayString(String[] children) { assert (children.length == 1); StringBuilder sb = new StringBuilder(); sb.append("CAST( "); sb.append(children[0]); sb.append(" AS "); sb.append(typeInfo.getQualifiedName()); sb.append(")"); return sb.toString(); }
public static DecimalTypeInfo getDecimalTypeInfo(int precision, int scale) { String fullName = DecimalTypeInfo.getQualifiedName(precision, scale); return (DecimalTypeInfo) getPrimitiveTypeInfo(fullName); };
public static DecimalTypeInfo getDecimalTypeInfo(int precision, int scale) { String fullName = DecimalTypeInfo.getQualifiedName(precision, scale); return (DecimalTypeInfo) getPrimitiveTypeInfo(fullName); };
public static DecimalTypeInfo getDecimalTypeInfo(int precision, int scale) { String fullName = DecimalTypeInfo.getQualifiedName(precision, scale); return (DecimalTypeInfo) getPrimitiveTypeInfo(fullName); };