Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions include/base/string_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ struct StringRef {

~StringRef() {}

const inline bool IsNull() const { return nullptr == data_; }
const std::string ToString() const {
inline bool IsNull() const { return nullptr == data_; }
std::string ToString() const {
return size_ == 0 ? "" : std::string(data_, size_);
}

Expand Down Expand Up @@ -82,22 +82,6 @@ struct StringRef {
const char* data_;
};

__attribute__((unused)) static const StringRef operator+(const StringRef& a,
const StringRef& b) {
StringRef str;
str.size_ = a.size_ + b.size_;
char* buffer = static_cast<char*>(malloc(str.size_ + 1));
str.data_ = buffer;
if (a.size_ > 0) {
memcpy(buffer, a.data_, a.size_);
}
if (b.size_ > 0) {
memcpy(buffer + a.size_, b.data_, b.size_);
}
buffer[str.size_] = '\0';
return str;
}

__attribute__((unused)) static std::ostream& operator<<(std::ostream& os,
const StringRef& a) {
os << a.ToString();
Expand Down
3 changes: 1 addition & 2 deletions include/base/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <cstddef>
#include <ostream>
#include <string>
#include <vector>

namespace openmldb {
namespace base {
Expand Down Expand Up @@ -109,7 +108,7 @@ struct Date {
}

// | --- 16 bit -------------------------- | -- 8 bit ------------| --- 8 bit --------- |
// | year count since 1990 (starts from 0) | month(starts from 0) | day (starts from 1) |
// | year count since 1900 (starts from 0) | month(starts from 0) | day (starts from 1) |
int32_t date_;

friend std::ostream& operator<<(std::ostream& os, const Date& date) {
Expand Down
2 changes: 2 additions & 0 deletions src/examples/test_udf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "udf/openmldb_udf.h"

#include <vector>

extern "C"
void cut2(::openmldb::base::UDFContext* ctx, ::openmldb::base::StringRef* input, ::openmldb::base::StringRef* output) {
if (input == nullptr || output == nullptr) {
Expand Down
Loading