[CP] [OBCDC] Support getScale for time type

This commit is contained in:
obdev 2023-04-19 08:41:32 +00:00 committed by ob-robot
parent 6e8c6def52
commit da9531326a
2 changed files with 13 additions and 13 deletions

View File

@ -983,22 +983,16 @@ int ObLogMetaManager::set_column_meta_(
} else if (ObSetType == col_type) {
mysql_type = obmysql::MYSQL_TYPE_SET;
}
} else if (ObNumberType == col_type || ObUNumberType == col_type) {
col_meta->setScale(column_schema.get_data_scale());
col_meta->setPrecision(column_schema.get_data_precision());
}
col_meta->setScale(column_schema.get_data_scale());
col_meta->setPrecision(column_schema.get_data_precision());
bool signed_flag = ((type_flag & UNSIGNED_FLAG) == 0);
if (ObBitType == col_type) {
// the length of BIT type is required,
// the "length" of the BIT type is store in precision
col_meta->setLength(column_schema.get_data_precision());
} else {
// for types with valid length(string\enumset\rowid\json\raw\lob\geo),
// get_data_length returns the valid length, returns 0 for other types.
col_meta->setLength(column_schema.get_data_length());
}
// for types with valid length(string\enumset\rowid\json\raw\lob\geo),
// get_data_length returns the valid length, returns 0 for other types.
col_meta->setLength(column_schema.get_data_length());
if (column_schema.is_tbl_part_key_column()) {
col_meta->setPartitioned(true);

View File

@ -571,7 +571,7 @@ int ObBinlogRecordPrinter::output_data_file_column_data(IBinlogRecord *br,
}
// print the length of varchar only in print detail mode,
// because there have been many test cases with varchar type before the varchar length info is added into column meta
if (oceanbase::obmysql::MYSQL_TYPE_VAR_STRING == ctype || oceanbase::obmysql::MYSQL_TYPE_BIT == ctype) {
if (oceanbase::obmysql::MYSQL_TYPE_VAR_STRING == ctype) {
ROW_PRINTF(ptr, size, pos, ri, "[C%ld] column_define_length:%ld", column_index, col_data_length);
}
else if ((oceanbase::obmysql::MYSQL_TYPE_ENUM == ctype) || (oceanbase::obmysql::MYSQL_TYPE_SET == ctype)) {
@ -596,6 +596,12 @@ int ObBinlogRecordPrinter::output_data_file_column_data(IBinlogRecord *br,
// Not sure if MYSQL_TYPE_DECIMAL is deprecated, DECIMAL in mysql & oracle mode should be MYSQL_TYPE_NEWDECIMAL
ROW_PRINTF(ptr, size, pos , ri, "[C%ld] column_precision:%ld", column_index, precision);
ROW_PRINTF(ptr, size, pos , ri, "[C%ld] column_scale:%ld", column_index, scale);
} else if (oceanbase::obmysql::MYSQL_TYPE_TIMESTAMP == ctype ||
oceanbase::obmysql::MYSQL_TYPE_DATETIME == ctype ||
oceanbase::obmysql::MYSQL_TYPE_TIME == ctype) {
ROW_PRINTF(ptr, size, pos , ri, "[C%ld] column_scale:%ld", column_index, scale);
} else if (oceanbase::obmysql::MYSQL_TYPE_BIT == ctype) {
ROW_PRINTF(ptr, size, pos , ri, "[C%ld] column_precision:%ld", column_index, precision);
} else { }
}
if (is_generated_column) {