Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Support to get attribute of date/time/datetime. #586

Merged
merged 8 commits into from
Jul 29, 2021

Conversation

Shylock-Hg
Copy link
Contributor

@Shylock-Hg Shylock-Hg commented Jul 19, 2021

We shouldn't process the bad null different with null, they are all null in computation.

src/common/expression/AttributeExpression.cpp Outdated Show resolved Hide resolved
src/common/time/TimeUtils.h Outdated Show resolved Hide resolved
src/common/time/TimeUtils.h Outdated Show resolved Hide resolved
src/common/time/TimeUtils.h Outdated Show resolved Hide resolved
@Shylock-Hg Shylock-Hg requested review from laura-ding and a team July 21, 2021 04:01
laura-ding
laura-ding previously approved these changes Jul 21, 2021
@Shylock-Hg Shylock-Hg requested review from czpmango and a team July 21, 2021 06:44
yixinglu
yixinglu previously approved these changes Jul 28, 2021
@yixinglu yixinglu self-requested a review July 28, 2021 02:38
@Shylock-Hg Shylock-Hg dismissed stale reviews from yixinglu and laura-ding via 4e45063 July 28, 2021 03:41
@Shylock-Hg Shylock-Hg requested review from laura-ding and a team July 28, 2021 03:42
static Value getDateAttr(const Date &d, const std::string &prop) {
auto lowerProp = boost::algorithm::to_lower_copy(prop);
if (lowerProp == "year") {
return d.year;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need to cast the type here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need cast?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not same as above getDateTimeAttr function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The datetime is bitfield, so need cast to fit the Value constructor.

static Value getTimeAttr(const Time &t, const std::string &prop) {
auto lowerProp = boost::algorithm::to_lower_copy(prop);
if (lowerProp == "hour") {
return t.hour;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@Shylock-Hg Shylock-Hg requested review from yixinglu and a team July 28, 2021 10:29
@Shylock-Hg Shylock-Hg requested a review from a team July 29, 2021 02:58
@yixinglu yixinglu merged commit c486a83 into vesoft-inc:master Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants