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

backport: Convert DATETIME to TIME type error #1720

Open
Tracked by #1661
hustjieke opened this issue May 6, 2023 · 1 comment
Open
Tracked by #1661

backport: Convert DATETIME to TIME type error #1720

hustjieke opened this issue May 6, 2023 · 1 comment
Assignees
Labels
A-porting back port code from 5.7/8.0 C-stonedb-8.0 associated with stonedb 8.0

Comments

@hustjieke
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

working issue: #995
commit id: 2a03448

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@hustjieke hustjieke added C-stonedb-8.0 associated with stonedb 8.0 A-porting back port code from 5.7/8.0 labels May 6, 2023
@hustjieke hustjieke added this to the StoneDB_8.0_v1.0.2 milestone May 6, 2023
@Double0101 Double0101 self-assigned this May 24, 2023
@Double0101 Double0101 moved this from Todo to In Progress in StoneDB for MySQL 8.0 May 24, 2023
@Double0101
Copy link
Collaborator

When datetime="0-0-0", value of tianmu_type.attrtype is common::ColumnType::DATETIME and buf->x is 0.
So it return 1.

bool Item_tianmufield::get_time(MYSQL_TIME *ltime) {
  if ((null_value = buf->null) ||
      ((tianmu_type.attrtype == common::ColumnType::DATETIME || tianmu_type.attrtype == common::ColumnType::DATE) &&
       buf->x == 0))  // zero date is illegal
    return 1;         // like in Item_field::get_time - return 1 on null value.
  FeedValue();
  return ivalue->get_time(ltime);
}

Then it set null_value = 1.

inline bool get_arg0_time(MYSQL_TIME *ltime) {
    return (null_value = args[0]->get_time(ltime));
  }

So it return a nullptr in val_str() function in item_timefunc.

Double0101 added a commit to Double0101/stonedb that referenced this issue May 24, 2023
Cause:
  When datetime='0-0-0', value of tianmu_type.attrtype is
common::ColumnType::DATETIME and buf->x is 0 in function
Item_tianmufield::get_time, then it return 1 and set
null_value=true
Solution:
  remove excess conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-porting back port code from 5.7/8.0 C-stonedb-8.0 associated with stonedb 8.0
Projects
Status: In Progress
Development

No branches or pull requests

2 participants