milvus/internal/parser/planparserv2/node_ret.go
Jiquan Long 98ceb162aa
Support antlr as plan parser (#16696)
Signed-off-by: dragondriver <jiquan.long@zilliz.com>

Co-authored-by: xaxys <tpnnghd@163.com>

Co-authored-by: xaxys <tpnnghd@163.com>
2022-05-06 17:43:51 +08:00

38 lines
664 B
Go

package planparserv2
import (
"github.com/milvus-io/milvus/internal/proto/planpb"
"github.com/milvus-io/milvus/internal/proto/schemapb"
)
type ExprWithType struct {
expr *planpb.Expr
dataType schemapb.DataType
}
func getError(obj interface{}) error {
err, ok := obj.(error)
if !ok {
// obj is not an error.
return nil
}
return err
}
func getExpr(obj interface{}) *ExprWithType {
n, ok := obj.(*ExprWithType)
if !ok {
// obj is not of *ExprWithType
return nil
}
return n
}
func getGenericValue(obj interface{}) *planpb.GenericValue {
expr := getExpr(obj)
if expr == nil {
return nil
}
return expr.expr.GetValueExpr().GetValue()
}