mirror of
https://github.com/pgsty/minio.git
synced 2026-08-09 07:43:29 +03:00
Add new SQL parser to support S3 Select syntax (#7102)
- New parser written from scratch, allows easier and complete parsing of the full S3 Select SQL syntax. Parser definition is directly provided by the AST defined for the SQL grammar. - Bring support to parse and interpret SQL involving JSON path expressions; evaluation of JSON path expressions will be subsequently added. - Bring automatic type inference and conversion for untyped values (e.g. CSV data).
This commit is contained in:
committed by
Harshavardhana
parent
0a28c28a8c
commit
2786055df4
+39
@@ -0,0 +1,39 @@
|
||||
package participle
|
||||
|
||||
import (
|
||||
"github.com/alecthomas/participle/lexer"
|
||||
)
|
||||
|
||||
// An Option to modify the behaviour of the Parser.
|
||||
type Option func(p *Parser) error
|
||||
|
||||
// Lexer is an Option that sets the lexer to use with the given grammar.
|
||||
func Lexer(def lexer.Definition) Option {
|
||||
return func(p *Parser) error {
|
||||
p.lex = def
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// UseLookahead allows branch lookahead up to "n" tokens.
|
||||
//
|
||||
// If parsing cannot be disambiguated before "n" tokens of lookahead, parsing will fail.
|
||||
//
|
||||
// Note that increasing lookahead has a minor performance impact, but also
|
||||
// reduces the accuracy of error reporting.
|
||||
func UseLookahead(n int) Option {
|
||||
return func(p *Parser) error {
|
||||
p.useLookahead = n
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// CaseInsensitive allows the specified token types to be matched case-insensitively.
|
||||
func CaseInsensitive(tokens ...string) Option {
|
||||
return func(p *Parser) error {
|
||||
for _, token := range tokens {
|
||||
p.caseInsensitive[token] = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user