Unverified Commit b854b4ff authored by Meng Xin's avatar Meng Xin Committed by GitHub
Browse files

expression: fix date format identifies '\n' as invalid separator (#32… (#32391)

* expression: fix date format identifies '\n' as invalid separator (#32358)
parent eefba665
Showing with 10 additions and 4 deletions
+10 -4
......@@ -786,7 +786,8 @@ func isValidSeparator(c byte, prevParts int) bool {
return true
}
if prevParts == 2 && (c == ' ' || c == 'T') {
// for https://github.com/pingcap/tidb/issues/32232
if prevParts == 2 && (c == 'T' || c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r') {
return true
}
......
......@@ -1077,6 +1077,11 @@ func (s *testTimeSuite) TestParseDateFormat(c *C) {
{"T10:10:10", nil},
{"2011-11-11x", []string{"2011", "11", "11x"}},
{"xxx 10:10:10", nil},
{"2022-02-01\n16:33:00", []string{"2022", "02", "01", "16", "33", "00"}},
{"2022-02-01\f16:33:00", []string{"2022", "02", "01", "16", "33", "00"}},
{"2022-02-01\v16:33:00", []string{"2022", "02", "01", "16", "33", "00"}},
{"2022-02-01\r16:33:00", []string{"2022", "02", "01", "16", "33", "00"}},
{"2022-02-01\t16:33:00", []string{"2022", "02", "01", "16", "33", "00"}},
}
for _, t := range tbl {
......
......@@ -980,9 +980,9 @@ func (ssElement *stmtSummaryByDigestElement) toDatum(ssbd *stmtSummaryByDigest)
avgInt(int64(ssElement.sumPDTotal), ssElement.commitCount),
avgInt(int64(ssElement.sumBackoffTotal), ssElement.commitCount),
avgInt(int64(ssElement.sumWriteSQLRespTotal), ssElement.commitCount),
int64(ssElement.maxResultRows),
int64(ssElement.minResultRows),
avgInt(int64(ssElement.sumResultRows), ssElement.execCount),
ssElement.maxResultRows,
ssElement.minResultRows,
avgInt(ssElement.sumResultRows, ssElement.execCount),
ssElement.prepared,
avgFloat(int64(ssElement.sumAffectedRows), ssElement.execCount),
types.NewTime(types.FromGoTime(ssElement.firstSeen), mysql.TypeTimestamp, 0),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment