-
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
tidb_query_datatype, tidb_query_expr: Add div_precision_increment support in dag request #16622
Changes from 6 commits
5380fe5
fbffb0a
37decb3
85dd683
1990f0e
3df04ca
39c5dbe
22fc396
1bcc86f
cd50adb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,8 @@ impl SqlMode { | |
|
||
const DEFAULT_MAX_WARNING_CNT: usize = 64; | ||
|
||
const DEFAULT_DIV_PRECISION_INCR: i32 = 4; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct EvalConfig { | ||
/// timezone to use when parse/calculate time. | ||
|
@@ -72,6 +74,7 @@ pub struct EvalConfig { | |
pub sql_mode: SqlMode, | ||
|
||
pub paging_size: Option<u64>, | ||
pub div_precision_increment: i32, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the type should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, updated |
||
} | ||
|
||
impl Default for EvalConfig { | ||
|
@@ -98,6 +101,9 @@ impl EvalConfig { | |
if req.has_sql_mode() { | ||
eval_cfg.set_sql_mode(SqlMode::from_bits_truncate(req.get_sql_mode())); | ||
} | ||
if req.has_div_precision_increment() { | ||
eval_cfg.set_div_precision_incr(req.get_div_precision_increment() as i32); | ||
} | ||
Ok(eval_cfg) | ||
} | ||
|
||
|
@@ -108,6 +114,7 @@ impl EvalConfig { | |
max_warning_cnt: DEFAULT_MAX_WARNING_CNT, | ||
sql_mode: SqlMode::empty(), | ||
paging_size: None, | ||
div_precision_increment: DEFAULT_DIV_PRECISION_INCR, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of adding a new default value, how about using the existing value There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, changed it. |
||
} | ||
} | ||
|
||
|
@@ -127,6 +134,11 @@ impl EvalConfig { | |
self | ||
} | ||
|
||
pub fn set_div_precision_incr(&mut self, new_value: i32) -> &mut Self { | ||
self.div_precision_increment = new_value; | ||
self | ||
} | ||
|
||
pub fn set_time_zone_by_name(&mut self, tz_name: &str) -> Result<&mut Self> { | ||
match Tz::from_tz_name(tz_name) { | ||
Some(tz) => { | ||
|
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.
Should leave a blank line.
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.
Added.