For issue #51 See https://github.com/pingcap/parser/pull/51 for details
(t *testing.T)
| 6649 | // For issue #51 |
| 6650 | // See https://github.com/pingcap/parser/pull/51 for details |
| 6651 | func TestVisitFrameBound(t *testing.T) { |
| 6652 | p := parser.New() |
| 6653 | p.EnableWindowFunc(true) |
| 6654 | table := []struct { |
| 6655 | s string |
| 6656 | exprRc int |
| 6657 | unit ast.TimeUnitType |
| 6658 | }{ |
| 6659 | {`SELECT AVG(val) OVER (RANGE INTERVAL 1+3 MINUTE_SECOND PRECEDING) FROM t;`, 1, ast.TimeUnitMinuteSecond}, |
| 6660 | {`SELECT AVG(val) OVER (RANGE 5 PRECEDING) FROM t;`, 1, ast.TimeUnitInvalid}, |
| 6661 | {`SELECT AVG(val) OVER () FROM t;`, 0, ast.TimeUnitInvalid}, |
| 6662 | } |
| 6663 | for _, tbl := range table { |
| 6664 | stmt, err := p.ParseOneStmt(tbl.s, "", "") |
| 6665 | require.NoError(t, err) |
| 6666 | checker := windowFrameBoundChecker{t: t} |
| 6667 | stmt.Accept(&checker) |
| 6668 | require.Equal(t, tbl.exprRc, checker.exprRc) |
| 6669 | require.Equal(t, tbl.unit, checker.unit) |
| 6670 | } |
| 6671 | } |
| 6672 | |
| 6673 | func TestFieldText(t *testing.T) { |
| 6674 | p := parser.New() |
nothing calls this directly
no test coverage detected