Fix ctas unknown cast type

This commit is contained in:
obdev
2023-02-08 15:27:28 +08:00
committed by ob-robot
parent 244baaa7f1
commit b385e569a2
2 changed files with 13 additions and 0 deletions

View File

@ -430,6 +430,10 @@ int ObExprCast::calc_result_type2(ObExprResType &type,
ObAccuracy acc = ObAccuracy::DDL_DEFAULT_ACCURACY2[compatibility_mode][dst_type.get_type()];
type.set_accuracy(acc);
type1.set_accuracy(acc);
} else if (ObYearType == dst_type.get_type()) {
ObAccuracy acc = ObAccuracy::DDL_DEFAULT_ACCURACY2[compatibility_mode][dst_type.get_type()];
type.set_accuracy(acc);
type1.set_accuracy(acc);
} else {
type.set_precision(dst_type.get_precision());
}

View File

@ -4006,6 +4006,15 @@ int ObRawExprPrinter::print_cast_type(ObRawExpr *expr)
DATA_PRINTF("date");
break;
}
case T_YEAR: {
int16_t scale = parse_node.int16_values_[OB_NODE_CAST_N_SCALE_IDX];
if (scale >= 0) {
DATA_PRINTF("year(%d)", scale);
} else {
DATA_PRINTF("year");
}
break;
}
case T_TIME: {
int16_t scale = parse_node.int16_values_[OB_NODE_CAST_N_SCALE_IDX];
if (scale >= 0) {