SQL rownum() func (#332)

* Implemented SLQ rownum() func
This commit is contained in:
Neil O'Toole 2023-11-19 23:44:36 -07:00 committed by GitHub
parent 0f9b5e2a75
commit 79e1afd64f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 965 additions and 666 deletions

View File

@ -9,11 +9,25 @@ Breaking changes are annotated with ☢️, and alpha/beta features with 🐥.
## Upcoming
### Added
- New [SLQ](https://sq.io/docs/concepts#slq) function [`rownum()`](https://sq.io/docs/query#rownum) that returns the one-indexed
row number of the current record.
```shell
$ sq '.actor | rownum(), .actor_id, .first_name | order_by(.first_name)'
rownum() actor_id first_name
1 71 ADAM
2 132 ADAM
3 165 AL
```
### Fixed
- [`sq version`](https://sq.io/docs/cmd/version) now honors option
[`format.datetime`](https://sq.io/docs/config#formatdatetime) when outputting build timestamp.
## [v0.43.1] - 2023-11-19
### Added

View File

@ -137,6 +137,7 @@ func (d *driveri) Renderer() *render.Renderer {
r := render.NewDefaultRenderer()
r.FunctionNames[ast.FuncNameSchema] = "DATABASE"
r.FunctionOverrides[ast.FuncNameCatalog] = doRenderFuncCatalog
r.FunctionOverrides[ast.FuncNameRowNum] = renderFuncRowNum
return r
}

View File

@ -5,9 +5,12 @@ import (
"fmt"
"strings"
"github.com/neilotoole/sq/libsq/ast"
"github.com/neilotoole/sq/libsq/ast/render"
"github.com/neilotoole/sq/libsq/core/errz"
"github.com/neilotoole/sq/libsq/core/kind"
"github.com/neilotoole/sq/libsq/core/sqlmodel"
"github.com/neilotoole/sq/libsq/core/stringz"
)
func dbTypeNameFromKind(knd kind.Kind) string {
@ -213,3 +216,36 @@ func buildUpdateStmt(tbl string, cols []string, where string) (string, error) {
return buf.String(), nil
}
// renderFuncRowNum renders the rownum() function.
//
// MySQL didn't introduce ROW_NUMBER() until 8.0, and we're still
// trying to support 5.6 and 5.7. So, we're using a hack, as
// described here: https://www.mysqltutorial.org/mysql-row_number/
//
// SET @row_number = 0;
// SELECT
// (@row_number:=@row_number + 1) AS num,
// actor_id,
// first_name,
// last_name
// FROM actor
// ORDER BY first_name
//
// The function puts the SET statement into the PreExecStmts fragment,
// which then gets executed before the main body of the query.
//
// For MySQL 8+, we could use the ROW_NUMBER() function, but right now
// the code isn't really set up to execute different impls for different
// driver versions. Although, this is probably something we need to face up to.
func renderFuncRowNum(rc *render.Context, _ *ast.FuncNode) (string, error) { //nolint:unparam
// We use a unique variable name to avoid collisions if there are
// multiple uses of rownum() in the same query.
variable := "@row_number_" + stringz.Uniq8()
rc.Fragments.PreExecStmts = append(rc.Fragments.PreExecStmts, "SET "+variable+" = 0;")
rc.Fragments.PostExecStmts = append(rc.Fragments.PostExecStmts, "SET "+variable+" = NULL;")
// e.g. (@row_number_abcd1234:=@row_number_abcd1234 + 1)
return "(" + variable + ":=" + variable + " + 1)", nil
}

View File

@ -4,8 +4,6 @@ import (
"bytes"
"strings"
"github.com/neilotoole/sq/libsq/ast"
"github.com/neilotoole/sq/libsq/ast/render"
"github.com/neilotoole/sq/libsq/core/errz"
"github.com/neilotoole/sq/libsq/core/kind"
"github.com/neilotoole/sq/libsq/core/sqlmodel"
@ -137,28 +135,3 @@ func buildUpdateStmt(tbl string, cols []string, where string) (string, error) {
return buf.String(), nil
}
func doRenderFuncSchema(_ *render.Context, fn *ast.FuncNode) (string, error) {
if fn.FuncName() != ast.FuncNameSchema {
// Shouldn't happen
return "", errz.Errorf("expected %s function, got %q", ast.FuncNameSchema, fn.FuncName())
}
const frag = `(SELECT name FROM pragma_database_list ORDER BY seq limit 1)`
return frag, nil
}
// doRenderFuncCatalog renders the catalog function. SQLite doesn't
// support catalogs, so we just return the string "default". We could
// return empty string, but that may be even more confusing, and would
// make SQLite the odd man out, as the other SQL drivers (even MySQL)
// have a value for catalog.
func doRenderFuncCatalog(_ *render.Context, fn *ast.FuncNode) (string, error) {
if fn.FuncName() != ast.FuncNameCatalog {
// Shouldn't happen
return "", errz.Errorf("expected %s function, got %q", ast.FuncNameCatalog, fn.FuncName())
}
const frag = `(SELECT 'default')`
return frag, nil
}

View File

@ -243,8 +243,16 @@ func placeholders(numCols, numRows int) string {
// Renderer implements driver.SQLDriver.
func (d *driveri) Renderer() *render.Renderer {
r := render.NewDefaultRenderer()
r.FunctionOverrides[ast.FuncNameSchema] = doRenderFuncSchema
r.FunctionOverrides[ast.FuncNameCatalog] = doRenderFuncCatalog
const schemaFrag = `(SELECT name FROM pragma_database_list ORDER BY seq limit 1)`
r.FunctionOverrides[ast.FuncNameSchema] = render.FuncOverrideString(schemaFrag)
// SQLite doesn't support catalogs, so we just return the string "default".
// We could return empty string, but that may be even more confusing, and would
// make SQLite the odd man out, as the other SQL drivers (even MySQL)
// have a value for catalog.
const catalogFrag = `(SELECT 'default')`
r.FunctionOverrides[ast.FuncNameCatalog] = render.FuncOverrideString(catalogFrag)
return r
}

View File

@ -184,3 +184,23 @@ func replacePlaceholders(input string) string {
return sb.String()
}
// renderFuncRowNum renders the rownum() function.
func renderFuncRowNum(rc *render.Context, fn *ast.FuncNode) (string, error) {
a, _ := ast.NodeRoot(fn).(*ast.AST)
obNode := ast.FindFirstNode[*ast.OrderByNode](a)
if obNode != nil {
obClause, err := rc.Renderer.OrderBy(rc, obNode)
if err != nil {
return "", err
}
return "(row_number() OVER (" + obClause + "))", nil
}
// The following is a hack to get around the fact that SQL Server
// requires an ORDER BY clause window functions.
// See:
// - https://stackoverflow.com/a/33013690/6004734
// - https://stackoverflow.com/a/50645278/6004734
return "(row_number() OVER (ORDER BY (SELECT NULL)))", nil
}

View File

@ -145,10 +145,11 @@ func (d *driveri) Renderer() *render.Renderer {
// Custom functions for SQLServer-specific stuff.
r.Range = renderRange
r.PreRender = preRender
r.PreRender = append(r.PreRender, preRender)
r.FunctionNames[ast.FuncNameSchema] = "SCHEMA_NAME"
r.FunctionNames[ast.FuncNameCatalog] = "DB_NAME"
r.FunctionOverrides[ast.FuncNameRowNum] = renderFuncRowNum
return r
}

View File

@ -33,6 +33,7 @@ funcName
| 'min'
| 'schema'
| 'catalog'
| 'rownum'
| PROPRIETARY_FUNC_NAME
;
@ -178,10 +179,8 @@ results are inherently sorted. Although perhaps it should be implemented
as a no-op.
*/
ORDER_ASC: '+';
ORDER_DESC: '-';
ORDER_BY: 'order_by' | 'sort_by';
orderByTerm: selector (ORDER_ASC | ORDER_DESC)?;
orderByTerm: selector ('+' | '-')?;
orderBy: ORDER_BY '(' orderByTerm (',' orderByTerm)* ')';
// selector specfies a table name, a column name, or table.column.

View File

@ -15,6 +15,7 @@ const (
FuncNameSchema = "schema"
FuncNameCatalog = "catalog"
FuncNameSum = "sum"
FuncNameRowNum = "rownum"
)
var (

View File

@ -9,6 +9,9 @@ import (
)
// Inspector provides functionality for AST interrogation.
//
// TODO: Inspector can probably be rewritten to be a set
// of functions, especially now with generics available.
type Inspector struct {
ast *AST
}

File diff suppressed because one or more lines are too long

View File

@ -19,37 +19,38 @@ T__17=18
T__18=19
T__19=20
T__20=21
PROPRIETARY_FUNC_NAME=22
JOIN_TYPE=23
WHERE=24
GROUP_BY=25
ORDER_ASC=26
ORDER_DESC=27
ORDER_BY=28
ALIAS_RESERVED=29
ARG=30
NULL=31
ID=32
WS=33
LPAR=34
RPAR=35
LBRA=36
RBRA=37
COMMA=38
PIPE=39
COLON=40
NN=41
NUMBER=42
LT_EQ=43
LT=44
GT_EQ=45
GT=46
NEQ=47
EQ=48
NAME=49
HANDLE=50
STRING=51
LINECOMMENT=52
T__21=22
T__22=23
T__23=24
PROPRIETARY_FUNC_NAME=25
JOIN_TYPE=26
WHERE=27
GROUP_BY=28
ORDER_BY=29
ALIAS_RESERVED=30
ARG=31
NULL=32
ID=33
WS=34
LPAR=35
RPAR=36
LBRA=37
RBRA=38
COMMA=39
PIPE=40
COLON=41
NN=42
NUMBER=43
LT_EQ=44
LT=45
GT_EQ=46
GT=47
NEQ=48
EQ=49
NAME=50
HANDLE=51
STRING=52
LINECOMMENT=53
';'=1
'*'=2
'sum'=3
@ -58,33 +59,34 @@ LINECOMMENT=52
'min'=6
'schema'=7
'catalog'=8
'unique'=9
'uniq'=10
'count'=11
'.['=12
'||'=13
'/'=14
'%'=15
'<<'=16
'>>'=17
'&'=18
'&&'=19
'~'=20
'!'=21
'group_by'=25
'+'=26
'-'=27
'null'=31
'('=34
')'=35
'['=36
']'=37
','=38
'|'=39
':'=40
'<='=43
'<'=44
'>='=45
'>'=46
'!='=47
'=='=48
'rownum'=9
'unique'=10
'uniq'=11
'count'=12
'+'=13
'-'=14
'.['=15
'||'=16
'/'=17
'%'=18
'<<'=19
'>>'=20
'&'=21
'&&'=22
'~'=23
'!'=24
'group_by'=28
'null'=32
'('=35
')'=36
'['=37
']'=38
','=39
'|'=40
':'=41
'<='=44
'<'=45
'>='=46
'>'=47
'!='=48
'=='=49

File diff suppressed because one or more lines are too long

View File

@ -19,37 +19,38 @@ T__17=18
T__18=19
T__19=20
T__20=21
PROPRIETARY_FUNC_NAME=22
JOIN_TYPE=23
WHERE=24
GROUP_BY=25
ORDER_ASC=26
ORDER_DESC=27
ORDER_BY=28
ALIAS_RESERVED=29
ARG=30
NULL=31
ID=32
WS=33
LPAR=34
RPAR=35
LBRA=36
RBRA=37
COMMA=38
PIPE=39
COLON=40
NN=41
NUMBER=42
LT_EQ=43
LT=44
GT_EQ=45
GT=46
NEQ=47
EQ=48
NAME=49
HANDLE=50
STRING=51
LINECOMMENT=52
T__21=22
T__22=23
T__23=24
PROPRIETARY_FUNC_NAME=25
JOIN_TYPE=26
WHERE=27
GROUP_BY=28
ORDER_BY=29
ALIAS_RESERVED=30
ARG=31
NULL=32
ID=33
WS=34
LPAR=35
RPAR=36
LBRA=37
RBRA=38
COMMA=39
PIPE=40
COLON=41
NN=42
NUMBER=43
LT_EQ=44
LT=45
GT_EQ=46
GT=47
NEQ=48
EQ=49
NAME=50
HANDLE=51
STRING=52
LINECOMMENT=53
';'=1
'*'=2
'sum'=3
@ -58,33 +59,34 @@ LINECOMMENT=52
'min'=6
'schema'=7
'catalog'=8
'unique'=9
'uniq'=10
'count'=11
'.['=12
'||'=13
'/'=14
'%'=15
'<<'=16
'>>'=17
'&'=18
'&&'=19
'~'=20
'!'=21
'group_by'=25
'+'=26
'-'=27
'null'=31
'('=34
')'=35
'['=36
']'=37
','=38
'|'=39
':'=40
'<='=43
'<'=44
'>='=45
'>'=46
'!='=47
'=='=48
'rownum'=9
'unique'=10
'uniq'=11
'count'=12
'+'=13
'-'=14
'.['=15
'||'=16
'/'=17
'%'=18
'<<'=19
'>>'=20
'&'=21
'&&'=22
'~'=23
'!'=24
'group_by'=28
'null'=32
'('=35
')'=36
'['=37
']'=38
','=39
'|'=40
':'=41
'<='=44
'<'=45
'>='=46
'>'=47
'!='=48
'=='=49

View File

@ -44,34 +44,33 @@ func slqlexerLexerInit() {
}
staticData.LiteralNames = []string{
"", "';'", "'*'", "'sum'", "'avg'", "'max'", "'min'", "'schema'", "'catalog'",
"'unique'", "'uniq'", "'count'", "'.['", "'||'", "'/'", "'%'", "'<<'",
"'>>'", "'&'", "'&&'", "'~'", "'!'", "", "", "", "'group_by'", "'+'",
"'-'", "", "", "", "'null'", "", "", "'('", "')'", "'['", "']'", "','",
"'|'", "':'", "", "", "'<='", "'<'", "'>='", "'>'", "'!='", "'=='",
"'rownum'", "'unique'", "'uniq'", "'count'", "'+'", "'-'", "'.['", "'||'",
"'/'", "'%'", "'<<'", "'>>'", "'&'", "'&&'", "'~'", "'!'", "", "", "",
"'group_by'", "", "", "", "'null'", "", "", "'('", "')'", "'['", "']'",
"','", "'|'", "':'", "", "", "'<='", "'<'", "'>='", "'>'", "'!='", "'=='",
}
staticData.SymbolicNames = []string{
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "PROPRIETARY_FUNC_NAME", "JOIN_TYPE", "WHERE", "GROUP_BY",
"ORDER_ASC", "ORDER_DESC", "ORDER_BY", "ALIAS_RESERVED", "ARG", "NULL",
"ID", "WS", "LPAR", "RPAR", "LBRA", "RBRA", "COMMA", "PIPE", "COLON",
"NN", "NUMBER", "LT_EQ", "LT", "GT_EQ", "GT", "NEQ", "EQ", "NAME", "HANDLE",
"", "", "", "", "", "", "", "", "PROPRIETARY_FUNC_NAME", "JOIN_TYPE",
"WHERE", "GROUP_BY", "ORDER_BY", "ALIAS_RESERVED", "ARG", "NULL", "ID",
"WS", "LPAR", "RPAR", "LBRA", "RBRA", "COMMA", "PIPE", "COLON", "NN",
"NUMBER", "LT_EQ", "LT", "GT_EQ", "GT", "NEQ", "EQ", "NAME", "HANDLE",
"STRING", "LINECOMMENT",
}
staticData.RuleNames = []string{
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
"T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "T__16",
"T__17", "T__18", "T__19", "T__20", "PROPRIETARY_FUNC_NAME", "JOIN_TYPE",
"WHERE", "GROUP_BY", "ORDER_ASC", "ORDER_DESC", "ORDER_BY", "ALIAS_RESERVED",
"ARG", "NULL", "ID", "WS", "LPAR", "RPAR", "LBRA", "RBRA", "COMMA",
"PIPE", "COLON", "NN", "NUMBER", "INTF", "EXP", "LT_EQ", "LT", "GT_EQ",
"GT", "NEQ", "EQ", "NAME", "HANDLE", "STRING", "ESC", "UNICODE", "HEX",
"DIGIT", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L",
"M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"LINECOMMENT",
"T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "PROPRIETARY_FUNC_NAME",
"JOIN_TYPE", "WHERE", "GROUP_BY", "ORDER_BY", "ALIAS_RESERVED", "ARG",
"NULL", "ID", "WS", "LPAR", "RPAR", "LBRA", "RBRA", "COMMA", "PIPE",
"COLON", "NN", "NUMBER", "INTF", "EXP", "LT_EQ", "LT", "GT_EQ", "GT",
"NEQ", "EQ", "NAME", "HANDLE", "STRING", "ESC", "UNICODE", "HEX", "DIGIT",
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
"O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "LINECOMMENT",
}
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
staticData.serializedATN = []int32{
4, 0, 52, 674, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2,
4, 0, 53, 683, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2,
4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2,
10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15,
7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7,
@ -87,69 +86,70 @@ func slqlexerLexerInit() {
2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2,
73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78,
7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7,
83, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1,
3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1,
6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1,
8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1,
10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12,
1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1,
16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21,
1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1,
22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22,
1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1,
22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22,
1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1,
22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22,
1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1,
22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22,
1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1,
22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22,
1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1,
22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 373,
8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1,
23, 1, 23, 3, 23, 386, 8, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24,
1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1,
27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27,
1, 27, 3, 27, 416, 8, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1,
28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28,
1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1,
28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28,
1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1,
28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 474, 8, 28,
1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 5,
31, 486, 8, 31, 10, 31, 12, 31, 489, 9, 31, 1, 32, 4, 32, 492, 8, 32, 11,
32, 12, 32, 493, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 1, 34, 1, 35, 1, 35,
1, 36, 1, 36, 1, 37, 1, 37, 1, 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1,
41, 1, 41, 3, 41, 516, 8, 41, 1, 41, 1, 41, 1, 41, 4, 41, 521, 8, 41, 11,
41, 12, 41, 522, 1, 41, 3, 41, 526, 8, 41, 1, 41, 3, 41, 529, 8, 41, 1,
41, 1, 41, 1, 41, 1, 41, 3, 41, 535, 8, 41, 1, 41, 3, 41, 538, 8, 41, 1,
42, 1, 42, 1, 42, 5, 42, 543, 8, 42, 10, 42, 12, 42, 546, 9, 42, 3, 42,
548, 8, 42, 1, 43, 1, 43, 3, 43, 552, 8, 43, 1, 43, 1, 43, 1, 44, 1, 44,
1, 44, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 48, 1, 48, 1,
48, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 3, 50, 576, 8, 50,
1, 51, 1, 51, 1, 51, 1, 51, 5, 51, 582, 8, 51, 10, 51, 12, 51, 585, 9,
51, 1, 52, 1, 52, 1, 52, 5, 52, 590, 8, 52, 10, 52, 12, 52, 593, 9, 52,
1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 3, 53, 600, 8, 53, 1, 54, 1, 54, 1,
54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 56, 1, 56, 1, 57, 1, 57, 1, 58,
1, 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 63, 1,
63, 1, 64, 1, 64, 1, 65, 1, 65, 1, 66, 1, 66, 1, 67, 1, 67, 1, 68, 1, 68,
1, 69, 1, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 72, 1, 72, 1, 73, 1, 73, 1,
74, 1, 74, 1, 75, 1, 75, 1, 76, 1, 76, 1, 77, 1, 77, 1, 78, 1, 78, 1, 79,
1, 79, 1, 80, 1, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 5, 83, 666,
8, 83, 10, 83, 12, 83, 669, 9, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 667,
0, 84, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10,
83, 2, 84, 7, 84, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3,
1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6,
1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7,
1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9,
1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11,
1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1,
14, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18,
1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1,
23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25,
1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1,
25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25,
1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1,
25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25,
1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1,
25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25,
1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1,
25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25,
1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1,
25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25,
1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1,
25, 3, 25, 386, 8, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26,
1, 26, 1, 26, 1, 26, 1, 26, 3, 26, 399, 8, 26, 1, 27, 1, 27, 1, 27, 1,
27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28,
1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 3,
28, 425, 8, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29,
1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1,
29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29,
1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1,
29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29,
1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 483, 8, 29, 1, 30, 1,
30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 5, 32, 495,
8, 32, 10, 32, 12, 32, 498, 9, 32, 1, 33, 4, 33, 501, 8, 33, 11, 33, 12,
33, 502, 1, 33, 1, 33, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, 1, 36, 1, 37,
1, 37, 1, 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 41, 1, 41, 1, 42, 1,
42, 3, 42, 525, 8, 42, 1, 42, 1, 42, 1, 42, 4, 42, 530, 8, 42, 11, 42,
12, 42, 531, 1, 42, 3, 42, 535, 8, 42, 1, 42, 3, 42, 538, 8, 42, 1, 42,
1, 42, 1, 42, 1, 42, 3, 42, 544, 8, 42, 1, 42, 3, 42, 547, 8, 42, 1, 43,
1, 43, 1, 43, 5, 43, 552, 8, 43, 10, 43, 12, 43, 555, 9, 43, 3, 43, 557,
8, 43, 1, 44, 1, 44, 3, 44, 561, 8, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1,
45, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49,
1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 3, 51, 585, 8, 51, 1,
52, 1, 52, 1, 52, 1, 52, 5, 52, 591, 8, 52, 10, 52, 12, 52, 594, 9, 52,
1, 53, 1, 53, 1, 53, 5, 53, 599, 8, 53, 10, 53, 12, 53, 602, 9, 53, 1,
53, 1, 53, 1, 54, 1, 54, 1, 54, 3, 54, 609, 8, 54, 1, 55, 1, 55, 1, 55,
1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 57, 1, 57, 1, 58, 1, 58, 1, 59, 1,
59, 1, 60, 1, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 63, 1, 63, 1, 64, 1, 64,
1, 65, 1, 65, 1, 66, 1, 66, 1, 67, 1, 67, 1, 68, 1, 68, 1, 69, 1, 69, 1,
70, 1, 70, 1, 71, 1, 71, 1, 72, 1, 72, 1, 73, 1, 73, 1, 74, 1, 74, 1, 75,
1, 75, 1, 76, 1, 76, 1, 77, 1, 77, 1, 78, 1, 78, 1, 79, 1, 79, 1, 80, 1,
80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 5, 84, 675,
8, 84, 10, 84, 12, 84, 678, 9, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 676,
0, 85, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10,
21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19,
39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28,
57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37,
75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 0, 87, 0, 89, 43, 91, 44, 93,
45, 95, 46, 97, 47, 99, 48, 101, 49, 103, 50, 105, 51, 107, 0, 109, 0,
75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 0, 89, 0, 91, 44, 93,
45, 95, 46, 97, 47, 99, 48, 101, 49, 103, 50, 105, 51, 107, 52, 109, 0,
111, 0, 113, 0, 115, 0, 117, 0, 119, 0, 121, 0, 123, 0, 125, 0, 127, 0,
129, 0, 131, 0, 133, 0, 135, 0, 137, 0, 139, 0, 141, 0, 143, 0, 145, 0,
147, 0, 149, 0, 151, 0, 153, 0, 155, 0, 157, 0, 159, 0, 161, 0, 163, 0,
165, 0, 167, 52, 1, 0, 35, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57,
65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 48, 57, 1,
0, 49, 57, 2, 0, 69, 69, 101, 101, 2, 0, 43, 43, 45, 45, 2, 0, 34, 34,
92, 92, 8, 0, 34, 34, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114,
165, 0, 167, 0, 169, 53, 1, 0, 35, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0,
48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 48,
57, 1, 0, 49, 57, 2, 0, 69, 69, 101, 101, 2, 0, 43, 43, 45, 45, 2, 0, 34,
34, 92, 92, 8, 0, 34, 34, 47, 47, 92, 92, 98, 98, 102, 102, 110, 110, 114,
114, 116, 116, 3, 0, 48, 57, 65, 70, 97, 102, 2, 0, 65, 65, 97, 97, 2,
0, 66, 66, 98, 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, 2, 0,
70, 70, 102, 102, 2, 0, 71, 71, 103, 103, 2, 0, 72, 72, 104, 104, 2, 0,
@ -158,7 +158,7 @@ func slqlexerLexerInit() {
79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 81, 81, 113, 113, 2, 0,
82, 82, 114, 114, 2, 0, 83, 83, 115, 115, 2, 0, 84, 84, 116, 116, 2, 0,
85, 85, 117, 117, 2, 0, 86, 86, 118, 118, 2, 0, 87, 87, 119, 119, 2, 0,
88, 88, 120, 120, 2, 0, 89, 89, 121, 121, 2, 0, 90, 90, 122, 122, 683,
88, 88, 120, 120, 2, 0, 89, 89, 121, 121, 2, 0, 90, 90, 122, 122, 692,
0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0,
0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0,
0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0,
@ -169,211 +169,214 @@ func slqlexerLexerInit() {
0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0,
0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0,
0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1,
0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 89,
0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85,
1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0,
97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0,
0, 0, 105, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 1, 169, 1, 0, 0, 0, 3, 171,
1, 0, 0, 0, 5, 173, 1, 0, 0, 0, 7, 177, 1, 0, 0, 0, 9, 181, 1, 0, 0, 0,
11, 185, 1, 0, 0, 0, 13, 189, 1, 0, 0, 0, 15, 196, 1, 0, 0, 0, 17, 204,
1, 0, 0, 0, 19, 211, 1, 0, 0, 0, 21, 216, 1, 0, 0, 0, 23, 222, 1, 0, 0,
0, 25, 225, 1, 0, 0, 0, 27, 228, 1, 0, 0, 0, 29, 230, 1, 0, 0, 0, 31, 232,
1, 0, 0, 0, 33, 235, 1, 0, 0, 0, 35, 238, 1, 0, 0, 0, 37, 240, 1, 0, 0,
0, 39, 243, 1, 0, 0, 0, 41, 245, 1, 0, 0, 0, 43, 247, 1, 0, 0, 0, 45, 372,
1, 0, 0, 0, 47, 385, 1, 0, 0, 0, 49, 387, 1, 0, 0, 0, 51, 396, 1, 0, 0,
0, 53, 398, 1, 0, 0, 0, 55, 415, 1, 0, 0, 0, 57, 473, 1, 0, 0, 0, 59, 475,
1, 0, 0, 0, 61, 478, 1, 0, 0, 0, 63, 483, 1, 0, 0, 0, 65, 491, 1, 0, 0,
0, 67, 497, 1, 0, 0, 0, 69, 499, 1, 0, 0, 0, 71, 501, 1, 0, 0, 0, 73, 503,
1, 0, 0, 0, 75, 505, 1, 0, 0, 0, 77, 507, 1, 0, 0, 0, 79, 509, 1, 0, 0,
0, 81, 511, 1, 0, 0, 0, 83, 537, 1, 0, 0, 0, 85, 547, 1, 0, 0, 0, 87, 549,
1, 0, 0, 0, 89, 555, 1, 0, 0, 0, 91, 558, 1, 0, 0, 0, 93, 560, 1, 0, 0,
0, 95, 563, 1, 0, 0, 0, 97, 565, 1, 0, 0, 0, 99, 568, 1, 0, 0, 0, 101,
571, 1, 0, 0, 0, 103, 577, 1, 0, 0, 0, 105, 586, 1, 0, 0, 0, 107, 596,
1, 0, 0, 0, 109, 601, 1, 0, 0, 0, 111, 607, 1, 0, 0, 0, 113, 609, 1, 0,
0, 0, 115, 611, 1, 0, 0, 0, 117, 613, 1, 0, 0, 0, 119, 615, 1, 0, 0, 0,
121, 617, 1, 0, 0, 0, 123, 619, 1, 0, 0, 0, 125, 621, 1, 0, 0, 0, 127,
623, 1, 0, 0, 0, 129, 625, 1, 0, 0, 0, 131, 627, 1, 0, 0, 0, 133, 629,
1, 0, 0, 0, 135, 631, 1, 0, 0, 0, 137, 633, 1, 0, 0, 0, 139, 635, 1, 0,
0, 0, 141, 637, 1, 0, 0, 0, 143, 639, 1, 0, 0, 0, 145, 641, 1, 0, 0, 0,
147, 643, 1, 0, 0, 0, 149, 645, 1, 0, 0, 0, 151, 647, 1, 0, 0, 0, 153,
649, 1, 0, 0, 0, 155, 651, 1, 0, 0, 0, 157, 653, 1, 0, 0, 0, 159, 655,
1, 0, 0, 0, 161, 657, 1, 0, 0, 0, 163, 659, 1, 0, 0, 0, 165, 661, 1, 0,
0, 0, 167, 663, 1, 0, 0, 0, 169, 170, 5, 59, 0, 0, 170, 2, 1, 0, 0, 0,
171, 172, 5, 42, 0, 0, 172, 4, 1, 0, 0, 0, 173, 174, 5, 115, 0, 0, 174,
175, 5, 117, 0, 0, 175, 176, 5, 109, 0, 0, 176, 6, 1, 0, 0, 0, 177, 178,
5, 97, 0, 0, 178, 179, 5, 118, 0, 0, 179, 180, 5, 103, 0, 0, 180, 8, 1,
0, 0, 0, 181, 182, 5, 109, 0, 0, 182, 183, 5, 97, 0, 0, 183, 184, 5, 120,
0, 0, 184, 10, 1, 0, 0, 0, 185, 186, 5, 109, 0, 0, 186, 187, 5, 105, 0,
0, 187, 188, 5, 110, 0, 0, 188, 12, 1, 0, 0, 0, 189, 190, 5, 115, 0, 0,
190, 191, 5, 99, 0, 0, 191, 192, 5, 104, 0, 0, 192, 193, 5, 101, 0, 0,
193, 194, 5, 109, 0, 0, 194, 195, 5, 97, 0, 0, 195, 14, 1, 0, 0, 0, 196,
197, 5, 99, 0, 0, 197, 198, 5, 97, 0, 0, 198, 199, 5, 116, 0, 0, 199, 200,
5, 97, 0, 0, 200, 201, 5, 108, 0, 0, 201, 202, 5, 111, 0, 0, 202, 203,
5, 103, 0, 0, 203, 16, 1, 0, 0, 0, 204, 205, 5, 117, 0, 0, 205, 206, 5,
110, 0, 0, 206, 207, 5, 105, 0, 0, 207, 208, 5, 113, 0, 0, 208, 209, 5,
117, 0, 0, 209, 210, 5, 101, 0, 0, 210, 18, 1, 0, 0, 0, 211, 212, 5, 117,
0, 0, 212, 213, 5, 110, 0, 0, 213, 214, 5, 105, 0, 0, 214, 215, 5, 113,
0, 0, 215, 20, 1, 0, 0, 0, 216, 217, 5, 99, 0, 0, 217, 218, 5, 111, 0,
0, 218, 219, 5, 117, 0, 0, 219, 220, 5, 110, 0, 0, 220, 221, 5, 116, 0,
0, 221, 22, 1, 0, 0, 0, 222, 223, 5, 46, 0, 0, 223, 224, 5, 91, 0, 0, 224,
24, 1, 0, 0, 0, 225, 226, 5, 124, 0, 0, 226, 227, 5, 124, 0, 0, 227, 26,
1, 0, 0, 0, 228, 229, 5, 47, 0, 0, 229, 28, 1, 0, 0, 0, 230, 231, 5, 37,
0, 0, 231, 30, 1, 0, 0, 0, 232, 233, 5, 60, 0, 0, 233, 234, 5, 60, 0, 0,
234, 32, 1, 0, 0, 0, 235, 236, 5, 62, 0, 0, 236, 237, 5, 62, 0, 0, 237,
34, 1, 0, 0, 0, 238, 239, 5, 38, 0, 0, 239, 36, 1, 0, 0, 0, 240, 241, 5,
38, 0, 0, 241, 242, 5, 38, 0, 0, 242, 38, 1, 0, 0, 0, 243, 244, 5, 126,
0, 0, 244, 40, 1, 0, 0, 0, 245, 246, 5, 33, 0, 0, 246, 42, 1, 0, 0, 0,
247, 248, 5, 95, 0, 0, 248, 249, 3, 63, 31, 0, 249, 44, 1, 0, 0, 0, 250,
251, 5, 106, 0, 0, 251, 252, 5, 111, 0, 0, 252, 253, 5, 105, 0, 0, 253,
373, 5, 110, 0, 0, 254, 255, 5, 105, 0, 0, 255, 256, 5, 110, 0, 0, 256,
257, 5, 110, 0, 0, 257, 258, 5, 101, 0, 0, 258, 259, 5, 114, 0, 0, 259,
260, 5, 95, 0, 0, 260, 261, 5, 106, 0, 0, 261, 262, 5, 111, 0, 0, 262,
263, 5, 105, 0, 0, 263, 373, 5, 110, 0, 0, 264, 265, 5, 108, 0, 0, 265,
266, 5, 101, 0, 0, 266, 267, 5, 102, 0, 0, 267, 268, 5, 116, 0, 0, 268,
269, 5, 95, 0, 0, 269, 270, 5, 106, 0, 0, 270, 271, 5, 111, 0, 0, 271,
272, 5, 105, 0, 0, 272, 373, 5, 110, 0, 0, 273, 274, 5, 108, 0, 0, 274,
275, 5, 106, 0, 0, 275, 276, 5, 111, 0, 0, 276, 277, 5, 105, 0, 0, 277,
373, 5, 110, 0, 0, 278, 279, 5, 108, 0, 0, 279, 280, 5, 101, 0, 0, 280,
281, 5, 102, 0, 0, 281, 282, 5, 116, 0, 0, 282, 283, 5, 95, 0, 0, 283,
284, 5, 111, 0, 0, 284, 285, 5, 117, 0, 0, 285, 286, 5, 116, 0, 0, 286,
287, 5, 101, 0, 0, 287, 288, 5, 114, 0, 0, 288, 289, 5, 95, 0, 0, 289,
290, 5, 106, 0, 0, 290, 291, 5, 111, 0, 0, 291, 292, 5, 105, 0, 0, 292,
373, 5, 110, 0, 0, 293, 294, 5, 108, 0, 0, 294, 295, 5, 111, 0, 0, 295,
296, 5, 106, 0, 0, 296, 297, 5, 111, 0, 0, 297, 298, 5, 105, 0, 0, 298,
373, 5, 110, 0, 0, 299, 300, 5, 114, 0, 0, 300, 301, 5, 105, 0, 0, 301,
302, 5, 103, 0, 0, 302, 303, 5, 104, 0, 0, 303, 304, 5, 116, 0, 0, 304,
305, 5, 95, 0, 0, 305, 306, 5, 106, 0, 0, 306, 307, 5, 111, 0, 0, 307,
308, 5, 105, 0, 0, 308, 373, 5, 110, 0, 0, 309, 310, 5, 114, 0, 0, 310,
311, 5, 106, 0, 0, 311, 312, 5, 111, 0, 0, 312, 313, 5, 105, 0, 0, 313,
373, 5, 110, 0, 0, 314, 315, 5, 114, 0, 0, 315, 316, 5, 105, 0, 0, 316,
317, 5, 103, 0, 0, 317, 318, 5, 104, 0, 0, 318, 319, 5, 116, 0, 0, 319,
320, 5, 95, 0, 0, 320, 321, 5, 111, 0, 0, 321, 322, 5, 117, 0, 0, 322,
323, 5, 116, 0, 0, 323, 324, 5, 101, 0, 0, 324, 325, 5, 114, 0, 0, 325,
326, 5, 95, 0, 0, 326, 327, 5, 106, 0, 0, 327, 328, 5, 111, 0, 0, 328,
329, 5, 105, 0, 0, 329, 373, 5, 110, 0, 0, 330, 331, 5, 114, 0, 0, 331,
332, 5, 111, 0, 0, 332, 333, 5, 106, 0, 0, 333, 334, 5, 111, 0, 0, 334,
335, 5, 105, 0, 0, 335, 373, 5, 110, 0, 0, 336, 337, 5, 102, 0, 0, 337,
338, 5, 117, 0, 0, 338, 339, 5, 108, 0, 0, 339, 340, 5, 108, 0, 0, 340,
341, 5, 95, 0, 0, 341, 342, 5, 111, 0, 0, 342, 343, 5, 117, 0, 0, 343,
344, 5, 116, 0, 0, 344, 345, 5, 101, 0, 0, 345, 346, 5, 114, 0, 0, 346,
347, 5, 95, 0, 0, 347, 348, 5, 106, 0, 0, 348, 349, 5, 111, 0, 0, 349,
350, 5, 105, 0, 0, 350, 373, 5, 110, 0, 0, 351, 352, 5, 102, 0, 0, 352,
353, 5, 111, 0, 0, 353, 354, 5, 106, 0, 0, 354, 355, 5, 111, 0, 0, 355,
356, 5, 105, 0, 0, 356, 373, 5, 110, 0, 0, 357, 358, 5, 99, 0, 0, 358,
359, 5, 114, 0, 0, 359, 360, 5, 111, 0, 0, 360, 361, 5, 115, 0, 0, 361,
362, 5, 115, 0, 0, 362, 363, 5, 95, 0, 0, 363, 364, 5, 106, 0, 0, 364,
365, 5, 111, 0, 0, 365, 366, 5, 105, 0, 0, 366, 373, 5, 110, 0, 0, 367,
368, 5, 120, 0, 0, 368, 369, 5, 106, 0, 0, 369, 370, 5, 111, 0, 0, 370,
371, 5, 105, 0, 0, 371, 373, 5, 110, 0, 0, 372, 250, 1, 0, 0, 0, 372, 254,
1, 0, 0, 0, 372, 264, 1, 0, 0, 0, 372, 273, 1, 0, 0, 0, 372, 278, 1, 0,
0, 0, 372, 293, 1, 0, 0, 0, 372, 299, 1, 0, 0, 0, 372, 309, 1, 0, 0, 0,
372, 314, 1, 0, 0, 0, 372, 330, 1, 0, 0, 0, 372, 336, 1, 0, 0, 0, 372,
351, 1, 0, 0, 0, 372, 357, 1, 0, 0, 0, 372, 367, 1, 0, 0, 0, 373, 46, 1,
0, 0, 0, 374, 375, 5, 119, 0, 0, 375, 376, 5, 104, 0, 0, 376, 377, 5, 101,
0, 0, 377, 378, 5, 114, 0, 0, 378, 386, 5, 101, 0, 0, 379, 380, 5, 115,
0, 0, 380, 381, 5, 101, 0, 0, 381, 382, 5, 108, 0, 0, 382, 383, 5, 101,
0, 0, 383, 384, 5, 99, 0, 0, 384, 386, 5, 116, 0, 0, 385, 374, 1, 0, 0,
0, 385, 379, 1, 0, 0, 0, 386, 48, 1, 0, 0, 0, 387, 388, 5, 103, 0, 0, 388,
389, 5, 114, 0, 0, 389, 390, 5, 111, 0, 0, 390, 391, 5, 117, 0, 0, 391,
392, 5, 112, 0, 0, 392, 393, 5, 95, 0, 0, 393, 394, 5, 98, 0, 0, 394, 395,
5, 121, 0, 0, 395, 50, 1, 0, 0, 0, 396, 397, 5, 43, 0, 0, 397, 52, 1, 0,
0, 0, 398, 399, 5, 45, 0, 0, 399, 54, 1, 0, 0, 0, 400, 401, 5, 111, 0,
0, 401, 402, 5, 114, 0, 0, 402, 403, 5, 100, 0, 0, 403, 404, 5, 101, 0,
0, 404, 405, 5, 114, 0, 0, 405, 406, 5, 95, 0, 0, 406, 407, 5, 98, 0, 0,
407, 416, 5, 121, 0, 0, 408, 409, 5, 115, 0, 0, 409, 410, 5, 111, 0, 0,
410, 411, 5, 114, 0, 0, 411, 412, 5, 116, 0, 0, 412, 413, 5, 95, 0, 0,
413, 414, 5, 98, 0, 0, 414, 416, 5, 121, 0, 0, 415, 400, 1, 0, 0, 0, 415,
408, 1, 0, 0, 0, 416, 56, 1, 0, 0, 0, 417, 418, 5, 58, 0, 0, 418, 419,
5, 99, 0, 0, 419, 420, 5, 111, 0, 0, 420, 421, 5, 117, 0, 0, 421, 422,
5, 110, 0, 0, 422, 474, 5, 116, 0, 0, 423, 424, 5, 58, 0, 0, 424, 425,
5, 99, 0, 0, 425, 426, 5, 111, 0, 0, 426, 427, 5, 117, 0, 0, 427, 428,
5, 110, 0, 0, 428, 429, 5, 116, 0, 0, 429, 430, 5, 95, 0, 0, 430, 431,
5, 117, 0, 0, 431, 432, 5, 110, 0, 0, 432, 433, 5, 105, 0, 0, 433, 434,
5, 113, 0, 0, 434, 435, 5, 117, 0, 0, 435, 474, 5, 101, 0, 0, 436, 437,
5, 58, 0, 0, 437, 438, 5, 97, 0, 0, 438, 439, 5, 118, 0, 0, 439, 474, 5,
103, 0, 0, 440, 441, 5, 58, 0, 0, 441, 442, 5, 103, 0, 0, 442, 443, 5,
114, 0, 0, 443, 444, 5, 111, 0, 0, 444, 445, 5, 117, 0, 0, 445, 446, 5,
112, 0, 0, 446, 447, 5, 95, 0, 0, 447, 448, 5, 98, 0, 0, 448, 474, 5, 121,
0, 0, 449, 450, 5, 58, 0, 0, 450, 451, 5, 109, 0, 0, 451, 452, 5, 97, 0,
0, 452, 474, 5, 120, 0, 0, 453, 454, 5, 58, 0, 0, 454, 455, 5, 109, 0,
0, 455, 456, 5, 105, 0, 0, 456, 474, 5, 110, 0, 0, 457, 458, 5, 58, 0,
0, 458, 459, 5, 111, 0, 0, 459, 460, 5, 114, 0, 0, 460, 461, 5, 100, 0,
0, 461, 462, 5, 101, 0, 0, 462, 463, 5, 114, 0, 0, 463, 464, 5, 95, 0,
0, 464, 465, 5, 98, 0, 0, 465, 474, 5, 121, 0, 0, 466, 467, 5, 58, 0, 0,
467, 468, 5, 117, 0, 0, 468, 469, 5, 110, 0, 0, 469, 470, 5, 105, 0, 0,
470, 471, 5, 113, 0, 0, 471, 472, 5, 117, 0, 0, 472, 474, 5, 101, 0, 0,
473, 417, 1, 0, 0, 0, 473, 423, 1, 0, 0, 0, 473, 436, 1, 0, 0, 0, 473,
440, 1, 0, 0, 0, 473, 449, 1, 0, 0, 0, 473, 453, 1, 0, 0, 0, 473, 457,
1, 0, 0, 0, 473, 466, 1, 0, 0, 0, 474, 58, 1, 0, 0, 0, 475, 476, 5, 36,
0, 0, 476, 477, 3, 63, 31, 0, 477, 60, 1, 0, 0, 0, 478, 479, 5, 110, 0,
0, 479, 480, 5, 117, 0, 0, 480, 481, 5, 108, 0, 0, 481, 482, 5, 108, 0,
0, 482, 62, 1, 0, 0, 0, 483, 487, 7, 0, 0, 0, 484, 486, 7, 1, 0, 0, 485,
484, 1, 0, 0, 0, 486, 489, 1, 0, 0, 0, 487, 485, 1, 0, 0, 0, 487, 488,
1, 0, 0, 0, 488, 64, 1, 0, 0, 0, 489, 487, 1, 0, 0, 0, 490, 492, 7, 2,
0, 0, 491, 490, 1, 0, 0, 0, 492, 493, 1, 0, 0, 0, 493, 491, 1, 0, 0, 0,
493, 494, 1, 0, 0, 0, 494, 495, 1, 0, 0, 0, 495, 496, 6, 32, 0, 0, 496,
66, 1, 0, 0, 0, 497, 498, 5, 40, 0, 0, 498, 68, 1, 0, 0, 0, 499, 500, 5,
41, 0, 0, 500, 70, 1, 0, 0, 0, 501, 502, 5, 91, 0, 0, 502, 72, 1, 0, 0,
0, 503, 504, 5, 93, 0, 0, 504, 74, 1, 0, 0, 0, 505, 506, 5, 44, 0, 0, 506,
76, 1, 0, 0, 0, 507, 508, 5, 124, 0, 0, 508, 78, 1, 0, 0, 0, 509, 510,
5, 58, 0, 0, 510, 80, 1, 0, 0, 0, 511, 512, 3, 85, 42, 0, 512, 82, 1, 0,
0, 0, 513, 538, 3, 81, 40, 0, 514, 516, 5, 45, 0, 0, 515, 514, 1, 0, 0,
0, 515, 516, 1, 0, 0, 0, 516, 517, 1, 0, 0, 0, 517, 518, 3, 85, 42, 0,
518, 520, 5, 46, 0, 0, 519, 521, 7, 3, 0, 0, 520, 519, 1, 0, 0, 0, 521,
522, 1, 0, 0, 0, 522, 520, 1, 0, 0, 0, 522, 523, 1, 0, 0, 0, 523, 525,
1, 0, 0, 0, 524, 526, 3, 87, 43, 0, 525, 524, 1, 0, 0, 0, 525, 526, 1,
0, 0, 0, 526, 538, 1, 0, 0, 0, 527, 529, 5, 45, 0, 0, 528, 527, 1, 0, 0,
0, 528, 529, 1, 0, 0, 0, 529, 530, 1, 0, 0, 0, 530, 531, 3, 85, 42, 0,
531, 532, 3, 87, 43, 0, 532, 538, 1, 0, 0, 0, 533, 535, 5, 45, 0, 0, 534,
533, 1, 0, 0, 0, 534, 535, 1, 0, 0, 0, 535, 536, 1, 0, 0, 0, 536, 538,
3, 85, 42, 0, 537, 513, 1, 0, 0, 0, 537, 515, 1, 0, 0, 0, 537, 528, 1,
0, 0, 0, 537, 534, 1, 0, 0, 0, 538, 84, 1, 0, 0, 0, 539, 548, 5, 48, 0,
0, 540, 544, 7, 4, 0, 0, 541, 543, 7, 3, 0, 0, 542, 541, 1, 0, 0, 0, 543,
546, 1, 0, 0, 0, 544, 542, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 548,
1, 0, 0, 0, 546, 544, 1, 0, 0, 0, 547, 539, 1, 0, 0, 0, 547, 540, 1, 0,
0, 0, 548, 86, 1, 0, 0, 0, 549, 551, 7, 5, 0, 0, 550, 552, 7, 6, 0, 0,
551, 550, 1, 0, 0, 0, 551, 552, 1, 0, 0, 0, 552, 553, 1, 0, 0, 0, 553,
554, 3, 85, 42, 0, 554, 88, 1, 0, 0, 0, 555, 556, 5, 60, 0, 0, 556, 557,
5, 61, 0, 0, 557, 90, 1, 0, 0, 0, 558, 559, 5, 60, 0, 0, 559, 92, 1, 0,
0, 0, 560, 561, 5, 62, 0, 0, 561, 562, 5, 61, 0, 0, 562, 94, 1, 0, 0, 0,
563, 564, 5, 62, 0, 0, 564, 96, 1, 0, 0, 0, 565, 566, 5, 33, 0, 0, 566,
567, 5, 61, 0, 0, 567, 98, 1, 0, 0, 0, 568, 569, 5, 61, 0, 0, 569, 570,
5, 61, 0, 0, 570, 100, 1, 0, 0, 0, 571, 575, 5, 46, 0, 0, 572, 576, 3,
59, 29, 0, 573, 576, 3, 63, 31, 0, 574, 576, 3, 105, 52, 0, 575, 572, 1,
0, 0, 0, 575, 573, 1, 0, 0, 0, 575, 574, 1, 0, 0, 0, 576, 102, 1, 0, 0,
0, 577, 578, 5, 64, 0, 0, 578, 583, 3, 63, 31, 0, 579, 580, 5, 47, 0, 0,
580, 582, 3, 63, 31, 0, 581, 579, 1, 0, 0, 0, 582, 585, 1, 0, 0, 0, 583,
581, 1, 0, 0, 0, 583, 584, 1, 0, 0, 0, 584, 104, 1, 0, 0, 0, 585, 583,
1, 0, 0, 0, 586, 591, 5, 34, 0, 0, 587, 590, 3, 107, 53, 0, 588, 590, 8,
7, 0, 0, 589, 587, 1, 0, 0, 0, 589, 588, 1, 0, 0, 0, 590, 593, 1, 0, 0,
0, 591, 589, 1, 0, 0, 0, 591, 592, 1, 0, 0, 0, 592, 594, 1, 0, 0, 0, 593,
591, 1, 0, 0, 0, 594, 595, 5, 34, 0, 0, 595, 106, 1, 0, 0, 0, 596, 599,
5, 92, 0, 0, 597, 600, 7, 8, 0, 0, 598, 600, 3, 109, 54, 0, 599, 597, 1,
0, 0, 0, 599, 598, 1, 0, 0, 0, 600, 108, 1, 0, 0, 0, 601, 602, 5, 117,
0, 0, 602, 603, 3, 111, 55, 0, 603, 604, 3, 111, 55, 0, 604, 605, 3, 111,
55, 0, 605, 606, 3, 111, 55, 0, 606, 110, 1, 0, 0, 0, 607, 608, 7, 9, 0,
0, 608, 112, 1, 0, 0, 0, 609, 610, 7, 3, 0, 0, 610, 114, 1, 0, 0, 0, 611,
612, 7, 10, 0, 0, 612, 116, 1, 0, 0, 0, 613, 614, 7, 11, 0, 0, 614, 118,
1, 0, 0, 0, 615, 616, 7, 12, 0, 0, 616, 120, 1, 0, 0, 0, 617, 618, 7, 13,
0, 0, 618, 122, 1, 0, 0, 0, 619, 620, 7, 5, 0, 0, 620, 124, 1, 0, 0, 0,
621, 622, 7, 14, 0, 0, 622, 126, 1, 0, 0, 0, 623, 624, 7, 15, 0, 0, 624,
128, 1, 0, 0, 0, 625, 626, 7, 16, 0, 0, 626, 130, 1, 0, 0, 0, 627, 628,
7, 17, 0, 0, 628, 132, 1, 0, 0, 0, 629, 630, 7, 18, 0, 0, 630, 134, 1,
0, 0, 0, 631, 632, 7, 19, 0, 0, 632, 136, 1, 0, 0, 0, 633, 634, 7, 20,
0, 0, 634, 138, 1, 0, 0, 0, 635, 636, 7, 21, 0, 0, 636, 140, 1, 0, 0, 0,
637, 638, 7, 22, 0, 0, 638, 142, 1, 0, 0, 0, 639, 640, 7, 23, 0, 0, 640,
144, 1, 0, 0, 0, 641, 642, 7, 24, 0, 0, 642, 146, 1, 0, 0, 0, 643, 644,
7, 25, 0, 0, 644, 148, 1, 0, 0, 0, 645, 646, 7, 26, 0, 0, 646, 150, 1,
0, 0, 0, 647, 648, 7, 27, 0, 0, 648, 152, 1, 0, 0, 0, 649, 650, 7, 28,
0, 0, 650, 154, 1, 0, 0, 0, 651, 652, 7, 29, 0, 0, 652, 156, 1, 0, 0, 0,
653, 654, 7, 30, 0, 0, 654, 158, 1, 0, 0, 0, 655, 656, 7, 31, 0, 0, 656,
160, 1, 0, 0, 0, 657, 658, 7, 32, 0, 0, 658, 162, 1, 0, 0, 0, 659, 660,
7, 33, 0, 0, 660, 164, 1, 0, 0, 0, 661, 662, 7, 34, 0, 0, 662, 166, 1,
0, 0, 0, 663, 667, 5, 35, 0, 0, 664, 666, 9, 0, 0, 0, 665, 664, 1, 0, 0,
0, 666, 669, 1, 0, 0, 0, 667, 668, 1, 0, 0, 0, 667, 665, 1, 0, 0, 0, 668,
670, 1, 0, 0, 0, 669, 667, 1, 0, 0, 0, 670, 671, 5, 10, 0, 0, 671, 672,
1, 0, 0, 0, 672, 673, 6, 83, 0, 0, 673, 168, 1, 0, 0, 0, 22, 0, 372, 385,
415, 473, 487, 493, 515, 522, 525, 528, 534, 537, 544, 547, 551, 575, 583,
589, 591, 599, 667, 1, 6, 0, 0,
0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 1, 171,
1, 0, 0, 0, 3, 173, 1, 0, 0, 0, 5, 175, 1, 0, 0, 0, 7, 179, 1, 0, 0, 0,
9, 183, 1, 0, 0, 0, 11, 187, 1, 0, 0, 0, 13, 191, 1, 0, 0, 0, 15, 198,
1, 0, 0, 0, 17, 206, 1, 0, 0, 0, 19, 213, 1, 0, 0, 0, 21, 220, 1, 0, 0,
0, 23, 225, 1, 0, 0, 0, 25, 231, 1, 0, 0, 0, 27, 233, 1, 0, 0, 0, 29, 235,
1, 0, 0, 0, 31, 238, 1, 0, 0, 0, 33, 241, 1, 0, 0, 0, 35, 243, 1, 0, 0,
0, 37, 245, 1, 0, 0, 0, 39, 248, 1, 0, 0, 0, 41, 251, 1, 0, 0, 0, 43, 253,
1, 0, 0, 0, 45, 256, 1, 0, 0, 0, 47, 258, 1, 0, 0, 0, 49, 260, 1, 0, 0,
0, 51, 385, 1, 0, 0, 0, 53, 398, 1, 0, 0, 0, 55, 400, 1, 0, 0, 0, 57, 424,
1, 0, 0, 0, 59, 482, 1, 0, 0, 0, 61, 484, 1, 0, 0, 0, 63, 487, 1, 0, 0,
0, 65, 492, 1, 0, 0, 0, 67, 500, 1, 0, 0, 0, 69, 506, 1, 0, 0, 0, 71, 508,
1, 0, 0, 0, 73, 510, 1, 0, 0, 0, 75, 512, 1, 0, 0, 0, 77, 514, 1, 0, 0,
0, 79, 516, 1, 0, 0, 0, 81, 518, 1, 0, 0, 0, 83, 520, 1, 0, 0, 0, 85, 546,
1, 0, 0, 0, 87, 556, 1, 0, 0, 0, 89, 558, 1, 0, 0, 0, 91, 564, 1, 0, 0,
0, 93, 567, 1, 0, 0, 0, 95, 569, 1, 0, 0, 0, 97, 572, 1, 0, 0, 0, 99, 574,
1, 0, 0, 0, 101, 577, 1, 0, 0, 0, 103, 580, 1, 0, 0, 0, 105, 586, 1, 0,
0, 0, 107, 595, 1, 0, 0, 0, 109, 605, 1, 0, 0, 0, 111, 610, 1, 0, 0, 0,
113, 616, 1, 0, 0, 0, 115, 618, 1, 0, 0, 0, 117, 620, 1, 0, 0, 0, 119,
622, 1, 0, 0, 0, 121, 624, 1, 0, 0, 0, 123, 626, 1, 0, 0, 0, 125, 628,
1, 0, 0, 0, 127, 630, 1, 0, 0, 0, 129, 632, 1, 0, 0, 0, 131, 634, 1, 0,
0, 0, 133, 636, 1, 0, 0, 0, 135, 638, 1, 0, 0, 0, 137, 640, 1, 0, 0, 0,
139, 642, 1, 0, 0, 0, 141, 644, 1, 0, 0, 0, 143, 646, 1, 0, 0, 0, 145,
648, 1, 0, 0, 0, 147, 650, 1, 0, 0, 0, 149, 652, 1, 0, 0, 0, 151, 654,
1, 0, 0, 0, 153, 656, 1, 0, 0, 0, 155, 658, 1, 0, 0, 0, 157, 660, 1, 0,
0, 0, 159, 662, 1, 0, 0, 0, 161, 664, 1, 0, 0, 0, 163, 666, 1, 0, 0, 0,
165, 668, 1, 0, 0, 0, 167, 670, 1, 0, 0, 0, 169, 672, 1, 0, 0, 0, 171,
172, 5, 59, 0, 0, 172, 2, 1, 0, 0, 0, 173, 174, 5, 42, 0, 0, 174, 4, 1,
0, 0, 0, 175, 176, 5, 115, 0, 0, 176, 177, 5, 117, 0, 0, 177, 178, 5, 109,
0, 0, 178, 6, 1, 0, 0, 0, 179, 180, 5, 97, 0, 0, 180, 181, 5, 118, 0, 0,
181, 182, 5, 103, 0, 0, 182, 8, 1, 0, 0, 0, 183, 184, 5, 109, 0, 0, 184,
185, 5, 97, 0, 0, 185, 186, 5, 120, 0, 0, 186, 10, 1, 0, 0, 0, 187, 188,
5, 109, 0, 0, 188, 189, 5, 105, 0, 0, 189, 190, 5, 110, 0, 0, 190, 12,
1, 0, 0, 0, 191, 192, 5, 115, 0, 0, 192, 193, 5, 99, 0, 0, 193, 194, 5,
104, 0, 0, 194, 195, 5, 101, 0, 0, 195, 196, 5, 109, 0, 0, 196, 197, 5,
97, 0, 0, 197, 14, 1, 0, 0, 0, 198, 199, 5, 99, 0, 0, 199, 200, 5, 97,
0, 0, 200, 201, 5, 116, 0, 0, 201, 202, 5, 97, 0, 0, 202, 203, 5, 108,
0, 0, 203, 204, 5, 111, 0, 0, 204, 205, 5, 103, 0, 0, 205, 16, 1, 0, 0,
0, 206, 207, 5, 114, 0, 0, 207, 208, 5, 111, 0, 0, 208, 209, 5, 119, 0,
0, 209, 210, 5, 110, 0, 0, 210, 211, 5, 117, 0, 0, 211, 212, 5, 109, 0,
0, 212, 18, 1, 0, 0, 0, 213, 214, 5, 117, 0, 0, 214, 215, 5, 110, 0, 0,
215, 216, 5, 105, 0, 0, 216, 217, 5, 113, 0, 0, 217, 218, 5, 117, 0, 0,
218, 219, 5, 101, 0, 0, 219, 20, 1, 0, 0, 0, 220, 221, 5, 117, 0, 0, 221,
222, 5, 110, 0, 0, 222, 223, 5, 105, 0, 0, 223, 224, 5, 113, 0, 0, 224,
22, 1, 0, 0, 0, 225, 226, 5, 99, 0, 0, 226, 227, 5, 111, 0, 0, 227, 228,
5, 117, 0, 0, 228, 229, 5, 110, 0, 0, 229, 230, 5, 116, 0, 0, 230, 24,
1, 0, 0, 0, 231, 232, 5, 43, 0, 0, 232, 26, 1, 0, 0, 0, 233, 234, 5, 45,
0, 0, 234, 28, 1, 0, 0, 0, 235, 236, 5, 46, 0, 0, 236, 237, 5, 91, 0, 0,
237, 30, 1, 0, 0, 0, 238, 239, 5, 124, 0, 0, 239, 240, 5, 124, 0, 0, 240,
32, 1, 0, 0, 0, 241, 242, 5, 47, 0, 0, 242, 34, 1, 0, 0, 0, 243, 244, 5,
37, 0, 0, 244, 36, 1, 0, 0, 0, 245, 246, 5, 60, 0, 0, 246, 247, 5, 60,
0, 0, 247, 38, 1, 0, 0, 0, 248, 249, 5, 62, 0, 0, 249, 250, 5, 62, 0, 0,
250, 40, 1, 0, 0, 0, 251, 252, 5, 38, 0, 0, 252, 42, 1, 0, 0, 0, 253, 254,
5, 38, 0, 0, 254, 255, 5, 38, 0, 0, 255, 44, 1, 0, 0, 0, 256, 257, 5, 126,
0, 0, 257, 46, 1, 0, 0, 0, 258, 259, 5, 33, 0, 0, 259, 48, 1, 0, 0, 0,
260, 261, 5, 95, 0, 0, 261, 262, 3, 65, 32, 0, 262, 50, 1, 0, 0, 0, 263,
264, 5, 106, 0, 0, 264, 265, 5, 111, 0, 0, 265, 266, 5, 105, 0, 0, 266,
386, 5, 110, 0, 0, 267, 268, 5, 105, 0, 0, 268, 269, 5, 110, 0, 0, 269,
270, 5, 110, 0, 0, 270, 271, 5, 101, 0, 0, 271, 272, 5, 114, 0, 0, 272,
273, 5, 95, 0, 0, 273, 274, 5, 106, 0, 0, 274, 275, 5, 111, 0, 0, 275,
276, 5, 105, 0, 0, 276, 386, 5, 110, 0, 0, 277, 278, 5, 108, 0, 0, 278,
279, 5, 101, 0, 0, 279, 280, 5, 102, 0, 0, 280, 281, 5, 116, 0, 0, 281,
282, 5, 95, 0, 0, 282, 283, 5, 106, 0, 0, 283, 284, 5, 111, 0, 0, 284,
285, 5, 105, 0, 0, 285, 386, 5, 110, 0, 0, 286, 287, 5, 108, 0, 0, 287,
288, 5, 106, 0, 0, 288, 289, 5, 111, 0, 0, 289, 290, 5, 105, 0, 0, 290,
386, 5, 110, 0, 0, 291, 292, 5, 108, 0, 0, 292, 293, 5, 101, 0, 0, 293,
294, 5, 102, 0, 0, 294, 295, 5, 116, 0, 0, 295, 296, 5, 95, 0, 0, 296,
297, 5, 111, 0, 0, 297, 298, 5, 117, 0, 0, 298, 299, 5, 116, 0, 0, 299,
300, 5, 101, 0, 0, 300, 301, 5, 114, 0, 0, 301, 302, 5, 95, 0, 0, 302,
303, 5, 106, 0, 0, 303, 304, 5, 111, 0, 0, 304, 305, 5, 105, 0, 0, 305,
386, 5, 110, 0, 0, 306, 307, 5, 108, 0, 0, 307, 308, 5, 111, 0, 0, 308,
309, 5, 106, 0, 0, 309, 310, 5, 111, 0, 0, 310, 311, 5, 105, 0, 0, 311,
386, 5, 110, 0, 0, 312, 313, 5, 114, 0, 0, 313, 314, 5, 105, 0, 0, 314,
315, 5, 103, 0, 0, 315, 316, 5, 104, 0, 0, 316, 317, 5, 116, 0, 0, 317,
318, 5, 95, 0, 0, 318, 319, 5, 106, 0, 0, 319, 320, 5, 111, 0, 0, 320,
321, 5, 105, 0, 0, 321, 386, 5, 110, 0, 0, 322, 323, 5, 114, 0, 0, 323,
324, 5, 106, 0, 0, 324, 325, 5, 111, 0, 0, 325, 326, 5, 105, 0, 0, 326,
386, 5, 110, 0, 0, 327, 328, 5, 114, 0, 0, 328, 329, 5, 105, 0, 0, 329,
330, 5, 103, 0, 0, 330, 331, 5, 104, 0, 0, 331, 332, 5, 116, 0, 0, 332,
333, 5, 95, 0, 0, 333, 334, 5, 111, 0, 0, 334, 335, 5, 117, 0, 0, 335,
336, 5, 116, 0, 0, 336, 337, 5, 101, 0, 0, 337, 338, 5, 114, 0, 0, 338,
339, 5, 95, 0, 0, 339, 340, 5, 106, 0, 0, 340, 341, 5, 111, 0, 0, 341,
342, 5, 105, 0, 0, 342, 386, 5, 110, 0, 0, 343, 344, 5, 114, 0, 0, 344,
345, 5, 111, 0, 0, 345, 346, 5, 106, 0, 0, 346, 347, 5, 111, 0, 0, 347,
348, 5, 105, 0, 0, 348, 386, 5, 110, 0, 0, 349, 350, 5, 102, 0, 0, 350,
351, 5, 117, 0, 0, 351, 352, 5, 108, 0, 0, 352, 353, 5, 108, 0, 0, 353,
354, 5, 95, 0, 0, 354, 355, 5, 111, 0, 0, 355, 356, 5, 117, 0, 0, 356,
357, 5, 116, 0, 0, 357, 358, 5, 101, 0, 0, 358, 359, 5, 114, 0, 0, 359,
360, 5, 95, 0, 0, 360, 361, 5, 106, 0, 0, 361, 362, 5, 111, 0, 0, 362,
363, 5, 105, 0, 0, 363, 386, 5, 110, 0, 0, 364, 365, 5, 102, 0, 0, 365,
366, 5, 111, 0, 0, 366, 367, 5, 106, 0, 0, 367, 368, 5, 111, 0, 0, 368,
369, 5, 105, 0, 0, 369, 386, 5, 110, 0, 0, 370, 371, 5, 99, 0, 0, 371,
372, 5, 114, 0, 0, 372, 373, 5, 111, 0, 0, 373, 374, 5, 115, 0, 0, 374,
375, 5, 115, 0, 0, 375, 376, 5, 95, 0, 0, 376, 377, 5, 106, 0, 0, 377,
378, 5, 111, 0, 0, 378, 379, 5, 105, 0, 0, 379, 386, 5, 110, 0, 0, 380,
381, 5, 120, 0, 0, 381, 382, 5, 106, 0, 0, 382, 383, 5, 111, 0, 0, 383,
384, 5, 105, 0, 0, 384, 386, 5, 110, 0, 0, 385, 263, 1, 0, 0, 0, 385, 267,
1, 0, 0, 0, 385, 277, 1, 0, 0, 0, 385, 286, 1, 0, 0, 0, 385, 291, 1, 0,
0, 0, 385, 306, 1, 0, 0, 0, 385, 312, 1, 0, 0, 0, 385, 322, 1, 0, 0, 0,
385, 327, 1, 0, 0, 0, 385, 343, 1, 0, 0, 0, 385, 349, 1, 0, 0, 0, 385,
364, 1, 0, 0, 0, 385, 370, 1, 0, 0, 0, 385, 380, 1, 0, 0, 0, 386, 52, 1,
0, 0, 0, 387, 388, 5, 119, 0, 0, 388, 389, 5, 104, 0, 0, 389, 390, 5, 101,
0, 0, 390, 391, 5, 114, 0, 0, 391, 399, 5, 101, 0, 0, 392, 393, 5, 115,
0, 0, 393, 394, 5, 101, 0, 0, 394, 395, 5, 108, 0, 0, 395, 396, 5, 101,
0, 0, 396, 397, 5, 99, 0, 0, 397, 399, 5, 116, 0, 0, 398, 387, 1, 0, 0,
0, 398, 392, 1, 0, 0, 0, 399, 54, 1, 0, 0, 0, 400, 401, 5, 103, 0, 0, 401,
402, 5, 114, 0, 0, 402, 403, 5, 111, 0, 0, 403, 404, 5, 117, 0, 0, 404,
405, 5, 112, 0, 0, 405, 406, 5, 95, 0, 0, 406, 407, 5, 98, 0, 0, 407, 408,
5, 121, 0, 0, 408, 56, 1, 0, 0, 0, 409, 410, 5, 111, 0, 0, 410, 411, 5,
114, 0, 0, 411, 412, 5, 100, 0, 0, 412, 413, 5, 101, 0, 0, 413, 414, 5,
114, 0, 0, 414, 415, 5, 95, 0, 0, 415, 416, 5, 98, 0, 0, 416, 425, 5, 121,
0, 0, 417, 418, 5, 115, 0, 0, 418, 419, 5, 111, 0, 0, 419, 420, 5, 114,
0, 0, 420, 421, 5, 116, 0, 0, 421, 422, 5, 95, 0, 0, 422, 423, 5, 98, 0,
0, 423, 425, 5, 121, 0, 0, 424, 409, 1, 0, 0, 0, 424, 417, 1, 0, 0, 0,
425, 58, 1, 0, 0, 0, 426, 427, 5, 58, 0, 0, 427, 428, 5, 99, 0, 0, 428,
429, 5, 111, 0, 0, 429, 430, 5, 117, 0, 0, 430, 431, 5, 110, 0, 0, 431,
483, 5, 116, 0, 0, 432, 433, 5, 58, 0, 0, 433, 434, 5, 99, 0, 0, 434, 435,
5, 111, 0, 0, 435, 436, 5, 117, 0, 0, 436, 437, 5, 110, 0, 0, 437, 438,
5, 116, 0, 0, 438, 439, 5, 95, 0, 0, 439, 440, 5, 117, 0, 0, 440, 441,
5, 110, 0, 0, 441, 442, 5, 105, 0, 0, 442, 443, 5, 113, 0, 0, 443, 444,
5, 117, 0, 0, 444, 483, 5, 101, 0, 0, 445, 446, 5, 58, 0, 0, 446, 447,
5, 97, 0, 0, 447, 448, 5, 118, 0, 0, 448, 483, 5, 103, 0, 0, 449, 450,
5, 58, 0, 0, 450, 451, 5, 103, 0, 0, 451, 452, 5, 114, 0, 0, 452, 453,
5, 111, 0, 0, 453, 454, 5, 117, 0, 0, 454, 455, 5, 112, 0, 0, 455, 456,
5, 95, 0, 0, 456, 457, 5, 98, 0, 0, 457, 483, 5, 121, 0, 0, 458, 459, 5,
58, 0, 0, 459, 460, 5, 109, 0, 0, 460, 461, 5, 97, 0, 0, 461, 483, 5, 120,
0, 0, 462, 463, 5, 58, 0, 0, 463, 464, 5, 109, 0, 0, 464, 465, 5, 105,
0, 0, 465, 483, 5, 110, 0, 0, 466, 467, 5, 58, 0, 0, 467, 468, 5, 111,
0, 0, 468, 469, 5, 114, 0, 0, 469, 470, 5, 100, 0, 0, 470, 471, 5, 101,
0, 0, 471, 472, 5, 114, 0, 0, 472, 473, 5, 95, 0, 0, 473, 474, 5, 98, 0,
0, 474, 483, 5, 121, 0, 0, 475, 476, 5, 58, 0, 0, 476, 477, 5, 117, 0,
0, 477, 478, 5, 110, 0, 0, 478, 479, 5, 105, 0, 0, 479, 480, 5, 113, 0,
0, 480, 481, 5, 117, 0, 0, 481, 483, 5, 101, 0, 0, 482, 426, 1, 0, 0, 0,
482, 432, 1, 0, 0, 0, 482, 445, 1, 0, 0, 0, 482, 449, 1, 0, 0, 0, 482,
458, 1, 0, 0, 0, 482, 462, 1, 0, 0, 0, 482, 466, 1, 0, 0, 0, 482, 475,
1, 0, 0, 0, 483, 60, 1, 0, 0, 0, 484, 485, 5, 36, 0, 0, 485, 486, 3, 65,
32, 0, 486, 62, 1, 0, 0, 0, 487, 488, 5, 110, 0, 0, 488, 489, 5, 117, 0,
0, 489, 490, 5, 108, 0, 0, 490, 491, 5, 108, 0, 0, 491, 64, 1, 0, 0, 0,
492, 496, 7, 0, 0, 0, 493, 495, 7, 1, 0, 0, 494, 493, 1, 0, 0, 0, 495,
498, 1, 0, 0, 0, 496, 494, 1, 0, 0, 0, 496, 497, 1, 0, 0, 0, 497, 66, 1,
0, 0, 0, 498, 496, 1, 0, 0, 0, 499, 501, 7, 2, 0, 0, 500, 499, 1, 0, 0,
0, 501, 502, 1, 0, 0, 0, 502, 500, 1, 0, 0, 0, 502, 503, 1, 0, 0, 0, 503,
504, 1, 0, 0, 0, 504, 505, 6, 33, 0, 0, 505, 68, 1, 0, 0, 0, 506, 507,
5, 40, 0, 0, 507, 70, 1, 0, 0, 0, 508, 509, 5, 41, 0, 0, 509, 72, 1, 0,
0, 0, 510, 511, 5, 91, 0, 0, 511, 74, 1, 0, 0, 0, 512, 513, 5, 93, 0, 0,
513, 76, 1, 0, 0, 0, 514, 515, 5, 44, 0, 0, 515, 78, 1, 0, 0, 0, 516, 517,
5, 124, 0, 0, 517, 80, 1, 0, 0, 0, 518, 519, 5, 58, 0, 0, 519, 82, 1, 0,
0, 0, 520, 521, 3, 87, 43, 0, 521, 84, 1, 0, 0, 0, 522, 547, 3, 83, 41,
0, 523, 525, 5, 45, 0, 0, 524, 523, 1, 0, 0, 0, 524, 525, 1, 0, 0, 0, 525,
526, 1, 0, 0, 0, 526, 527, 3, 87, 43, 0, 527, 529, 5, 46, 0, 0, 528, 530,
7, 3, 0, 0, 529, 528, 1, 0, 0, 0, 530, 531, 1, 0, 0, 0, 531, 529, 1, 0,
0, 0, 531, 532, 1, 0, 0, 0, 532, 534, 1, 0, 0, 0, 533, 535, 3, 89, 44,
0, 534, 533, 1, 0, 0, 0, 534, 535, 1, 0, 0, 0, 535, 547, 1, 0, 0, 0, 536,
538, 5, 45, 0, 0, 537, 536, 1, 0, 0, 0, 537, 538, 1, 0, 0, 0, 538, 539,
1, 0, 0, 0, 539, 540, 3, 87, 43, 0, 540, 541, 3, 89, 44, 0, 541, 547, 1,
0, 0, 0, 542, 544, 5, 45, 0, 0, 543, 542, 1, 0, 0, 0, 543, 544, 1, 0, 0,
0, 544, 545, 1, 0, 0, 0, 545, 547, 3, 87, 43, 0, 546, 522, 1, 0, 0, 0,
546, 524, 1, 0, 0, 0, 546, 537, 1, 0, 0, 0, 546, 543, 1, 0, 0, 0, 547,
86, 1, 0, 0, 0, 548, 557, 5, 48, 0, 0, 549, 553, 7, 4, 0, 0, 550, 552,
7, 3, 0, 0, 551, 550, 1, 0, 0, 0, 552, 555, 1, 0, 0, 0, 553, 551, 1, 0,
0, 0, 553, 554, 1, 0, 0, 0, 554, 557, 1, 0, 0, 0, 555, 553, 1, 0, 0, 0,
556, 548, 1, 0, 0, 0, 556, 549, 1, 0, 0, 0, 557, 88, 1, 0, 0, 0, 558, 560,
7, 5, 0, 0, 559, 561, 7, 6, 0, 0, 560, 559, 1, 0, 0, 0, 560, 561, 1, 0,
0, 0, 561, 562, 1, 0, 0, 0, 562, 563, 3, 87, 43, 0, 563, 90, 1, 0, 0, 0,
564, 565, 5, 60, 0, 0, 565, 566, 5, 61, 0, 0, 566, 92, 1, 0, 0, 0, 567,
568, 5, 60, 0, 0, 568, 94, 1, 0, 0, 0, 569, 570, 5, 62, 0, 0, 570, 571,
5, 61, 0, 0, 571, 96, 1, 0, 0, 0, 572, 573, 5, 62, 0, 0, 573, 98, 1, 0,
0, 0, 574, 575, 5, 33, 0, 0, 575, 576, 5, 61, 0, 0, 576, 100, 1, 0, 0,
0, 577, 578, 5, 61, 0, 0, 578, 579, 5, 61, 0, 0, 579, 102, 1, 0, 0, 0,
580, 584, 5, 46, 0, 0, 581, 585, 3, 61, 30, 0, 582, 585, 3, 65, 32, 0,
583, 585, 3, 107, 53, 0, 584, 581, 1, 0, 0, 0, 584, 582, 1, 0, 0, 0, 584,
583, 1, 0, 0, 0, 585, 104, 1, 0, 0, 0, 586, 587, 5, 64, 0, 0, 587, 592,
3, 65, 32, 0, 588, 589, 5, 47, 0, 0, 589, 591, 3, 65, 32, 0, 590, 588,
1, 0, 0, 0, 591, 594, 1, 0, 0, 0, 592, 590, 1, 0, 0, 0, 592, 593, 1, 0,
0, 0, 593, 106, 1, 0, 0, 0, 594, 592, 1, 0, 0, 0, 595, 600, 5, 34, 0, 0,
596, 599, 3, 109, 54, 0, 597, 599, 8, 7, 0, 0, 598, 596, 1, 0, 0, 0, 598,
597, 1, 0, 0, 0, 599, 602, 1, 0, 0, 0, 600, 598, 1, 0, 0, 0, 600, 601,
1, 0, 0, 0, 601, 603, 1, 0, 0, 0, 602, 600, 1, 0, 0, 0, 603, 604, 5, 34,
0, 0, 604, 108, 1, 0, 0, 0, 605, 608, 5, 92, 0, 0, 606, 609, 7, 8, 0, 0,
607, 609, 3, 111, 55, 0, 608, 606, 1, 0, 0, 0, 608, 607, 1, 0, 0, 0, 609,
110, 1, 0, 0, 0, 610, 611, 5, 117, 0, 0, 611, 612, 3, 113, 56, 0, 612,
613, 3, 113, 56, 0, 613, 614, 3, 113, 56, 0, 614, 615, 3, 113, 56, 0, 615,
112, 1, 0, 0, 0, 616, 617, 7, 9, 0, 0, 617, 114, 1, 0, 0, 0, 618, 619,
7, 3, 0, 0, 619, 116, 1, 0, 0, 0, 620, 621, 7, 10, 0, 0, 621, 118, 1, 0,
0, 0, 622, 623, 7, 11, 0, 0, 623, 120, 1, 0, 0, 0, 624, 625, 7, 12, 0,
0, 625, 122, 1, 0, 0, 0, 626, 627, 7, 13, 0, 0, 627, 124, 1, 0, 0, 0, 628,
629, 7, 5, 0, 0, 629, 126, 1, 0, 0, 0, 630, 631, 7, 14, 0, 0, 631, 128,
1, 0, 0, 0, 632, 633, 7, 15, 0, 0, 633, 130, 1, 0, 0, 0, 634, 635, 7, 16,
0, 0, 635, 132, 1, 0, 0, 0, 636, 637, 7, 17, 0, 0, 637, 134, 1, 0, 0, 0,
638, 639, 7, 18, 0, 0, 639, 136, 1, 0, 0, 0, 640, 641, 7, 19, 0, 0, 641,
138, 1, 0, 0, 0, 642, 643, 7, 20, 0, 0, 643, 140, 1, 0, 0, 0, 644, 645,
7, 21, 0, 0, 645, 142, 1, 0, 0, 0, 646, 647, 7, 22, 0, 0, 647, 144, 1,
0, 0, 0, 648, 649, 7, 23, 0, 0, 649, 146, 1, 0, 0, 0, 650, 651, 7, 24,
0, 0, 651, 148, 1, 0, 0, 0, 652, 653, 7, 25, 0, 0, 653, 150, 1, 0, 0, 0,
654, 655, 7, 26, 0, 0, 655, 152, 1, 0, 0, 0, 656, 657, 7, 27, 0, 0, 657,
154, 1, 0, 0, 0, 658, 659, 7, 28, 0, 0, 659, 156, 1, 0, 0, 0, 660, 661,
7, 29, 0, 0, 661, 158, 1, 0, 0, 0, 662, 663, 7, 30, 0, 0, 663, 160, 1,
0, 0, 0, 664, 665, 7, 31, 0, 0, 665, 162, 1, 0, 0, 0, 666, 667, 7, 32,
0, 0, 667, 164, 1, 0, 0, 0, 668, 669, 7, 33, 0, 0, 669, 166, 1, 0, 0, 0,
670, 671, 7, 34, 0, 0, 671, 168, 1, 0, 0, 0, 672, 676, 5, 35, 0, 0, 673,
675, 9, 0, 0, 0, 674, 673, 1, 0, 0, 0, 675, 678, 1, 0, 0, 0, 676, 677,
1, 0, 0, 0, 676, 674, 1, 0, 0, 0, 677, 679, 1, 0, 0, 0, 678, 676, 1, 0,
0, 0, 679, 680, 5, 10, 0, 0, 680, 681, 1, 0, 0, 0, 681, 682, 6, 84, 0,
0, 682, 170, 1, 0, 0, 0, 22, 0, 385, 398, 424, 482, 496, 502, 524, 531,
534, 537, 543, 546, 553, 556, 560, 584, 592, 598, 600, 608, 676, 1, 6,
0, 0,
}
deserializer := antlr.NewATNDeserializer(nil)
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
@ -435,35 +438,36 @@ const (
SLQLexerT__18 = 19
SLQLexerT__19 = 20
SLQLexerT__20 = 21
SLQLexerPROPRIETARY_FUNC_NAME = 22
SLQLexerJOIN_TYPE = 23
SLQLexerWHERE = 24
SLQLexerGROUP_BY = 25
SLQLexerORDER_ASC = 26
SLQLexerORDER_DESC = 27
SLQLexerORDER_BY = 28
SLQLexerALIAS_RESERVED = 29
SLQLexerARG = 30
SLQLexerNULL = 31
SLQLexerID = 32
SLQLexerWS = 33
SLQLexerLPAR = 34
SLQLexerRPAR = 35
SLQLexerLBRA = 36
SLQLexerRBRA = 37
SLQLexerCOMMA = 38
SLQLexerPIPE = 39
SLQLexerCOLON = 40
SLQLexerNN = 41
SLQLexerNUMBER = 42
SLQLexerLT_EQ = 43
SLQLexerLT = 44
SLQLexerGT_EQ = 45
SLQLexerGT = 46
SLQLexerNEQ = 47
SLQLexerEQ = 48
SLQLexerNAME = 49
SLQLexerHANDLE = 50
SLQLexerSTRING = 51
SLQLexerLINECOMMENT = 52
SLQLexerT__21 = 22
SLQLexerT__22 = 23
SLQLexerT__23 = 24
SLQLexerPROPRIETARY_FUNC_NAME = 25
SLQLexerJOIN_TYPE = 26
SLQLexerWHERE = 27
SLQLexerGROUP_BY = 28
SLQLexerORDER_BY = 29
SLQLexerALIAS_RESERVED = 30
SLQLexerARG = 31
SLQLexerNULL = 32
SLQLexerID = 33
SLQLexerWS = 34
SLQLexerLPAR = 35
SLQLexerRPAR = 36
SLQLexerLBRA = 37
SLQLexerRBRA = 38
SLQLexerCOMMA = 39
SLQLexerPIPE = 40
SLQLexerCOLON = 41
SLQLexerNN = 42
SLQLexerNUMBER = 43
SLQLexerLT_EQ = 44
SLQLexerLT = 45
SLQLexerGT_EQ = 46
SLQLexerGT = 47
SLQLexerNEQ = 48
SLQLexerEQ = 49
SLQLexerNAME = 50
SLQLexerHANDLE = 51
SLQLexerSTRING = 52
SLQLexerLINECOMMENT = 53
)

View File

@ -33,17 +33,17 @@ func slqParserInit() {
staticData := &SLQParserStaticData
staticData.LiteralNames = []string{
"", "';'", "'*'", "'sum'", "'avg'", "'max'", "'min'", "'schema'", "'catalog'",
"'unique'", "'uniq'", "'count'", "'.['", "'||'", "'/'", "'%'", "'<<'",
"'>>'", "'&'", "'&&'", "'~'", "'!'", "", "", "", "'group_by'", "'+'",
"'-'", "", "", "", "'null'", "", "", "'('", "')'", "'['", "']'", "','",
"'|'", "':'", "", "", "'<='", "'<'", "'>='", "'>'", "'!='", "'=='",
"'rownum'", "'unique'", "'uniq'", "'count'", "'+'", "'-'", "'.['", "'||'",
"'/'", "'%'", "'<<'", "'>>'", "'&'", "'&&'", "'~'", "'!'", "", "", "",
"'group_by'", "", "", "", "'null'", "", "", "'('", "')'", "'['", "']'",
"','", "'|'", "':'", "", "", "'<='", "'<'", "'>='", "'>'", "'!='", "'=='",
}
staticData.SymbolicNames = []string{
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "PROPRIETARY_FUNC_NAME", "JOIN_TYPE", "WHERE", "GROUP_BY",
"ORDER_ASC", "ORDER_DESC", "ORDER_BY", "ALIAS_RESERVED", "ARG", "NULL",
"ID", "WS", "LPAR", "RPAR", "LBRA", "RBRA", "COMMA", "PIPE", "COLON",
"NN", "NUMBER", "LT_EQ", "LT", "GT_EQ", "GT", "NEQ", "EQ", "NAME", "HANDLE",
"", "", "", "", "", "", "", "", "PROPRIETARY_FUNC_NAME", "JOIN_TYPE",
"WHERE", "GROUP_BY", "ORDER_BY", "ALIAS_RESERVED", "ARG", "NULL", "ID",
"WS", "LPAR", "RPAR", "LBRA", "RBRA", "COMMA", "PIPE", "COLON", "NN",
"NUMBER", "LT_EQ", "LT", "GT_EQ", "GT", "NEQ", "EQ", "NAME", "HANDLE",
"STRING", "LINECOMMENT",
}
staticData.RuleNames = []string{
@ -55,7 +55,7 @@ func slqParserInit() {
}
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
staticData.serializedATN = []int32{
4, 1, 52, 283, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7,
4, 1, 53, 283, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7,
4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7,
10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15,
2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2,
@ -85,9 +85,9 @@ func slqParserInit() {
24, 3, 24, 268, 8, 24, 1, 24, 1, 24, 1, 24, 1, 24, 5, 24, 274, 8, 24, 10,
24, 12, 24, 277, 9, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 0, 1, 48, 27,
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36,
38, 40, 42, 44, 46, 48, 50, 52, 0, 9, 2, 0, 3, 8, 22, 22, 1, 0, 9, 10,
1, 0, 26, 27, 3, 0, 30, 30, 32, 32, 51, 51, 2, 0, 2, 2, 14, 15, 1, 0, 16,
18, 1, 0, 43, 46, 3, 0, 31, 31, 41, 42, 51, 51, 2, 0, 20, 21, 26, 27, 309,
38, 40, 42, 44, 46, 48, 50, 52, 0, 9, 2, 0, 3, 9, 25, 25, 1, 0, 10, 11,
1, 0, 13, 14, 3, 0, 31, 31, 33, 33, 52, 52, 2, 0, 2, 2, 17, 18, 1, 0, 19,
21, 1, 0, 44, 47, 3, 0, 32, 32, 42, 43, 52, 52, 2, 0, 13, 14, 23, 24, 309,
0, 57, 1, 0, 0, 0, 2, 78, 1, 0, 0, 0, 4, 86, 1, 0, 0, 0, 6, 106, 1, 0,
0, 0, 8, 108, 1, 0, 0, 0, 10, 112, 1, 0, 0, 0, 12, 127, 1, 0, 0, 0, 14,
129, 1, 0, 0, 0, 16, 139, 1, 0, 0, 0, 18, 145, 1, 0, 0, 0, 20, 147, 1,
@ -103,10 +103,10 @@ func slqParserInit() {
62, 1, 0, 0, 0, 68, 71, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 70, 1, 0, 0,
0, 70, 75, 1, 0, 0, 0, 71, 69, 1, 0, 0, 0, 72, 74, 5, 1, 0, 0, 73, 72,
1, 0, 0, 0, 74, 77, 1, 0, 0, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0,
76, 1, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 78, 83, 3, 4, 2, 0, 79, 80, 5, 39,
76, 1, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 78, 83, 3, 4, 2, 0, 79, 80, 5, 40,
0, 0, 80, 82, 3, 4, 2, 0, 81, 79, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83, 81,
1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 3, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0,
86, 91, 3, 6, 3, 0, 87, 88, 5, 38, 0, 0, 88, 90, 3, 6, 3, 0, 89, 87, 1,
86, 91, 3, 6, 3, 0, 87, 88, 5, 39, 0, 0, 88, 90, 3, 6, 3, 0, 89, 87, 1,
0, 0, 0, 90, 93, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92,
5, 1, 0, 0, 0, 93, 91, 1, 0, 0, 0, 94, 107, 3, 40, 20, 0, 95, 107, 3, 42,
21, 0, 96, 107, 3, 34, 17, 0, 97, 107, 3, 14, 7, 0, 98, 107, 3, 26, 13,
@ -118,65 +118,65 @@ func slqParserInit() {
103, 1, 0, 0, 0, 106, 104, 1, 0, 0, 0, 106, 105, 1, 0, 0, 0, 107, 7, 1,
0, 0, 0, 108, 110, 3, 10, 5, 0, 109, 111, 3, 36, 18, 0, 110, 109, 1, 0,
0, 0, 110, 111, 1, 0, 0, 0, 111, 9, 1, 0, 0, 0, 112, 113, 3, 12, 6, 0,
113, 123, 5, 34, 0, 0, 114, 119, 3, 48, 24, 0, 115, 116, 5, 38, 0, 0, 116,
113, 123, 5, 35, 0, 0, 114, 119, 3, 48, 24, 0, 115, 116, 5, 39, 0, 0, 116,
118, 3, 48, 24, 0, 117, 115, 1, 0, 0, 0, 118, 121, 1, 0, 0, 0, 119, 117,
1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 124, 1, 0, 0, 0, 121, 119, 1, 0,
0, 0, 122, 124, 5, 2, 0, 0, 123, 114, 1, 0, 0, 0, 123, 122, 1, 0, 0, 0,
123, 124, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 126, 5, 35, 0, 0, 126,
123, 124, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 126, 5, 36, 0, 0, 126,
11, 1, 0, 0, 0, 127, 128, 7, 0, 0, 0, 128, 13, 1, 0, 0, 0, 129, 130, 5,
23, 0, 0, 130, 131, 5, 34, 0, 0, 131, 134, 3, 16, 8, 0, 132, 133, 5, 38,
26, 0, 0, 130, 131, 5, 35, 0, 0, 131, 134, 3, 16, 8, 0, 132, 133, 5, 39,
0, 0, 133, 135, 3, 48, 24, 0, 134, 132, 1, 0, 0, 0, 134, 135, 1, 0, 0,
0, 135, 136, 1, 0, 0, 0, 136, 137, 5, 35, 0, 0, 137, 15, 1, 0, 0, 0, 138,
140, 5, 50, 0, 0, 139, 138, 1, 0, 0, 0, 139, 140, 1, 0, 0, 0, 140, 141,
1, 0, 0, 0, 141, 143, 5, 49, 0, 0, 142, 144, 3, 36, 18, 0, 143, 142, 1,
0, 135, 136, 1, 0, 0, 0, 136, 137, 5, 36, 0, 0, 137, 15, 1, 0, 0, 0, 138,
140, 5, 51, 0, 0, 139, 138, 1, 0, 0, 0, 139, 140, 1, 0, 0, 0, 140, 141,
1, 0, 0, 0, 141, 143, 5, 50, 0, 0, 142, 144, 3, 36, 18, 0, 143, 142, 1,
0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 17, 1, 0, 0, 0, 145, 146, 7, 1, 0,
0, 146, 19, 1, 0, 0, 0, 147, 153, 5, 11, 0, 0, 148, 150, 5, 34, 0, 0, 149,
0, 146, 19, 1, 0, 0, 0, 147, 153, 5, 12, 0, 0, 148, 150, 5, 35, 0, 0, 149,
151, 3, 32, 16, 0, 150, 149, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 152,
1, 0, 0, 0, 152, 154, 5, 35, 0, 0, 153, 148, 1, 0, 0, 0, 153, 154, 1, 0,
1, 0, 0, 0, 152, 154, 5, 36, 0, 0, 153, 148, 1, 0, 0, 0, 153, 154, 1, 0,
0, 0, 154, 156, 1, 0, 0, 0, 155, 157, 3, 36, 18, 0, 156, 155, 1, 0, 0,
0, 156, 157, 1, 0, 0, 0, 157, 21, 1, 0, 0, 0, 158, 159, 5, 24, 0, 0, 159,
161, 5, 34, 0, 0, 160, 162, 3, 48, 24, 0, 161, 160, 1, 0, 0, 0, 161, 162,
1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 164, 5, 35, 0, 0, 164, 23, 1, 0,
0, 156, 157, 1, 0, 0, 0, 157, 21, 1, 0, 0, 0, 158, 159, 5, 27, 0, 0, 159,
161, 5, 35, 0, 0, 160, 162, 3, 48, 24, 0, 161, 160, 1, 0, 0, 0, 161, 162,
1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 164, 5, 36, 0, 0, 164, 23, 1, 0,
0, 0, 165, 168, 3, 32, 16, 0, 166, 168, 3, 10, 5, 0, 167, 165, 1, 0, 0,
0, 167, 166, 1, 0, 0, 0, 168, 25, 1, 0, 0, 0, 169, 170, 5, 25, 0, 0, 170,
171, 5, 34, 0, 0, 171, 176, 3, 24, 12, 0, 172, 173, 5, 38, 0, 0, 173, 175,
0, 167, 166, 1, 0, 0, 0, 168, 25, 1, 0, 0, 0, 169, 170, 5, 28, 0, 0, 170,
171, 5, 35, 0, 0, 171, 176, 3, 24, 12, 0, 172, 173, 5, 39, 0, 0, 173, 175,
3, 24, 12, 0, 174, 172, 1, 0, 0, 0, 175, 178, 1, 0, 0, 0, 176, 174, 1,
0, 0, 0, 176, 177, 1, 0, 0, 0, 177, 179, 1, 0, 0, 0, 178, 176, 1, 0, 0,
0, 179, 180, 5, 35, 0, 0, 180, 27, 1, 0, 0, 0, 181, 183, 3, 32, 16, 0,
0, 179, 180, 5, 36, 0, 0, 180, 27, 1, 0, 0, 0, 181, 183, 3, 32, 16, 0,
182, 184, 7, 2, 0, 0, 183, 182, 1, 0, 0, 0, 183, 184, 1, 0, 0, 0, 184,
29, 1, 0, 0, 0, 185, 186, 5, 28, 0, 0, 186, 187, 5, 34, 0, 0, 187, 192,
3, 28, 14, 0, 188, 189, 5, 38, 0, 0, 189, 191, 3, 28, 14, 0, 190, 188,
29, 1, 0, 0, 0, 185, 186, 5, 29, 0, 0, 186, 187, 5, 35, 0, 0, 187, 192,
3, 28, 14, 0, 188, 189, 5, 39, 0, 0, 189, 191, 3, 28, 14, 0, 190, 188,
1, 0, 0, 0, 191, 194, 1, 0, 0, 0, 192, 190, 1, 0, 0, 0, 192, 193, 1, 0,
0, 0, 193, 195, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 195, 196, 5, 35, 0, 0,
196, 31, 1, 0, 0, 0, 197, 199, 5, 49, 0, 0, 198, 200, 5, 49, 0, 0, 199,
0, 0, 193, 195, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 195, 196, 5, 36, 0, 0,
196, 31, 1, 0, 0, 0, 197, 199, 5, 50, 0, 0, 198, 200, 5, 50, 0, 0, 199,
198, 1, 0, 0, 0, 199, 200, 1, 0, 0, 0, 200, 33, 1, 0, 0, 0, 201, 203, 3,
32, 16, 0, 202, 204, 3, 36, 18, 0, 203, 202, 1, 0, 0, 0, 203, 204, 1, 0,
0, 0, 204, 35, 1, 0, 0, 0, 205, 209, 5, 29, 0, 0, 206, 207, 5, 40, 0, 0,
0, 0, 204, 35, 1, 0, 0, 0, 205, 209, 5, 30, 0, 0, 206, 207, 5, 41, 0, 0,
207, 209, 7, 3, 0, 0, 208, 205, 1, 0, 0, 0, 208, 206, 1, 0, 0, 0, 209,
37, 1, 0, 0, 0, 210, 211, 5, 30, 0, 0, 211, 39, 1, 0, 0, 0, 212, 213, 5,
50, 0, 0, 213, 214, 5, 49, 0, 0, 214, 41, 1, 0, 0, 0, 215, 216, 5, 50,
0, 0, 216, 43, 1, 0, 0, 0, 217, 226, 5, 12, 0, 0, 218, 219, 5, 41, 0, 0,
219, 220, 5, 40, 0, 0, 220, 227, 5, 41, 0, 0, 221, 222, 5, 41, 0, 0, 222,
227, 5, 40, 0, 0, 223, 224, 5, 40, 0, 0, 224, 227, 5, 41, 0, 0, 225, 227,
5, 41, 0, 0, 226, 218, 1, 0, 0, 0, 226, 221, 1, 0, 0, 0, 226, 223, 1, 0,
37, 1, 0, 0, 0, 210, 211, 5, 31, 0, 0, 211, 39, 1, 0, 0, 0, 212, 213, 5,
51, 0, 0, 213, 214, 5, 50, 0, 0, 214, 41, 1, 0, 0, 0, 215, 216, 5, 51,
0, 0, 216, 43, 1, 0, 0, 0, 217, 226, 5, 15, 0, 0, 218, 219, 5, 42, 0, 0,
219, 220, 5, 41, 0, 0, 220, 227, 5, 42, 0, 0, 221, 222, 5, 42, 0, 0, 222,
227, 5, 41, 0, 0, 223, 224, 5, 41, 0, 0, 224, 227, 5, 42, 0, 0, 225, 227,
5, 42, 0, 0, 226, 218, 1, 0, 0, 0, 226, 221, 1, 0, 0, 0, 226, 223, 1, 0,
0, 0, 226, 225, 1, 0, 0, 0, 226, 227, 1, 0, 0, 0, 227, 228, 1, 0, 0, 0,
228, 229, 5, 37, 0, 0, 229, 45, 1, 0, 0, 0, 230, 232, 3, 48, 24, 0, 231,
228, 229, 5, 38, 0, 0, 229, 45, 1, 0, 0, 0, 230, 232, 3, 48, 24, 0, 231,
233, 3, 36, 18, 0, 232, 231, 1, 0, 0, 0, 232, 233, 1, 0, 0, 0, 233, 47,
1, 0, 0, 0, 234, 235, 6, 24, -1, 0, 235, 236, 5, 34, 0, 0, 236, 237, 3,
48, 24, 0, 237, 238, 5, 35, 0, 0, 238, 247, 1, 0, 0, 0, 239, 247, 3, 32,
1, 0, 0, 0, 234, 235, 6, 24, -1, 0, 235, 236, 5, 35, 0, 0, 236, 237, 3,
48, 24, 0, 237, 238, 5, 36, 0, 0, 238, 247, 1, 0, 0, 0, 239, 247, 3, 32,
16, 0, 240, 247, 3, 50, 25, 0, 241, 247, 3, 38, 19, 0, 242, 243, 3, 52,
26, 0, 243, 244, 3, 48, 24, 9, 244, 247, 1, 0, 0, 0, 245, 247, 3, 10, 5,
0, 246, 234, 1, 0, 0, 0, 246, 239, 1, 0, 0, 0, 246, 240, 1, 0, 0, 0, 246,
241, 1, 0, 0, 0, 246, 242, 1, 0, 0, 0, 246, 245, 1, 0, 0, 0, 247, 275,
1, 0, 0, 0, 248, 249, 10, 8, 0, 0, 249, 250, 5, 13, 0, 0, 250, 274, 3,
1, 0, 0, 0, 248, 249, 10, 8, 0, 0, 249, 250, 5, 16, 0, 0, 250, 274, 3,
48, 24, 9, 251, 252, 10, 7, 0, 0, 252, 253, 7, 4, 0, 0, 253, 274, 3, 48,
24, 8, 254, 255, 10, 6, 0, 0, 255, 256, 7, 2, 0, 0, 256, 274, 3, 48, 24,
7, 257, 258, 10, 5, 0, 0, 258, 259, 7, 5, 0, 0, 259, 274, 3, 48, 24, 6,
260, 261, 10, 4, 0, 0, 261, 262, 7, 6, 0, 0, 262, 274, 3, 48, 24, 5, 263,
267, 10, 3, 0, 0, 264, 268, 5, 48, 0, 0, 265, 268, 5, 47, 0, 0, 266, 268,
267, 10, 3, 0, 0, 264, 268, 5, 49, 0, 0, 265, 268, 5, 48, 0, 0, 266, 268,
1, 0, 0, 0, 267, 264, 1, 0, 0, 0, 267, 265, 1, 0, 0, 0, 267, 266, 1, 0,
0, 0, 268, 269, 1, 0, 0, 0, 269, 274, 3, 48, 24, 4, 270, 271, 10, 2, 0,
0, 271, 272, 5, 19, 0, 0, 272, 274, 3, 48, 24, 3, 273, 248, 1, 0, 0, 0,
0, 271, 272, 5, 22, 0, 0, 272, 274, 3, 48, 24, 3, 273, 248, 1, 0, 0, 0,
273, 251, 1, 0, 0, 0, 273, 254, 1, 0, 0, 0, 273, 257, 1, 0, 0, 0, 273,
260, 1, 0, 0, 0, 273, 263, 1, 0, 0, 0, 273, 270, 1, 0, 0, 0, 274, 277,
1, 0, 0, 0, 275, 273, 1, 0, 0, 0, 275, 276, 1, 0, 0, 0, 276, 49, 1, 0,
@ -243,37 +243,38 @@ const (
SLQParserT__18 = 19
SLQParserT__19 = 20
SLQParserT__20 = 21
SLQParserPROPRIETARY_FUNC_NAME = 22
SLQParserJOIN_TYPE = 23
SLQParserWHERE = 24
SLQParserGROUP_BY = 25
SLQParserORDER_ASC = 26
SLQParserORDER_DESC = 27
SLQParserORDER_BY = 28
SLQParserALIAS_RESERVED = 29
SLQParserARG = 30
SLQParserNULL = 31
SLQParserID = 32
SLQParserWS = 33
SLQParserLPAR = 34
SLQParserRPAR = 35
SLQParserLBRA = 36
SLQParserRBRA = 37
SLQParserCOMMA = 38
SLQParserPIPE = 39
SLQParserCOLON = 40
SLQParserNN = 41
SLQParserNUMBER = 42
SLQParserLT_EQ = 43
SLQParserLT = 44
SLQParserGT_EQ = 45
SLQParserGT = 46
SLQParserNEQ = 47
SLQParserEQ = 48
SLQParserNAME = 49
SLQParserHANDLE = 50
SLQParserSTRING = 51
SLQParserLINECOMMENT = 52
SLQParserT__21 = 22
SLQParserT__22 = 23
SLQParserT__23 = 24
SLQParserPROPRIETARY_FUNC_NAME = 25
SLQParserJOIN_TYPE = 26
SLQParserWHERE = 27
SLQParserGROUP_BY = 28
SLQParserORDER_BY = 29
SLQParserALIAS_RESERVED = 30
SLQParserARG = 31
SLQParserNULL = 32
SLQParserID = 33
SLQParserWS = 34
SLQParserLPAR = 35
SLQParserRPAR = 36
SLQParserLBRA = 37
SLQParserRBRA = 38
SLQParserCOMMA = 39
SLQParserPIPE = 40
SLQParserCOLON = 41
SLQParserNN = 42
SLQParserNUMBER = 43
SLQParserLT_EQ = 44
SLQParserLT = 45
SLQParserGT_EQ = 46
SLQParserGT = 47
SLQParserNEQ = 48
SLQParserEQ = 49
SLQParserNAME = 50
SLQParserHANDLE = 51
SLQParserSTRING = 52
SLQParserLINECOMMENT = 53
)
// SLQParser rules.
@ -1627,7 +1628,7 @@ func (p *SLQParser) Func_() (localctx IFuncContext) {
goto errorExit
}
switch p.GetTokenStream().LA(1) {
case SLQParserT__2, SLQParserT__3, SLQParserT__4, SLQParserT__5, SLQParserT__6, SLQParserT__7, SLQParserT__19, SLQParserT__20, SLQParserPROPRIETARY_FUNC_NAME, SLQParserORDER_ASC, SLQParserORDER_DESC, SLQParserARG, SLQParserNULL, SLQParserLPAR, SLQParserNN, SLQParserNUMBER, SLQParserNAME, SLQParserSTRING:
case SLQParserT__2, SLQParserT__3, SLQParserT__4, SLQParserT__5, SLQParserT__6, SLQParserT__7, SLQParserT__8, SLQParserT__12, SLQParserT__13, SLQParserT__22, SLQParserT__23, SLQParserPROPRIETARY_FUNC_NAME, SLQParserARG, SLQParserNULL, SLQParserLPAR, SLQParserNN, SLQParserNUMBER, SLQParserNAME, SLQParserSTRING:
{
p.SetState(114)
p.expr(0)
@ -1787,7 +1788,7 @@ func (p *SLQParser) FuncName() (localctx IFuncNameContext) {
p.SetState(127)
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4194808) != 0) {
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&33555448) != 0) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -2250,7 +2251,7 @@ func (p *SLQParser) UniqueFunc() (localctx IUniqueFuncContext) {
p.SetState(145)
_la = p.GetTokenStream().LA(1)
if !(_la == SLQParserT__8 || _la == SLQParserT__9) {
if !(_la == SLQParserT__9 || _la == SLQParserT__10) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -2398,7 +2399,7 @@ func (p *SLQParser) CountFunc() (localctx ICountFuncContext) {
p.EnterOuterAlt(localctx, 1)
{
p.SetState(147)
p.Match(SLQParserT__10)
p.Match(SLQParserT__11)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -2608,7 +2609,7 @@ func (p *SLQParser) Where() (localctx IWhereContext) {
}
_la = p.GetTokenStream().LA(1)
if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2821367446635000) != 0 {
if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&5642734534681592) != 0 {
{
p.SetState(160)
p.expr(0)
@ -2763,7 +2764,7 @@ func (p *SLQParser) GroupByTerm() (localctx IGroupByTermContext) {
p.Selector()
}
case SLQParserT__2, SLQParserT__3, SLQParserT__4, SLQParserT__5, SLQParserT__6, SLQParserT__7, SLQParserPROPRIETARY_FUNC_NAME:
case SLQParserT__2, SLQParserT__3, SLQParserT__4, SLQParserT__5, SLQParserT__6, SLQParserT__7, SLQParserT__8, SLQParserPROPRIETARY_FUNC_NAME:
p.EnterOuterAlt(localctx, 2)
{
p.SetState(166)
@ -3016,8 +3017,6 @@ type IOrderByTermContext interface {
// Getter signatures
Selector() ISelectorContext
ORDER_ASC() antlr.TerminalNode
ORDER_DESC() antlr.TerminalNode
// IsOrderByTermContext differentiates from other interfaces.
IsOrderByTermContext()
@ -3071,14 +3070,6 @@ func (s *OrderByTermContext) Selector() ISelectorContext {
return t.(ISelectorContext)
}
func (s *OrderByTermContext) ORDER_ASC() antlr.TerminalNode {
return s.GetToken(SLQParserORDER_ASC, 0)
}
func (s *OrderByTermContext) ORDER_DESC() antlr.TerminalNode {
return s.GetToken(SLQParserORDER_DESC, 0)
}
func (s *OrderByTermContext) GetRuleContext() antlr.RuleContext {
return s
}
@ -3126,12 +3117,12 @@ func (p *SLQParser) OrderByTerm() (localctx IOrderByTermContext) {
}
_la = p.GetTokenStream().LA(1)
if _la == SLQParserORDER_ASC || _la == SLQParserORDER_DESC {
if _la == SLQParserT__12 || _la == SLQParserT__13 {
{
p.SetState(182)
_la = p.GetTokenStream().LA(1)
if !(_la == SLQParserORDER_ASC || _la == SLQParserORDER_DESC) {
if !(_la == SLQParserT__12 || _la == SLQParserT__13) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -3785,7 +3776,7 @@ func (p *SLQParser) Alias() (localctx IAliasContext) {
p.SetState(207)
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2251805182394368) != 0) {
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4503610364788736) != 0) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -4243,7 +4234,7 @@ func (p *SLQParser) RowRange() (localctx IRowRangeContext) {
p.EnterOuterAlt(localctx, 1)
{
p.SetState(217)
p.Match(SLQParserT__11)
p.Match(SLQParserT__14)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -4519,8 +4510,6 @@ type IExprContext interface {
Arg() IArgContext
UnaryOperator() IUnaryOperatorContext
Func_() IFuncContext
ORDER_ASC() antlr.TerminalNode
ORDER_DESC() antlr.TerminalNode
LT() antlr.TerminalNode
LT_EQ() antlr.TerminalNode
GT() antlr.TerminalNode
@ -4693,14 +4682,6 @@ func (s *ExprContext) Func_() IFuncContext {
return t.(IFuncContext)
}
func (s *ExprContext) ORDER_ASC() antlr.TerminalNode {
return s.GetToken(SLQParserORDER_ASC, 0)
}
func (s *ExprContext) ORDER_DESC() antlr.TerminalNode {
return s.GetToken(SLQParserORDER_DESC, 0)
}
func (s *ExprContext) LT() antlr.TerminalNode {
return s.GetToken(SLQParserLT, 0)
}
@ -4820,7 +4801,7 @@ func (p *SLQParser) expr(_p int) (localctx IExprContext) {
p.Arg()
}
case SLQParserT__19, SLQParserT__20, SLQParserORDER_ASC, SLQParserORDER_DESC:
case SLQParserT__12, SLQParserT__13, SLQParserT__22, SLQParserT__23:
{
p.SetState(242)
p.UnaryOperator()
@ -4830,7 +4811,7 @@ func (p *SLQParser) expr(_p int) (localctx IExprContext) {
p.expr(9)
}
case SLQParserT__2, SLQParserT__3, SLQParserT__4, SLQParserT__5, SLQParserT__6, SLQParserT__7, SLQParserPROPRIETARY_FUNC_NAME:
case SLQParserT__2, SLQParserT__3, SLQParserT__4, SLQParserT__5, SLQParserT__6, SLQParserT__7, SLQParserT__8, SLQParserPROPRIETARY_FUNC_NAME:
{
p.SetState(245)
p.Func_()
@ -4874,7 +4855,7 @@ func (p *SLQParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(249)
p.Match(SLQParserT__12)
p.Match(SLQParserT__15)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -4898,7 +4879,7 @@ func (p *SLQParser) expr(_p int) (localctx IExprContext) {
p.SetState(252)
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&49156) != 0) {
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&393220) != 0) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -4923,7 +4904,7 @@ func (p *SLQParser) expr(_p int) (localctx IExprContext) {
p.SetState(255)
_la = p.GetTokenStream().LA(1)
if !(_la == SLQParserORDER_ASC || _la == SLQParserORDER_DESC) {
if !(_la == SLQParserT__12 || _la == SLQParserT__13) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -4948,7 +4929,7 @@ func (p *SLQParser) expr(_p int) (localctx IExprContext) {
p.SetState(258)
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&458752) != 0) {
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3670016) != 0) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -4973,7 +4954,7 @@ func (p *SLQParser) expr(_p int) (localctx IExprContext) {
p.SetState(261)
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&131941395333120) != 0) {
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&263882790666240) != 0) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -5021,7 +5002,7 @@ func (p *SLQParser) expr(_p int) (localctx IExprContext) {
}
}
case SLQParserT__2, SLQParserT__3, SLQParserT__4, SLQParserT__5, SLQParserT__6, SLQParserT__7, SLQParserT__19, SLQParserT__20, SLQParserPROPRIETARY_FUNC_NAME, SLQParserORDER_ASC, SLQParserORDER_DESC, SLQParserARG, SLQParserNULL, SLQParserLPAR, SLQParserNN, SLQParserNUMBER, SLQParserNAME, SLQParserSTRING:
case SLQParserT__2, SLQParserT__3, SLQParserT__4, SLQParserT__5, SLQParserT__6, SLQParserT__7, SLQParserT__8, SLQParserT__12, SLQParserT__13, SLQParserT__22, SLQParserT__23, SLQParserPROPRIETARY_FUNC_NAME, SLQParserARG, SLQParserNULL, SLQParserLPAR, SLQParserNN, SLQParserNUMBER, SLQParserNAME, SLQParserSTRING:
default:
p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
@ -5043,7 +5024,7 @@ func (p *SLQParser) expr(_p int) (localctx IExprContext) {
}
{
p.SetState(271)
p.Match(SLQParserT__18)
p.Match(SLQParserT__21)
if p.HasError() {
// Recognition error - abort rule
goto errorExit
@ -5188,7 +5169,7 @@ func (p *SLQParser) Literal() (localctx ILiteralContext) {
p.SetState(278)
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2258399030935552) != 0) {
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&4516798061871104) != 0) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)
@ -5215,11 +5196,6 @@ type IUnaryOperatorContext interface {
// GetParser returns the parser.
GetParser() antlr.Parser
// Getter signatures
ORDER_DESC() antlr.TerminalNode
ORDER_ASC() antlr.TerminalNode
// IsUnaryOperatorContext differentiates from other interfaces.
IsUnaryOperatorContext()
}
@ -5255,15 +5231,6 @@ func NewUnaryOperatorContext(parser antlr.Parser, parent antlr.ParserRuleContext
}
func (s *UnaryOperatorContext) GetParser() antlr.Parser { return s.parser }
func (s *UnaryOperatorContext) ORDER_DESC() antlr.TerminalNode {
return s.GetToken(SLQParserORDER_DESC, 0)
}
func (s *UnaryOperatorContext) ORDER_ASC() antlr.TerminalNode {
return s.GetToken(SLQParserORDER_ASC, 0)
}
func (s *UnaryOperatorContext) GetRuleContext() antlr.RuleContext {
return s
}
@ -5304,7 +5271,7 @@ func (p *SLQParser) UnaryOperator() (localctx IUnaryOperatorContext) {
p.SetState(280)
_la = p.GetTokenStream().LA(1)
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&204472320) != 0) {
if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&25190400) != 0) {
p.GetErrorHandler().RecoverInline(p)
} else {
p.GetErrorHandler().ReportMatch(p)

View File

@ -2,6 +2,7 @@ package ast
import (
"fmt"
"io"
"reflect"
"strings"
@ -175,6 +176,20 @@ func nodesAreOnlyOfType(nodes []Node, types ...reflect.Type) error {
return nil
}
// NodeRoot returns the root node of the tree containing node.
// This returned node should be an *ast.AST.
func NodeRoot(node Node) Node {
if node == nil {
return nil
}
if node.Parent() == nil {
return node
}
return NodeRoot(node.Parent())
}
// NodeNextSibling returns the node's next sibling, or nil.
func NodeNextSibling(node Node) Node {
if node == nil {
@ -323,6 +338,33 @@ func NodeUnwrap[T Node](node Node) (T, bool) {
}
}
// FindNodes returns the nodes of type T in ast.
func FindNodes[T Node](ast *AST) []T {
var nodes []T
w := NewWalker(ast)
w.AddVisitor(reflect.TypeOf((*T)(nil)).Elem(), func(w *Walker, node Node) error {
nodes = append(nodes, node.(T))
return nil
})
_ = w.Walk()
return nodes
}
// FindFirstNode returns the first node of type T in ast, or
// nil if no such node exists.
func FindFirstNode[T Node](ast *AST) T {
var node T
w := NewWalker(ast)
w.AddVisitor(reflect.TypeOf((*T)(nil)).Elem(), func(w *Walker, n Node) error {
node, _ = n.(T)
return io.EOF // Return any error to halt the walk.
})
_ = w.Walk()
return node
}
// Results from reflect.TypeOf for node types.
var (
typeAST = reflect.TypeOf((*AST)(nil))

View File

@ -35,9 +35,7 @@ func TestNodesWithType(t *testing.T) {
func TestNodePrevNextSibling(t *testing.T) {
const in = `@sakila | .actor | .actor_id == 2`
log := slogt.New(t)
a, err := Parse(log, in)
require.NoError(t, err)
@ -82,3 +80,13 @@ func TestNodeUnwrap(t *testing.T) {
require.False(t, ok, "should fail because exprB has multiple children")
require.Nil(t, gotLit)
}
func TestFindNodes(t *testing.T) {
const in = `@sakila | .actor | .actor_id == 2 | .actor_id, .first_name, .last_name`
a, err := Parse(slogt.New(t), in)
require.NoError(t, err)
handles := FindNodes[*HandleNode](a)
require.Len(t, handles, 1)
require.Equal(t, "@sakila", handles[0].Handle())
}

View File

@ -1,6 +1,10 @@
package ast
import "github.com/neilotoole/sq/libsq/ast/internal/slq"
import (
"strings"
"github.com/neilotoole/sq/libsq/ast/internal/slq"
)
// OrderByNode implements the SQL "ORDER BY" clause.
type OrderByNode struct {
@ -142,19 +146,20 @@ func (v *parseTreeVisitor) VisitOrderByTerm(ctx *slq.OrderByTermContext) interfa
node.parent = v.cur
node.ctx = ctx
node.text = ctx.GetText()
if strings.HasSuffix(node.text, "+") {
node.text = strings.TrimSuffix(node.text, "+")
node.direction = OrderByDirectionAsc
} else if strings.HasSuffix(node.text, "-") {
node.text = strings.TrimSuffix(node.text, "-")
node.direction = OrderByDirectionDesc
}
selNode, err := newSelectorNode(node, ctx.Selector())
if err != nil {
return nil
}
if ctx.ORDER_ASC() != nil {
node.direction = OrderByDirectionAsc
} else if ctx.ORDER_DESC() != nil {
node.direction = OrderByDirectionDesc
}
if err := node.AddChild(selNode); err != nil {
if err = node.AddChild(selNode); err != nil {
return err
}

View File

@ -57,7 +57,14 @@ func doExpr(rc *Context, expr *ast.ExprNode) (string, error) {
return "", err
}
sb.WriteString(val)
case *ast.FuncNode:
val, err := r.Function(rc, child)
if err != nil {
return "", err
}
sb.WriteString(val)
default:
// FIXME: Should log a warning here
// Shouldn't happen? Need to investigate.
sb.WriteString(child.Text())
}

View File

@ -91,3 +91,20 @@ func doFunction(rc *Context, fn *ast.FuncNode) (string, error) {
sql := sb.String()
return sql, nil
}
// doFuncRowNum renders the rownum() function.
func doFuncRowNum(rc *Context, fn *ast.FuncNode) (string, error) {
a, _ := ast.NodeRoot(fn).(*ast.AST)
obNode := ast.FindFirstNode[*ast.OrderByNode](a)
if obNode != nil {
obClause, err := rc.Renderer.OrderBy(rc, obNode)
if err != nil {
return "", err
}
return "(row_number() OVER (" + obClause + "))", nil
}
// It's not entirely clear that this "ORDER BY 1" mechanism
// is the correct approach, but it seems to work for SQLite and Postgres.
return "(row_number() OVER (ORDER BY 1))", nil
}

View File

@ -39,9 +39,9 @@ func doJoin(rc *Context, leftTbl *ast.TblSelectorNode, joins []*ast.JoinNode) (s
}
sql := "FROM "
sql = sqlAppend(sql, leftTbl.Table().Render(enquote))
sql = AppendSQL(sql, leftTbl.Table().Render(enquote))
if leftTbl.Alias() != "" {
sql = sqlAppend(sql, "AS "+enquote(leftTbl.Alias()))
sql = AppendSQL(sql, "AS "+enquote(leftTbl.Alias()))
}
for i, join := range joins {
@ -57,9 +57,9 @@ func doJoin(rc *Context, leftTbl *ast.TblSelectorNode, joins []*ast.JoinNode) (s
}
tbl := join.Table()
s = sqlAppend(s, tbl.Table().Render(enquote))
s = AppendSQL(s, tbl.Table().Render(enquote))
if tbl.Alias() != "" {
s = sqlAppend(s, "AS "+enquote(tbl.Alias()))
s = AppendSQL(s, "AS "+enquote(tbl.Alias()))
}
if expr := join.Predicate(); expr != nil {
@ -68,7 +68,7 @@ func doJoin(rc *Context, leftTbl *ast.TblSelectorNode, joins []*ast.JoinNode) (s
join.JoinType(), join.Text())
}
s = sqlAppend(s, "ON")
s = AppendSQL(s, "ON")
// Special handling for: .left_tbl | join(.right_tbl, .col)
// This is rendered as:
@ -81,8 +81,8 @@ func doJoin(rc *Context, leftTbl *ast.TblSelectorNode, joins []*ast.JoinNode) (s
text := allTbls[i].TblAliasOrName().Render(enquote) + "." + enquote(colName)
text += " = "
text += allTbls[i+1].TblAliasOrName().Render(enquote) + "." + enquote(colName)
s = sqlAppend(s, text)
sql = sqlAppend(sql, s)
s = AppendSQL(s, text)
sql = AppendSQL(sql, s)
continue
}
}
@ -92,10 +92,10 @@ func doJoin(rc *Context, leftTbl *ast.TblSelectorNode, joins []*ast.JoinNode) (s
return "", err
}
s = sqlAppend(s, text)
s = AppendSQL(s, text)
}
sql = sqlAppend(sql, s)
sql = AppendSQL(sql, s)
}
return sql, nil

View File

@ -31,6 +31,6 @@ func doRange(_ *Context, rr *ast.RowRangeNode) (string, error) {
}
}
sql := sqlAppend(limit, offset)
sql := AppendSQL(limit, offset)
return sql, nil
}

View File

@ -20,6 +20,11 @@ type Context struct {
// The args map contains predefined variables that are
// substituted into the query. It may be empty or nil.
Args map[string]string
// Fragments is the set of fragments that are rendered into
// a SQL query. It may not be initialized until late in
// the day.
Fragments *Fragments
}
// Renderer is a set of functions for rendering ast elements into SQL.
@ -76,9 +81,9 @@ type Renderer struct {
// empty string if n is nil.
Distinct func(rc *Context, n *ast.UniqueNode) (string, error)
// PreRender is a hook that is called before Render. It is a final
// PreRender is a set of hooks that are called before Render. It is a final
// opportunity to customize f before rendering. It is nil by default.
PreRender func(rc *Context, f *Fragments) error
PreRender []func(rc *Context, f *Fragments) error
// Render renders f into a SQL query.
Render func(rc *Context, f *Fragments) (string, error)
@ -89,27 +94,41 @@ type Renderer struct {
// as needed.
func NewDefaultRenderer() *Renderer {
return &Renderer{
FromTable: doFromTable,
SelectCols: doSelectCols,
Range: doRange,
OrderBy: doOrderBy,
GroupBy: doGroupBy,
Join: doJoin,
Function: doFunction,
FunctionOverrides: map[string]func(rc *Context, fn *ast.FuncNode) (string, error){},
FunctionNames: map[string]string{},
Literal: doLiteral,
Where: doWhere,
Expr: doExpr,
Operator: doOperator,
Distinct: doDistinct,
Render: doRender,
FromTable: doFromTable,
SelectCols: doSelectCols,
Range: doRange,
OrderBy: doOrderBy,
GroupBy: doGroupBy,
Join: doJoin,
Function: doFunction,
FunctionOverrides: map[string]func(rc *Context, fn *ast.FuncNode) (string, error){
ast.FuncNameRowNum: doFuncRowNum,
},
FunctionNames: map[string]string{},
Literal: doLiteral,
Where: doWhere,
Expr: doExpr,
Operator: doOperator,
Distinct: doDistinct,
Render: doRender,
}
}
// Fragments holds the fragments of a SQL query.
// It is passed to Renderer.PreRender and Renderer.Render.
type Fragments struct {
// PreExecStmts are statements that are executed before the query.
// These can be used for edge-case behavior, such as setting up
// variables in the session.
//
// See also: Fragments.PostExecStmts.
PreExecStmts []string
// PostExecStmts are statements that are executed after the query.
//
// See also: Fragments.PreExecStmts.
PostExecStmts []string
Distinct string
Columns string
From string
@ -119,7 +138,7 @@ type Fragments struct {
Range string
}
// Render implements QueryBuilder.
// doRender renders the supplied fragments into a SQL query.
func doRender(_ *Context, f *Fragments) (string, error) {
sb := strings.Builder{}
@ -185,13 +204,13 @@ func renderSelectorNode(d dialect.Dialect, node ast.Node) (string, error) {
}
}
// sqlAppend is a convenience function for building the SQL string.
// AppendSQL is a convenience function for building the SQL string.
// The main purpose is to ensure that there's always a consistent amount
// of whitespace. Thus, if existing has a space suffix and add has a
// space prefix, the returned string will only have one space. If add
// is the empty string or just whitespace, this function simply
// returns existing.
func sqlAppend(existing, add string) string {
func AppendSQL(existing, add string) string {
add = strings.TrimSpace(add)
if add == "" {
return existing
@ -220,3 +239,10 @@ func unquoteLiteral(s string) (val string, ok bool, err error) {
return s, false, nil
}
// FuncOverrideString returns a function that always returns s.
func FuncOverrideString(s string) func(*Context, *ast.FuncNode) (string, error) {
return func(_ *Context, _ *ast.FuncNode) (string, error) {
return s, nil
}
}

View File

@ -51,8 +51,7 @@ func (w *Walker) visit(node Node) error {
}
for _, visitFn := range visitFns {
err := visitFn(w, node)
if err != nil {
if err := visitFn(w, node); err != nil {
return err
}
}

View File

@ -5,6 +5,7 @@ package lgm
const (
CloseDB = "Close DB"
CloseConn = "Close SQL connection"
CloseDBRows = "Close DB rows"
CloseDBStmt = "Close DB stmt"
CloseFileReader = "Close file reader"

View File

@ -38,6 +38,19 @@ type QueryContext struct {
// Args defines variables that are substituted into the query.
// May be nil or empty.
Args map[string]string
// PreExecStmts are statements that are executed before the query.
// These can be used for edge-case behavior, such as setting up
// variables in the session. These stmts are typically loaded
// from render.Fragments.PreExecStmts.
//
// See also: QueryContext.PostExecStmts.
PreExecStmts []string
// PostExecStmts are statements that are executed after the query.
//
// See also: QueryContext.PreExecStmts.
PostExecStmts []string
}
// RecordWriter is the interface for writing records to a

View File

@ -2,6 +2,7 @@ package libsq
import (
"context"
"database/sql"
"fmt"
"github.com/samber/lo"
@ -12,6 +13,7 @@ import (
"github.com/neilotoole/sq/libsq/core/errz"
"github.com/neilotoole/sq/libsq/core/lg"
"github.com/neilotoole/sq/libsq/core/lg/lga"
"github.com/neilotoole/sq/libsq/core/lg/lgm"
"github.com/neilotoole/sq/libsq/core/options"
"github.com/neilotoole/sq/libsq/core/record"
"github.com/neilotoole/sq/libsq/core/sqlmodel"
@ -78,17 +80,60 @@ func newPipeline(ctx context.Context, qc *QueryContext, query string) (*pipeline
// execute executes the pipeline, writing results to recw.
func (p *pipeline) execute(ctx context.Context, recw RecordWriter) error {
lg.FromContext(ctx).Debug(
log := lg.FromContext(ctx)
log.Debug(
"Execute SQL query",
lga.Src, p.targetPool.Source(),
lga.SQL, p.targetSQL,
)
errw := p.targetPool.SQLDriver().ErrWrapFunc()
// TODO: The tasks might like to be executed in parallel. However,
// what happens if a task does something that is session/connection-dependent?
// When the query executes later (below), it could be on a different
// connection. Maybe the tasks need a means of declaring that they
// hae to be run on the same connection as the main query?
if err := p.executeTasks(ctx); err != nil {
return errw(err)
}
var conn sqlz.DB
if len(p.qc.PreExecStmts) > 0 || len(p.qc.PostExecStmts) > 0 {
// If there's pre/post exec work to do, we need to
// obtain a connection from the pool. We are responsible
// for closing these resources.
db, err := p.targetPool.DB(ctx)
if err != nil {
return errw(err)
}
defer lg.WarnIfCloseError(log, lgm.CloseDB, db)
if conn, err = db.Conn(ctx); err != nil {
return errw(err)
}
defer lg.WarnIfCloseError(log, lgm.CloseConn, conn.(*sql.Conn))
for _, stmt := range p.qc.PreExecStmts {
if _, err = conn.ExecContext(ctx, stmt); err != nil {
return errw(err)
}
}
}
if err := QuerySQL(ctx, p.targetPool, conn, recw, p.targetSQL); err != nil {
return err
}
return QuerySQL(ctx, p.targetPool, nil, recw, p.targetSQL)
if conn != nil && len(p.qc.PostExecStmts) > 0 {
for _, stmt := range p.qc.PostExecStmts {
if _, err := conn.ExecContext(ctx, stmt); err != nil {
return errw(err)
}
}
}
return nil
}
// executeTasks executes any tasks in pipeline.tasks.

View File

@ -12,10 +12,9 @@ import (
// against targetPool before targetSQL is executed (the pipeline.execute
// method does this work).
func (p *pipeline) prepare(ctx context.Context, qm *queryModel) error {
var (
err error
frags = &render.Fragments{}
)
var err error
frags := &render.Fragments{}
// After this switch, p.rc will be set.
switch {
@ -34,6 +33,7 @@ func (p *pipeline) prepare(ctx context.Context, qm *queryModel) error {
}
}
p.rc.Fragments = frags
rndr := p.rc.Renderer
if frags.Columns, err = rndr.SelectCols(p.rc, qm.Cols); err != nil {
return err
@ -69,12 +69,18 @@ func (p *pipeline) prepare(ctx context.Context, qm *queryModel) error {
}
}
if rndr.PreRender != nil {
if err = rndr.PreRender(p.rc, frags); err != nil {
for _, fn := range rndr.PreRender {
if err = fn(p.rc, frags); err != nil {
return err
}
}
p.targetSQL, err = rndr.Render(p.rc, frags)
return err
if p.targetSQL, err = rndr.Render(p.rc, frags); err != nil {
return err
}
p.qc.PreExecStmts = append(p.qc.PreExecStmts, frags.PreExecStmts...)
p.qc.PostExecStmts = append(p.qc.PostExecStmts, frags.PostExecStmts...)
return nil
}

View File

@ -260,3 +260,90 @@ func TestQuery_func_catalog(t *testing.T) {
})
}
}
//nolint:lll,exhaustive
func TestQuery_func_rownum(t *testing.T) {
testCases := []queryTestCase{
{
name: "plain",
in: `@sakila | .actor | rownum()`,
wantSQL: `SELECT (row_number() OVER (ORDER BY 1)) AS "rownum()" FROM "actor"`,
override: driverMap{
sqlserver.Type: `SELECT (row_number() OVER (ORDER BY (SELECT NULL))) AS "rownum()" FROM "actor"`,
// We don't test the MySQL override because it uses a randomly generated variable value. E.g.
// SELECT (@row_number_dw5ch2ss:=@row_number_dw5ch2ss + 1) AS `rownum()` FROM `actor`
mysql.Type: ``,
},
wantRecCount: 200,
sinkFns: []SinkTestFunc{
assertSinkColName(0, "rownum()"),
assertSinkCellValue(0, 0, int64(1)),
assertSinkCellValue(199, 0, int64(200)),
},
},
{
name: "plus_1",
in: `@sakila | .actor | rownum() + 1`,
wantSQL: `SELECT (row_number() OVER (ORDER BY 1))+1 AS "rownum()+1" FROM "actor"`,
override: driverMap{
sqlserver.Type: `SELECT (row_number() OVER (ORDER BY (SELECT NULL)))+1 AS "rownum()+1" FROM "actor"`,
mysql.Type: "",
},
wantRecCount: 200,
sinkFns: []SinkTestFunc{
assertSinkColName(0, "rownum()+1"),
assertSinkCellValue(0, 0, int64(2)),
assertSinkCellValue(199, 0, int64(201)),
},
},
{
name: "minus_1_alias",
in: `@sakila | .actor | (rownum()-1):zero_index`,
wantSQL: `SELECT ((row_number() OVER (ORDER BY 1))-1) AS "zero_index" FROM "actor"`,
override: driverMap{
sqlserver.Type: `SELECT ((row_number() OVER (ORDER BY (SELECT NULL)))-1) AS "zero_index" FROM "actor"`,
mysql.Type: "",
},
wantRecCount: 200,
sinkFns: []SinkTestFunc{
assertSinkColName(0, "zero_index"),
assertSinkCellValue(0, 0, int64(0)),
assertSinkCellValue(199, 0, int64(199)),
},
},
{
name: "column_orderby",
in: `@sakila | .actor | rownum(), .actor_id | order_by(.actor_id)`,
wantSQL: `SELECT (row_number() OVER (ORDER BY "actor_id")) AS "rownum()", "actor_id" FROM "actor" ORDER BY "actor_id"`,
override: driverMap{mysql.Type: ""},
wantRecCount: 200,
sinkFns: []SinkTestFunc{
assertSinkColName(0, "rownum()"),
assertSinkCellValue(0, 0, int64(1)),
assertSinkCellValue(199, 0, int64(200)),
},
},
{
name: "double_invocation",
in: `@sakila | .actor | rownum():index1, .actor_id, rownum():index2 | order_by(.actor_id)`,
wantSQL: `SELECT (row_number() OVER (ORDER BY "actor_id")) AS "index1", "actor_id", (row_number() OVER (ORDER BY "actor_id")) AS "index2" FROM "actor" ORDER BY "actor_id"`,
override: driverMap{mysql.Type: ""},
wantRecCount: 200,
sinkFns: []SinkTestFunc{
assertSinkColName(0, "index1"),
assertSinkColName(2, "index2"),
assertSinkCellValue(0, 0, int64(1)),
assertSinkCellValue(0, 2, int64(1)),
assertSinkCellValue(199, 0, int64(200)),
assertSinkCellValue(199, 2, int64(200)),
},
},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
execQueryTestCase(t, tc)
})
}
}

View File

@ -94,7 +94,6 @@ func execQueryTestCase(t *testing.T, tc queryTestCase) {
if tc.skip {
t.Skip()
}
t.Helper()
switch len(tc.repeatReplace) {
@ -207,21 +206,29 @@ func doExecQueryTestCase(t *testing.T, tc queryTestCase) {
}
}
// assertSinkCellValue returns a SinkTestFunc that asserts that
// the cell at rowi, coli matches val.
func assertSinkCellValue(rowi, coli int, val any) SinkTestFunc {
return func(t testing.TB, sink *testh.RecordSink) {
assert.Equal(t, val, sink.Recs[rowi][coli], "record[%d:%d] (%s)", rowi, coli, sink.RecMeta[coli].Name())
}
}
// assertSinkColValue returns a SinkTestFunc that asserts that
// the column colIndex of each record matches val.
func assertSinkColValue(colIndex int, val any) SinkTestFunc {
// the column with index coli of each record matches val.
func assertSinkColValue(coli int, val any) SinkTestFunc {
return func(t testing.TB, sink *testh.RecordSink) {
for rowi, rec := range sink.Recs {
assert.Equal(t, val, rec[colIndex], "record[%d:%d] (%s)", rowi, colIndex, sink.RecMeta[colIndex].Name())
assert.Equal(t, val, rec[coli], "record[%d:%d] (%s)", rowi, coli, sink.RecMeta[coli].Name())
}
}
}
// assertSinkColValue returns a SinkTestFunc that asserts that
// the name of column colIndex matches name.
func assertSinkColName(colIndex int, name string) SinkTestFunc { //nolint:unparam
// the name of column with index coli matches name.
func assertSinkColName(coli int, name string) SinkTestFunc {
return func(t testing.TB, sink *testh.RecordSink) {
assert.Equal(t, name, sink.RecMeta[colIndex].Name(), "column %d", colIndex)
assert.Equal(t, name, sink.RecMeta[coli].Name(), "column %d", coli)
}
}