-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
ranger: refine explain format, again #7041
Conversation
@winoros PTAL |
Please fix the CI. |
@@ -130,6 +130,9 @@ func formatDatum(d types.Datum, isLeftSide bool) string { | |||
if d.GetUint64() == math.MaxUint64 && !isLeftSide { | |||
return "+inf" | |||
} | |||
case types.KindString, types.KindBytes, types.KindMysqlEnum, types.KindMysqlSet, | |||
types.KindMysqlJSON, types.KindBinaryLiteral, types.KindMysqlBit: | |||
return fmt.Sprintf("\"%v\"", d.GetValue()) | |||
} | |||
return fmt.Sprintf("%v", d.GetValue()) |
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 not just wrap it here?
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.
it's leaved for other types, for example decimal/double/datetime/timestamp, I think they'd better not be warped with "
@winoros @lamxTyler PTAL |
/run-all-tests |
}, | ||
{ | ||
indexPos: 0, | ||
exprStr: `a LIKE "\\\\a%"`, | ||
accessConds: `[like(test.t.a, \\a%, 92)]`, | ||
filterConds: "[]", | ||
resultStr: `[[\a <nil>,\b <nil>)]`, | ||
resultStr: "[[\"\\a\" NULL,\"\\b\" NULL)]", |
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 change the quotation?
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.
this is due to the modification of formatDatum
in util/ranger/types.go
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.
i mean use `, we don't need escape characters
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.
Oh, the result was directly copied from the test output😂
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.
The usage of ` and " is not uniformed now, there are many tests use " actually.
@lamxTyler PTAL |
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.
LGTM
@winoros PTAL |
plan/exhaust_physical_plans.go
Outdated
if ok && !ds.statisticTable.Pseudo { | ||
rowCount = idxHist.AvgCountPerValue(ds.statisticTable.Count) | ||
} else { | ||
rowCount = ds.statisticTable.PseudoAvgCountPerCount() |
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.
The method name should be PseudoAvgCountPerValue
?
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.
yes, already changed.
…into dev/explain-range
@coocood PTAL |
LGTM |
What have you changed? (mandatory)
Refine the string format of ranges and constant expressions:
NULL
to represent NULL values instead of<nil>
"
Show whether we use the pseudo statistics for a table or index in the explain result.
Refine the count and range information for inner table of IndexJoin
Before this PR:
After this PR:
What is the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
Does this PR affect documentation (docs/docs-cn) update? (mandatory)
Does this PR affect tidb-ansible update? (mandatory)
Does this PR need to be added to the release notes? (mandatory)
Refer to a related PR or issue link (optional)
fix #6935
fix #7038
Benchmark result if necessary (optional)
Add a few positive/negative examples (optional)