[Refactor]Merged string_value into string_ref (#15925)

This commit is contained in:
ZhaoChangle
2023-01-22 16:39:23 +08:00
committed by GitHub
parent b9872ceb98
commit 199d7d3be8
133 changed files with 1485 additions and 1607 deletions

View File

@ -15,25 +15,24 @@
// specific language governing permissions and limitations
// under the License.
#include "runtime/string_value.hpp"
#include <gtest/gtest.h>
#include <string>
#include "util/cpu_info.h"
#include "vec/common/string_ref.h"
using std::string;
namespace doris {
StringValue FromStdString(const string& str) {
StringRef FromStdString(const string& str) {
char* ptr = const_cast<char*>(str.c_str());
int len = str.size();
return StringValue(ptr, len);
return StringRef(ptr, len);
}
TEST(StringValueTest, TestCompare) {
TEST(StringRefTest, TestCompare) {
std::string empty_str = "";
std::string str1_str = "abc";
std::string str2_str = "abcdef";
@ -42,7 +41,7 @@ TEST(StringValueTest, TestCompare) {
const int NUM_STRINGS = 4;
// Must be in lexical order
StringValue svs[NUM_STRINGS];
StringRef svs[NUM_STRINGS];
svs[0] = FromStdString(empty_str);
svs[1] = FromStdString(str1_str);
svs[2] = FromStdString(str2_str);