Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run faild #936

Closed
abao2016 opened this issue Jul 18, 2020 · 3 comments
Closed

run faild #936

abao2016 opened this issue Jul 18, 2020 · 3 comments

Comments

@abao2016
Copy link

package main
import (
"fmt"
"github.com/pingcap/parser"
"github.com/pingcap/parser/ast"
_ "github.com/pingcap/tidb/types/parser_driver"

//
//"github.com/pingcap/tidb/types/parser_driver"
//_ "github.com/pingcap/parser/test_driver"

)

func parse(sql string) (*ast.StmtNode, error) {
p := parser.New()

stmtNodes, _, err := p.Parse(sql, "", "")
if err != nil {
	return nil, err
}

return &stmtNodes[0], nil

}

func main() {
astNode, err := parse("SELECT a, b FROM t")
if err != nil {
fmt.Printf("parse error: %v\n", err.Error())
return
}
fmt.Printf("%v\n", *astNode)
fmt.Println("sucesss")
}

github.com/pingcap/tidb/types/parser_driver
../../../../go/pkg/mod/github.com/pingcap/tidb@v0.0.0-20181120082053-012cb6da9443/types/parser_driver/value_expr.go:59:2: cannot use &ParamMarkerExpr literal (type *ParamMarkerExpr) as type ast.ParamMarkerExpr in assignment:
*ParamMarkerExpr does not implement ast.ParamMarkerExpr (missing Restore method)
../../../../go/pkg/mod/github.com/pingcap/tidb@v0.0.0-20181120082053-012cb6da9443/types/parser_driver/value_expr.go:60:2: cannot use &ValueExpr literal (type *ValueExpr) as type ast.ValueExpr in assignment:
*ValueExpr does not implement ast.ValueExpr (missing Restore method)
../../../../go/pkg/mod/github.com/pingcap/tidb@v0.0.0-20181120082053-012cb6da9443/types/parser_driver/value_expr.go:116:3: cannot use ve (type *ValueExpr) as type ast.ValueExpr in return argument:
*ValueExpr does not implement ast.ValueExpr (missing Restore method)
../../../../go/pkg/mod/github.com/pingcap/tidb@v0.0.0-20181120082053-012cb6da9443/types/parser_driver/value_expr.go:122:2: cannot use ve (type *ValueExpr) as type ast.ValueExpr in return argument:
*ValueExpr does not implement ast.ValueExpr (missing Restore method)
../../../../go/pkg/mod/github.com/pingcap/tidb@v0.0.0-20181120082053-012cb6da9443/types/parser_driver/value_expr.go:137:34: cannot use n (type *ValueExpr) as type ast.Node in argument to v.Enter:
*ValueExpr does not implement ast.Node (missing Restore method)
../../../../go/pkg/mod/github.com/pingcap/tidb@v0.0.0-20181120082053-012cb6da9443/types/parser_driver/value_expr.go:141:13: impossible type assertion:
*ValueExpr does not implement ast.Node (missing Restore method)
../../../../go/pkg/mod/github.com/pingcap/tidb@v0.0.0-20181120082053-012cb6da9443/types/parser_driver/value_expr.go:142:16: cannot use n (type *ValueExpr) as

@zimulala
Copy link
Contributor

PTAL @tangenta @kennytm

@tangenta
Copy link
Contributor

@abao2016 The git hash of TiDB dependency seems to be outdated.

Please follow the steps in quickstart to import the dependency. If it still does not work, see #812 for a temporary solution.

@tangenta
Copy link
Contributor

Duplicate with #812.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants