Use fmt and std::from_chars to make convert integer to string and convert string to integer more efficient (#6361)
* [Optimize] optimize the speed of converting integer to string * Use fmt and std::from_chars to make convert integer to string and convert string to integer more efficient Co-authored-by: caiconghui <caiconghui@xiaomi.com>
This commit is contained in:
@ -611,11 +611,8 @@ bool EsScanNode::to_ext_literal(PrimitiveType slot_type, void* value, TExtLitera
|
||||
|
||||
case TYPE_LARGEINT: {
|
||||
node_type = (TExprNodeType::LARGE_INT_LITERAL);
|
||||
char buf[48];
|
||||
int len = 48;
|
||||
char* v = LargeIntValue::to_string(*reinterpret_cast<__int128*>(value), buf, &len);
|
||||
TLargeIntLiteral large_int_literal;
|
||||
large_int_literal.__set_value(v);
|
||||
large_int_literal.__set_value(LargeIntValue::to_string(*reinterpret_cast<__int128*>(value)));
|
||||
literal->__set_large_int_literal(large_int_literal);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -284,11 +284,8 @@ Status ODBCConnector::append(const std::string& table_name, RowBatch* batch,
|
||||
break;
|
||||
}
|
||||
case TYPE_LARGEINT: {
|
||||
char buf[48];
|
||||
int len = 48;
|
||||
char* v = LargeIntValue::to_string(
|
||||
reinterpret_cast<const PackedInt128*>(item)->value, buf, &len);
|
||||
fmt::format_to(_insert_stmt_buffer, "{}", std::string(v, len));
|
||||
fmt::format_to(_insert_stmt_buffer, "{}",
|
||||
reinterpret_cast<const PackedInt128*>(item)->value);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
Reference in New Issue
Block a user