@@ -34,22 +34,7 @@ int IntegerType::compare(const Column &left, const Column &right, int left_idx,
3434{
3535 ASSERT (left.attr_type () == AttrType::INTS, " left type is not integer" );
3636 ASSERT (right.attr_type () == AttrType::INTS, " right type is not integer" );
37- return common::compare_int ((void *)&((int *)left.data ())[left_idx],
38- (void *)&((int *)right.data ())[right_idx]);
39- }
40-
41- RC IntegerType::cast_to (const Value &val, AttrType type, Value &result) const
42- {
43- switch (type) {
44- case AttrType::FLOATS: {
45- float float_value = val.get_int ();
46- result.set_float (float_value);
47- return RC::SUCCESS;
48- }
49- default :
50- LOG_WARN (" unsupported type %d" , type);
51- return RC::SCHEMA_FIELD_TYPE_MISMATCH;
52- }
37+ return common::compare_int ((void *)&((int *)left.data ())[left_idx], (void *)&((int *)right.data ())[right_idx]);
5338}
5439
5540RC IntegerType::add (const Value &left, const Value &right, Value &result) const
@@ -98,17 +83,6 @@ RC IntegerType::to_string(const Value &val, string &result) const
9883 return RC::SUCCESS;
9984}
10085
101- int IntegerType::cast_cost (AttrType type)
102- {
103- if (type == AttrType::INTS)
104- return 0 ; // INT -> INT
105- if (type == AttrType::FLOATS)
106- return 1 ; // INT -> FLOAT
107- if (type == AttrType::BOOLEANS)
108- return 1 ; // INT -> BOOL (非严格转换)
109- return INT32_MAX; // 不支持转换
110- }
111-
11286RC IntegerType::cast_to (const Value &val, AttrType type, Value &result, bool allow_type_promotion) const
11387{
11488 switch (type) {
0 commit comments