-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
mysql/json: split compare,serde,binary into independent files #1936
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space and reorder imports. Eof
src/util/codec/mysql/json/binary.rs
Outdated
use super::super::Result; | ||
use std::cmp::Ordering; | ||
use std::{self, str, f64}; | ||
use super::{Json, ERR_CONVERT_FAILED}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reorder imports
src/util/codec/mysql/json/binary.rs
Outdated
assert_eq!(Json::I64(2), Json::Boolean(false)); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eof
src/util/codec/mysql/json/serde.rs
Outdated
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
match serde_json::from_str(s) { | ||
Ok(value) => Ok(value), | ||
Err(e) => Err(invalid_type!("Illegal Json text:{:?}", e)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after :
assert!(left < right); | ||
} | ||
|
||
assert_eq!(Json::I64(2), Json::Boolean(false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Json::Boolean(false)
would be converted to Json::Double(2.0)
when compare with an Integer. @andelf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it's a natural defect of TiDB, because we treat bool as int. so if we compare bool and int, there are some incompatible cases with MySQL.
LGTM |
any update? |
Conflicts fixed @siddontang |
LGTM. |
Hi,
This PR split
compare
,serde
,binary
from json.rs into independent files.@hhkbp2 @hicqu @lishihai9017 @andelf PTAL