This is an automated email from the ASF dual-hosted git repository. stigahuang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 88a7538af79afc19233cdfe3220e3c25e7edd16d Author: Daniel Becker <[email protected]> AuthorDate: Thu Feb 9 14:25:31 2023 +0100 IMPALA-11869: Use to_string() in PrintValue for printing Thrift types IMPALA-11645 introduced the function PrintValue() which we use to convert Thrift types to strings. This function used operator<<, which is provided for the generated Thrift types. However, Thrift also generates a to_string() function that is overloaded for Thrift types. It would be more efficient to use this instead of involving streams with operator<<. This change reimplements PrintValue() using to_string() instead of operator<<. Change-Id: Ibc5b847dea2bdea7ba0ab8e093a8bab5a8145019 Reviewed-on: http://gerrit.cloudera.org:8080/19487 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- be/src/util/debug-util.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/be/src/util/debug-util.h b/be/src/util/debug-util.h index 51b73d979..66fa8e7ff 100644 --- a/be/src/util/debug-util.h +++ b/be/src/util/debug-util.h @@ -51,12 +51,11 @@ class TupleRow; // Forward declaration to avoid including descriptors.h. typedef std::vector<int> SchemaPath; -// Converts a value for which operator<< is defined to a std::string. +// Used to convert Thrift objects to strings. Thrift defines a 'to_string()' function for +// each type. template<class T> std::string PrintValue(const T& value) { - std::stringstream s; - s << value; - return s.str(); + return to_string(value); } std::string PrintTuple(const Tuple* t, const TupleDescriptor& d);
