[refactor] Remove decimal v1 related code from code base (#6079)

remove ALL DECIMAL V1 type code , this is a part of #6073
This commit is contained in:
Zhengguo Yang
2021-07-07 10:26:32 +08:00
committed by GitHub
parent d6e6c7815b
commit 739c0268ff
151 changed files with 707 additions and 4369 deletions

View File

@ -165,85 +165,6 @@ void ExprContext::free_local_allocations(const std::vector<FunctionContext*>& fn
}
}
void ExprContext::get_value(TupleRow* row, bool as_ascii, TColumnValue* col_val) {
#if 0
void* value = get_value(row);
if (as_ascii) {
RawValue::print_value(value, _root->_type, _root->_output_scale, &col_val->string_val);
col_val->__isset.string_val = true;
return;
}
if (value == NULL) {
return;
}
StringValue* string_val = NULL;
std::string tmp;
switch (_root->_type.type) {
case TYPE_BOOLEAN:
col_val->__set_bool_val(*reinterpret_cast<bool*>(value));
break;
case TYPE_TINYINT:
col_val->__set_byte_val(*reinterpret_cast<int8_t*>(value));
break;
case TYPE_SMALLINT:
col_val->__set_short_val(*reinterpret_cast<int16_t*>(value));
break;
case TYPE_INT:
col_val->__set_int_val(*reinterpret_cast<int32_t*>(value));
break;
case TYPE_BIGINT:
col_val->__set_long_val(*reinterpret_cast<int64_t*>(value));
break;
case TYPE_FLOAT:
col_val->__set_double_val(*reinterpret_cast<float*>(value));
break;
case TYPE_DOUBLE:
col_val->__set_double_val(*reinterpret_cast<double*>(value));
break;
#if 0
case TYPE_DECIMAL:
switch (_root->_type.GetByteSize()) {
case 4:
col_val->string_val =
reinterpret_cast<Decimal4Value*>(value)->ToString(_root->_type);
break;
case 8:
col_val->string_val =
reinterpret_cast<Decimal8Value*>(value)->ToString(_root->_type);
break;
case 16:
col_val->string_val =
reinterpret_cast<Decimal16Value*>(value)->ToString(_root->_type);
break;
default:
DCHECK(false) << "Bad Type: " << _root->_type;
}
col_val->__isset.string_val = true;
break;
case TYPE_VARCHAR:
string_val = reinterpret_cast<StringValue*>(value);
tmp.assign(static_cast<char*>(string_val->ptr), string_val->len);
col_val->string_val.swap(tmp);
col_val->__isset.string_val = true;
break;
case TYPE_CHAR:
tmp.assign(StringValue::CharSlotToPtr(value, _root->_type), _root->_type.len);
col_val->string_val.swap(tmp);
col_val->__isset.string_val = true;
break;
case TYPE_TIMESTAMP:
RawValue::print_value(
value, _root->_type, _root->_output_scale_, &col_val->string_val);
col_val->__isset.string_val = true;
break;
#endif
default:
DCHECK(false) << "bad get_value() type: " << _root->_type;
}
#endif
}
bool ExprContext::is_nullable() {
if (_root->is_slotref()) {
return SlotRef::is_nullable(_root);
@ -357,14 +278,6 @@ void* ExprContext::get_value(Expr* e, TupleRow* row) {
_result.datetime_val = DateTimeValue::from_datetime_val(v);
return &_result.datetime_val;
}
case TYPE_DECIMAL: {
DecimalVal v = e->get_decimal_val(this, row);
if (v.is_null) {
return NULL;
}
_result.decimal_val = DecimalValue::from_decimal_val(v);
return &_result.decimal_val;
}
case TYPE_DECIMALV2: {
DecimalV2Val v = e->get_decimalv2_val(this, row);
if (v.is_null) {
@ -446,10 +359,6 @@ DateTimeVal ExprContext::get_datetime_val(TupleRow* row) {
return _root->get_datetime_val(this, row);
}
DecimalVal ExprContext::get_decimal_val(TupleRow* row) {
return _root->get_decimal_val(this, row);
}
DecimalV2Val ExprContext::get_decimalv2_val(TupleRow* row) {
return _root->get_decimalv2_val(this, row);
}