Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused code. #3845

Merged
merged 4 commits into from
Feb 8, 2022
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
6 changes: 3 additions & 3 deletions src/common/time/TimeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,21 +205,21 @@ StatusOr<Value> TimeUtils::toTimestamp(const Value &val) {
}

/*static*/ StatusOr<DateTime> TimeUtils::parseDateTime(const std::string &str) {
auto p = DatetimeReader::makeDateTimeReader();
auto p = DatetimeReader();
auto result = p.readDatetime(str);
NG_RETURN_IF_ERROR(result);
return result.value();
}

/*static*/ StatusOr<Date> TimeUtils::parseDate(const std::string &str) {
auto p = DatetimeReader::makeDateReader();
auto p = DatetimeReader();
auto result = p.readDate(str);
NG_RETURN_IF_ERROR(result);
return result.value();
}

/*static*/ StatusOr<Time> TimeUtils::parseTime(const std::string &str) {
auto p = DatetimeReader::makeTimeReader();
auto p = DatetimeReader();
return p.readTime(str);
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/time/parser/DatetimeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace nebula {
namespace time {

DatetimeReader::DatetimeReader(Type type) : parser_(scanner_, error_, &dt_, type) {
DatetimeReader::DatetimeReader() : parser_(scanner_, error_, &dt_) {
// Callback invoked by DatetimeScanner
auto readBuffer = [this](char *buf, int maxSize) -> int {
// Reach the end
Expand Down
16 changes: 2 additions & 14 deletions src/common/time/parser/DatetimeReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,12 @@ namespace time {

class DatetimeReader {
public:
DatetimeReader();

~DatetimeReader() {
if (dt_ != nullptr) delete dt_;
}

static inline DatetimeReader makeDateReader() {
return DatetimeReader(Type::kDate);
}

static inline DatetimeReader makeTimeReader() {
return DatetimeReader(Type::kTime);
}

static inline DatetimeReader makeDateTimeReader() {
return DatetimeReader(Type::kDateTime);
}

StatusOr<DateTime> readDatetime(std::string input) {
input = kDatetimePrefix + input;
return read(std::move(input));
Expand All @@ -52,8 +42,6 @@ class DatetimeReader {
}

private:
explicit DatetimeReader(Type type);

StatusOr<DateTime> read(std::string input);

std::string buffer_;
Expand Down
7 changes: 0 additions & 7 deletions src/common/time/parser/datetime_parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
%parse-param { nebula::time::DatetimeScanner& scanner }
%parse-param { std::string &errmsg }
%parse-param { nebula::DateTime** output }
%parse-param { nebula::time::Type outputType }

%code requires {
#include <iostream>
Expand All @@ -23,12 +22,6 @@
namespace nebula {
namespace time {
class DatetimeScanner;

enum class Type {
kDate,
kTime,
kDateTime,
};
}
}

Expand Down
Loading