From f33469d610e116865d6397d458510779741117c2 Mon Sep 17 00:00:00 2001 From: Cai Zhang Date: Tue, 8 Oct 2024 17:07:18 +0800 Subject: [PATCH] Support template to parse expression Signed-off-by: Cai Zhang --- go.mod | 2 +- go.sum | 2 + internal/parser/planparserv2/Plan.g4 | 19 +- .../planparserv2/check_identical_test.go | 4 +- .../convert_field_data_to_generic_value.go | 73 ++ ...onvert_field_data_to_generic_value_test.go | 286 +++++++ .../planparserv2/fill_expression_value.go | 227 +++++ .../fill_expression_value_test.go | 568 +++++++++++++ .../parser/planparserv2/generated/Plan.interp | 14 +- .../parser/planparserv2/generated/Plan.tokens | 125 +-- .../planparserv2/generated/PlanLexer.interp | 20 +- .../planparserv2/generated/PlanLexer.tokens | 125 +-- .../generated/plan_base_visitor.go | 12 +- .../planparserv2/generated/plan_lexer.go | 780 ++++++++--------- .../planparserv2/generated/plan_parser.go | 785 +++++++++--------- .../planparserv2/generated/plan_visitor.go | 9 +- internal/parser/planparserv2/node_ret.go | 12 + .../parser/planparserv2/parser_visitor.go | 537 ++++++------ .../parser/planparserv2/plan_parser_v2.go | 22 +- .../planparserv2/plan_parser_v2_test.go | 91 +- internal/parser/planparserv2/utils.go | 255 ++++-- internal/proto/plan.proto | 9 + internal/proxy/task.go | 1 + internal/proxy/task_delete.go | 2 +- internal/proxy/task_delete_test.go | 16 +- internal/proxy/task_query.go | 9 +- internal/proxy/task_query_test.go | 4 +- internal/proxy/task_search.go | 9 +- .../delegator/segment_pruner_test.go | 70 +- internal/util/exprutil/expr_checker_test.go | 16 +- 30 files changed, 2733 insertions(+), 1371 deletions(-) create mode 100644 internal/parser/planparserv2/convert_field_data_to_generic_value.go create mode 100644 internal/parser/planparserv2/convert_field_data_to_generic_value_test.go create mode 100644 internal/parser/planparserv2/fill_expression_value.go create mode 100644 internal/parser/planparserv2/fill_expression_value_test.go diff --git a/go.mod b/go.mod index 34e86eb2b6e81..c1aca473bcf38 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/klauspost/compress v1.17.9 github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d - github.com/milvus-io/milvus-proto/go-api/v2 v2.4.13 + github.com/milvus-io/milvus-proto/go-api/v2 v2.4.14-0.20241025033521-13fc3509ee0b github.com/minio/minio-go/v7 v7.0.73 github.com/pingcap/log v1.1.1-0.20221015072633-39906604fb81 github.com/prometheus/client_golang v1.14.0 diff --git a/go.sum b/go.sum index 88cdbc619f195..69eef3ac60a26 100644 --- a/go.sum +++ b/go.sum @@ -610,6 +610,8 @@ github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b h1:TfeY0NxYxZz github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b/go.mod h1:iwW+9cWfIzzDseEBCCeDSN5SD16Tidvy8cwQ7ZY8Qj4= github.com/milvus-io/milvus-proto/go-api/v2 v2.4.13 h1:79fAk5rUFNl7A5RhYUlxcZTHAY31lygULC6QUvpBrUo= github.com/milvus-io/milvus-proto/go-api/v2 v2.4.13/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs= +github.com/milvus-io/milvus-proto/go-api/v2 v2.4.14-0.20241025033521-13fc3509ee0b h1:Q4f3a6Y+HZFEadEx3pUXTZmBwrS3QRvkEHWNd8fjDtI= +github.com/milvus-io/milvus-proto/go-api/v2 v2.4.14-0.20241025033521-13fc3509ee0b/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs= github.com/milvus-io/milvus-storage/go v0.0.0-20231227072638-ebd0b8e56d70 h1:Z+sp64fmAOxAG7mU0dfVOXvAXlwRB0c8a96rIM5HevI= github.com/milvus-io/milvus-storage/go v0.0.0-20231227072638-ebd0b8e56d70/go.mod h1:GPETMcTZq1gLY1WA6Na5kiNAKnq8SEMMiVKUZrM3sho= github.com/milvus-io/pulsar-client-go v0.6.10 h1:eqpJjU+/QX0iIhEo3nhOqMNXL+TyInAs1IAHZCrCM/A= diff --git a/internal/parser/planparserv2/Plan.g4 b/internal/parser/planparserv2/Plan.g4 index cc8a479c3c347..c7c68ea0d1e20 100644 --- a/internal/parser/planparserv2/Plan.g4 +++ b/internal/parser/planparserv2/Plan.g4 @@ -5,10 +5,12 @@ expr: | FloatingConstant # Floating | BooleanConstant # Boolean | StringLiteral # String - | Identifier # Identifier + | (Identifier|Meta) # Identifier | JSONIdentifier # JSONIdentifier + | LBRACE Identifier RBRACE # TemplateVariable | '(' expr ')' # Parens | '[' expr (',' expr)* ','? ']' # Array + | EmptyArray # EmptyArray | expr LIKE StringLiteral # Like | expr POW expr # Power | op = (ADD | SUB | BNOT | NOT) expr # Unary @@ -16,8 +18,7 @@ expr: | expr op = (MUL | DIV | MOD) expr # MulDivMod | expr op = (ADD | SUB) expr # AddSub | expr op = (SHL | SHR) expr # Shift - | expr op = (IN | NIN) ('[' expr (',' expr)* ','? ']') # Term - | expr op = (IN | NIN) EmptyTerm # EmptyTerm + | expr op = NOT? IN expr # Term | (JSONContains | ArrayContains)'('expr',' expr')' # JSONContains | (JSONContainsAll | ArrayContainsAll)'('expr',' expr')' # JSONContainsAll | (JSONContainsAny | ArrayContainsAny)'('expr',' expr')' # JSONContainsAny @@ -42,6 +43,8 @@ expr: // INT64: 'int64'; // FLOAT: 'float'; // DOUBLE: 'double'; +LBRACE: '{'; +RBRACE: '}'; LT: '<'; LE: '<='; @@ -71,9 +74,8 @@ OR: '||' | 'or'; BNOT: '~'; NOT: '!' | 'not'; -IN: 'in'; -NIN: 'not in'; -EmptyTerm: '[' (Whitespace | Newline)* ']'; +IN: 'in' | 'IN'; +EmptyArray: '[' (Whitespace | Newline)* ']'; JSONContains: 'json_contains' | 'JSON_CONTAINS'; JSONContainsAll: 'json_contains_all' | 'JSON_CONTAINS_ALL'; @@ -96,10 +98,11 @@ FloatingConstant: DecimalFloatingConstant | HexadecimalFloatingConstant; -Identifier: Nondigit (Nondigit | Digit)* | '$meta'; +Identifier: Nondigit (Nondigit | Digit)*; +Meta: '$meta'; StringLiteral: EncodingPrefix? ('"' DoubleSCharSequence? '"' | '\'' SingleSCharSequence? '\''); -JSONIdentifier: Identifier('[' (StringLiteral | DecimalConstant) ']')+; +JSONIdentifier: (Identifier | Meta)('[' (StringLiteral | DecimalConstant) ']')+; fragment EncodingPrefix: 'u8' | 'u' | 'U' | 'L'; diff --git a/internal/parser/planparserv2/check_identical_test.go b/internal/parser/planparserv2/check_identical_test.go index 9f48aec504d8e..13b16925e4af4 100644 --- a/internal/parser/planparserv2/check_identical_test.go +++ b/internal/parser/planparserv2/check_identical_test.go @@ -17,9 +17,9 @@ func TestCheckIdentical(t *testing.T) { exprStr1 := `not (((Int64Field > 0) and (FloatField <= 20.0)) or ((Int32Field in [1, 2, 3]) and (VarCharField < "str")))` exprStr2 := `Int32Field in [1, 2, 3]` - expr1, err := ParseExpr(helper, exprStr1) + expr1, err := ParseExpr(helper, exprStr1, nil) assert.NoError(t, err) - expr2, err := ParseExpr(helper, exprStr2) + expr2, err := ParseExpr(helper, exprStr2, nil) assert.NoError(t, err) assert.True(t, CheckPredicatesIdentical(expr1, expr1)) diff --git a/internal/parser/planparserv2/convert_field_data_to_generic_value.go b/internal/parser/planparserv2/convert_field_data_to_generic_value.go new file mode 100644 index 0000000000000..72dbb8f5b3d6c --- /dev/null +++ b/internal/parser/planparserv2/convert_field_data_to_generic_value.go @@ -0,0 +1,73 @@ +package planparserv2 + +import ( + "fmt" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/internal/proto/planpb" +) + +func ConvertToGenericValue(templateName string, templateValue *schemapb.TemplateValue) (*planpb.GenericValue, error) { + if templateValue == nil { + return nil, fmt.Errorf("expression template variable value is nil, template name: {%s}", templateName) + } + switch templateValue.GetType() { + case schemapb.DataType_Bool: + return &planpb.GenericValue{ + Val: &planpb.GenericValue_BoolVal{ + BoolVal: templateValue.GetBoolVal(), + }, + }, nil + case schemapb.DataType_Int8, schemapb.DataType_Int16, schemapb.DataType_Int32, schemapb.DataType_Int64: + return &planpb.GenericValue{ + Val: &planpb.GenericValue_Int64Val{ + Int64Val: templateValue.GetInt64Val(), + }, + }, nil + case schemapb.DataType_Float, schemapb.DataType_Double: + return &planpb.GenericValue{ + Val: &planpb.GenericValue_FloatVal{ + FloatVal: templateValue.GetFloatVal(), + }, + }, nil + case schemapb.DataType_String, schemapb.DataType_VarChar: + return &planpb.GenericValue{ + Val: &planpb.GenericValue_StringVal{ + StringVal: templateValue.GetStringVal(), + }, + }, nil + case schemapb.DataType_Array: + elements := templateValue.GetArrayVal().GetArray() + arrayValues := make([]*planpb.GenericValue, len(elements)) + for i, element := range elements { + arrayElement, err := ConvertToGenericValue(templateName, element) + if err != nil { + return nil, err + } + arrayValues[i] = arrayElement + } + return &planpb.GenericValue{ + Val: &planpb.GenericValue_ArrayVal{ + ArrayVal: &planpb.Array{ + Array: arrayValues, + SameType: templateValue.GetArrayVal().GetSameType(), + ElementType: templateValue.GetArrayVal().GetElementType(), + }, + }, + }, nil + default: + return nil, fmt.Errorf("expression elements can only be scalars") + } +} + +func UnmarshalExpressionValues(input map[string]*schemapb.TemplateValue) (map[string]*planpb.GenericValue, error) { + result := make(map[string]*planpb.GenericValue, len(input)) + for name, value := range input { + rv, err := ConvertToGenericValue(name, value) + if err != nil { + return nil, err + } + result[name] = rv + } + return result, nil +} diff --git a/internal/parser/planparserv2/convert_field_data_to_generic_value_test.go b/internal/parser/planparserv2/convert_field_data_to_generic_value_test.go new file mode 100644 index 0000000000000..14dacc8f64a79 --- /dev/null +++ b/internal/parser/planparserv2/convert_field_data_to_generic_value_test.go @@ -0,0 +1,286 @@ +package planparserv2 + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/internal/proto/planpb" +) + +type convertTestcase struct { + input map[string]*schemapb.TemplateValue + expect map[string]*planpb.GenericValue +} + +func Test_ConvertToGenericValue(t *testing.T) { + tests := []convertTestcase{ + { + input: map[string]*schemapb.TemplateValue{ + "bool": { + Type: schemapb.DataType_Bool, + Val: &schemapb.TemplateValue_BoolVal{ + BoolVal: false, + }, + }, + }, + expect: map[string]*planpb.GenericValue{ + "bool": { + Val: &planpb.GenericValue_BoolVal{ + BoolVal: false, + }, + }, + }, + }, + { + input: map[string]*schemapb.TemplateValue{ + "int": { + Type: schemapb.DataType_Int64, + Val: &schemapb.TemplateValue_Int64Val{ + Int64Val: 999, + }, + }, + }, + expect: map[string]*planpb.GenericValue{ + "int": { + Val: &planpb.GenericValue_Int64Val{ + Int64Val: 999, + }, + }, + }, + }, + { + input: map[string]*schemapb.TemplateValue{ + "float": { + Type: schemapb.DataType_Float, + Val: &schemapb.TemplateValue_FloatVal{ + FloatVal: 55.55, + }, + }, + }, + expect: map[string]*planpb.GenericValue{ + "float": { + Val: &planpb.GenericValue_FloatVal{ + FloatVal: 55.55, + }, + }, + }, + }, + { + input: map[string]*schemapb.TemplateValue{ + "string": { + Type: schemapb.DataType_VarChar, + Val: &schemapb.TemplateValue_StringVal{ + StringVal: "abc", + }, + }, + }, + expect: map[string]*planpb.GenericValue{ + "string": { + Val: &planpb.GenericValue_StringVal{ + StringVal: "abc", + }, + }, + }, + }, + { + input: map[string]*schemapb.TemplateValue{ + "array": { + Type: schemapb.DataType_Array, + Val: &schemapb.TemplateValue_ArrayVal{ + ArrayVal: &schemapb.TemplateArrayValue{ + Array: []*schemapb.TemplateValue{ + { + Type: schemapb.DataType_Int64, + Val: &schemapb.TemplateValue_Int64Val{ + Int64Val: 111, + }, + }, + { + Type: schemapb.DataType_Int64, + Val: &schemapb.TemplateValue_Int64Val{ + Int64Val: 222, + }, + }, + { + Type: schemapb.DataType_Int64, + Val: &schemapb.TemplateValue_Int64Val{ + Int64Val: 333, + }, + }, + }, + SameType: true, + ElementType: schemapb.DataType_Int64, + }, + }, + }, + }, + expect: map[string]*planpb.GenericValue{ + "array": { + Val: &planpb.GenericValue_ArrayVal{ + ArrayVal: &planpb.Array{ + Array: []*planpb.GenericValue{ + { + Val: &planpb.GenericValue_Int64Val{ + Int64Val: 111, + }, + }, + { + Val: &planpb.GenericValue_Int64Val{ + Int64Val: 222, + }, + }, + { + Val: &planpb.GenericValue_Int64Val{ + Int64Val: 333, + }, + }, + }, + SameType: true, + ElementType: schemapb.DataType_Int64, + }, + }, + }, + }, + }, + { + input: map[string]*schemapb.TemplateValue{ + "not_same_array": { + Type: schemapb.DataType_Array, + Val: &schemapb.TemplateValue_ArrayVal{ + ArrayVal: &schemapb.TemplateArrayValue{ + Array: []*schemapb.TemplateValue{ + { + Type: schemapb.DataType_Int64, + Val: &schemapb.TemplateValue_Int64Val{ + Int64Val: 111, + }, + }, + { + Type: schemapb.DataType_Float, + Val: &schemapb.TemplateValue_FloatVal{ + FloatVal: 222.222, + }, + }, + { + Type: schemapb.DataType_Bool, + Val: &schemapb.TemplateValue_BoolVal{ + BoolVal: true, + }, + }, + { + Type: schemapb.DataType_VarChar, + Val: &schemapb.TemplateValue_StringVal{ + StringVal: "abc", + }, + }, + }, + }, + }, + }, + }, + expect: map[string]*planpb.GenericValue{ + "not_same_array": { + Val: &planpb.GenericValue_ArrayVal{ + ArrayVal: &planpb.Array{ + Array: []*planpb.GenericValue{ + { + Val: &planpb.GenericValue_Int64Val{ + Int64Val: 111, + }, + }, + { + Val: &planpb.GenericValue_FloatVal{ + FloatVal: 222.222, + }, + }, + { + Val: &planpb.GenericValue_BoolVal{ + BoolVal: true, + }, + }, + { + Val: &planpb.GenericValue_StringVal{ + StringVal: "abc", + }, + }, + }, + }, + }, + }, + }, + }, + } + + for _, tt := range tests { + output, err := UnmarshalExpressionValues(tt.input) + assert.Nil(t, err) + assert.EqualValues(t, tt.expect, output) + } +} + +func generateExpressionFieldData(dataType schemapb.DataType, data interface{}) *schemapb.TemplateValue { + switch dataType { + case schemapb.DataType_Bool: + return &schemapb.TemplateValue{ + Type: dataType, + Val: &schemapb.TemplateValue_BoolVal{ + BoolVal: data.(bool), + }, + } + case schemapb.DataType_Int8, schemapb.DataType_Int16, schemapb.DataType_Int32, schemapb.DataType_Int64: + return &schemapb.TemplateValue{ + Type: dataType, + Val: &schemapb.TemplateValue_Int64Val{ + Int64Val: data.(int64), + }, + } + case schemapb.DataType_Float, schemapb.DataType_Double: + return &schemapb.TemplateValue{ + Type: dataType, + Val: &schemapb.TemplateValue_FloatVal{ + FloatVal: data.(float64), + }, + } + case schemapb.DataType_String, schemapb.DataType_VarChar: + return &schemapb.TemplateValue{ + Type: dataType, + Val: &schemapb.TemplateValue_StringVal{ + StringVal: data.(string), + }, + } + case schemapb.DataType_Array: + // Handle array data here + // Assume the inner data is already in an appropriate format. + // Placeholder for array implementation. + // You might want to define a recursive approach based on the data structure. + value := data.([]interface{}) + arrayData := make([]*schemapb.TemplateValue, len(value)) + elementType := schemapb.DataType_None + sameType := true + for i, v := range value { + element := v.(*schemapb.TemplateValue) + arrayData[i] = element + if elementType == schemapb.DataType_None { + elementType = element.GetType() + } else if elementType != element.GetType() { + sameType = false + elementType = schemapb.DataType_JSON + } + } + return &schemapb.TemplateValue{ + Type: dataType, + Val: &schemapb.TemplateValue_ArrayVal{ + ArrayVal: &schemapb.TemplateArrayValue{ + Array: arrayData, + ElementType: elementType, + SameType: sameType, + }, + }, + } + + default: + return nil + } +} diff --git a/internal/parser/planparserv2/fill_expression_value.go b/internal/parser/planparserv2/fill_expression_value.go new file mode 100644 index 0000000000000..534bbc564772a --- /dev/null +++ b/internal/parser/planparserv2/fill_expression_value.go @@ -0,0 +1,227 @@ +package planparserv2 + +import ( + "fmt" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/internal/proto/planpb" + "github.com/milvus-io/milvus/pkg/util/typeutil" +) + +func FillExpressionValue(expr *planpb.Expr, templateValues map[string]*planpb.GenericValue) error { + if !expr.GetIsTemplate() { + return nil + } + + switch e := expr.GetExpr().(type) { + case *planpb.Expr_TermExpr: + return FillTermExpressionValue(e.TermExpr, templateValues) + case *planpb.Expr_UnaryExpr: + return FillExpressionValue(e.UnaryExpr.GetChild(), templateValues) + case *planpb.Expr_BinaryExpr: + if err := FillExpressionValue(e.BinaryExpr.GetLeft(), templateValues); err != nil { + return err + } + return FillExpressionValue(e.BinaryExpr.GetRight(), templateValues) + case *planpb.Expr_UnaryRangeExpr: + return FillUnaryRangeExpressionValue(e.UnaryRangeExpr, templateValues) + case *planpb.Expr_BinaryRangeExpr: + return FillBinaryRangeExpressionValue(e.BinaryRangeExpr, templateValues) + case *planpb.Expr_BinaryArithOpEvalRangeExpr: + return FillBinaryArithOpEvalRangeExpressionValue(e.BinaryArithOpEvalRangeExpr, templateValues) + case *planpb.Expr_BinaryArithExpr: + if err := FillExpressionValue(e.BinaryArithExpr.GetLeft(), templateValues); err != nil { + return err + } + return FillExpressionValue(e.BinaryArithExpr.GetRight(), templateValues) + case *planpb.Expr_JsonContainsExpr: + return FillJSONContainsExpressionValue(e.JsonContainsExpr, templateValues) + default: + return fmt.Errorf("this expression no need to fill placeholder with expr type: %T", e) + } +} + +func FillTermExpressionValue(expr *planpb.TermExpr, templateValues map[string]*planpb.GenericValue) error { + value, ok := templateValues[expr.GetTemplateVariableName()] + if !ok && expr.GetValues() == nil { + return fmt.Errorf("the value of expression template variable name {%s} is not found", expr.GetTemplateVariableName()) + } + + if value == nil || value.GetArrayVal() == nil { + return fmt.Errorf("the value of term expression template variable {%s} is not array", expr.GetTemplateVariableName()) + } + dataType := expr.GetColumnInfo().GetDataType() + if typeutil.IsArrayType(dataType) { + if len(expr.GetColumnInfo().GetNestedPath()) != 0 { + dataType = expr.GetColumnInfo().GetElementType() + } + } + + array := value.GetArrayVal().GetArray() + values := make([]*planpb.GenericValue, len(array)) + for i, e := range array { + castedValue, err := castValue(dataType, e) + if err != nil { + return err + } + values[i] = castedValue + } + expr.Values = values + + return nil +} + +func FillUnaryRangeExpressionValue(expr *planpb.UnaryRangeExpr, templateValues map[string]*planpb.GenericValue) error { + value, ok := templateValues[expr.GetTemplateVariableName()] + if !ok { + return fmt.Errorf("the value of expression template variable name {%s} is not found", expr.GetTemplateVariableName()) + } + + dataType := expr.GetColumnInfo().GetDataType() + if typeutil.IsArrayType(dataType) { + if len(expr.GetColumnInfo().GetNestedPath()) != 0 { + dataType = expr.GetColumnInfo().GetElementType() + } + } + + castedValue, err := castValue(dataType, value) + if err != nil { + return err + } + expr.Value = castedValue + return nil +} + +func FillBinaryRangeExpressionValue(expr *planpb.BinaryRangeExpr, templateValues map[string]*planpb.GenericValue) error { + var ok bool + dataType := expr.GetColumnInfo().GetDataType() + if typeutil.IsArrayType(dataType) && len(expr.GetColumnInfo().GetNestedPath()) != 0 { + dataType = expr.GetColumnInfo().GetElementType() + } + lowerValue := expr.GetLowerValue() + if lowerValue == nil || expr.GetLowerTemplateVariableName() != "" { + lowerValue, ok = templateValues[expr.GetLowerTemplateVariableName()] + if !ok { + return fmt.Errorf("the lower value of expression template variable name {%s} is not found", expr.GetLowerTemplateVariableName()) + } + castedLowerValue, err := castValue(dataType, lowerValue) + if err != nil { + return err + } + expr.LowerValue = castedLowerValue + } + + upperValue := expr.GetUpperValue() + if upperValue == nil || expr.GetUpperTemplateVariableName() != "" { + upperValue, ok = templateValues[expr.GetUpperTemplateVariableName()] + if !ok { + return fmt.Errorf("the upper value of expression template variable name {%s} is not found", expr.GetUpperTemplateVariableName()) + } + + castedUpperValue, err := castValue(dataType, upperValue) + if err != nil { + return err + } + expr.UpperValue = castedUpperValue + } + + if !(expr.GetLowerInclusive() && expr.GetUpperInclusive()) { + if getGenericValue(GreaterEqual(lowerValue, upperValue)).GetBoolVal() { + return fmt.Errorf("invalid range: lowerbound is greater than upperbound") + } + } else { + if getGenericValue(Greater(lowerValue, upperValue)).GetBoolVal() { + return fmt.Errorf("invalid range: lowerbound is greater than upperbound") + } + } + + return nil +} + +func FillBinaryArithOpEvalRangeExpressionValue(expr *planpb.BinaryArithOpEvalRangeExpr, templateValues map[string]*planpb.GenericValue) error { + var dataType schemapb.DataType + var err error + var ok bool + + operand := expr.GetRightOperand() + if operand == nil || expr.GetOperandTemplateVariableName() != "" { + operand, ok = templateValues[expr.GetOperandTemplateVariableName()] + if !ok { + return fmt.Errorf("the right operand value of expression template variable name {%s} is not found", expr.GetOperandTemplateVariableName()) + } + } + + operandExpr := toValueExpr(operand) + lDataType, rDataType := expr.GetColumnInfo().GetDataType(), operandExpr.dataType + if typeutil.IsArrayType(expr.GetColumnInfo().GetDataType()) { + lDataType = expr.GetColumnInfo().GetElementType() + } + + if err = checkValidModArith(expr.GetArithOp(), expr.GetColumnInfo().GetDataType(), expr.GetColumnInfo().GetElementType(), + rDataType, schemapb.DataType_None); err != nil { + return err + } + + if operand.GetArrayVal() != nil { + return fmt.Errorf("can not comparisons array directly") + } + + dataType, err = getTargetType(lDataType, rDataType) + if err != nil { + return err + } + + castedOperand, err := castValue(dataType, operand) + if err != nil { + return err + } + expr.RightOperand = castedOperand + + value := expr.GetValue() + if expr.GetValue() == nil || expr.GetValueTemplateVariableName() != "" { + value, ok = templateValues[expr.GetValueTemplateVariableName()] + if !ok { + return fmt.Errorf("the value of expression template variable name {%s} is not found", expr.GetValueTemplateVariableName()) + } + } + castedValue, err := castValue(dataType, value) + if err != nil { + return err + } + expr.Value = castedValue + + return nil +} + +func FillJSONContainsExpressionValue(expr *planpb.JSONContainsExpr, templateValues map[string]*planpb.GenericValue) error { + if expr.GetElements() != nil && expr.GetTemplateVariableName() == "" { + return nil + } + value, ok := templateValues[expr.GetTemplateVariableName()] + if !ok { + return fmt.Errorf("the value of expression template variable name {%s} is not found", expr.GetTemplateVariableName()) + } + if err := checkContainsElement(toColumnExpr(expr.GetColumnInfo()), expr.GetOp(), value); err != nil { + return err + } + dataType := expr.GetColumnInfo().GetDataType() + if typeutil.IsArrayType(dataType) { + dataType = expr.GetColumnInfo().GetElementType() + } + if expr.GetOp() == planpb.JSONContainsExpr_Contains { + castedValue, err := castValue(dataType, value) + if err != nil { + return err + } + expr.Elements = append(expr.Elements, castedValue) + } else { + for _, e := range value.GetArrayVal().GetArray() { + castedValue, err := castValue(dataType, e) + if err != nil { + return err + } + expr.Elements = append(expr.Elements, castedValue) + } + } + return nil +} diff --git a/internal/parser/planparserv2/fill_expression_value_test.go b/internal/parser/planparserv2/fill_expression_value_test.go new file mode 100644 index 0000000000000..b2adb65874035 --- /dev/null +++ b/internal/parser/planparserv2/fill_expression_value_test.go @@ -0,0 +1,568 @@ +package planparserv2 + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" + "github.com/milvus-io/milvus/internal/proto/planpb" +) + +type FillExpressionValueSuite struct { + suite.Suite +} + +func TestFillExpressionValue(t *testing.T) { + suite.Run(t, new(FillExpressionValueSuite)) +} + +type testcase struct { + expr string + values map[string]*schemapb.TemplateValue +} + +func (s *FillExpressionValueSuite) jsonMarshal(v interface{}) []byte { + r, err := json.Marshal(v) + s.NoError(err) + return r +} + +func (s *FillExpressionValueSuite) TestTermExpr() { + s.Run("normal case", func() { + testcases := []testcase{ + {`Int64Field in {age}`, map[string]*schemapb.TemplateValue{ + "age": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(4)), + }), + }}, + {`FloatField in {age}`, map[string]*schemapb.TemplateValue{ + "age": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Float, 1.1), + generateExpressionFieldData(schemapb.DataType_Float, 2.2), + generateExpressionFieldData(schemapb.DataType_Float, 3.3), + generateExpressionFieldData(schemapb.DataType_Float, 4.4), + }), + }}, + {`A in {list}`, map[string]*schemapb.TemplateValue{ + "list": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Float, 2.2), + generateExpressionFieldData(schemapb.DataType_String, "abc"), + generateExpressionFieldData(schemapb.DataType_Bool, false), + }), + }}, + {`ArrayField in {list}`, map[string]*schemapb.TemplateValue{ + "list": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + }), + generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(4)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(5)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(6)), + }), + generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(7)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(8)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(9)), + }), + }), + }}, + {`ArrayField[0] in {list}`, map[string]*schemapb.TemplateValue{ + "list": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + }), + }}, + {`Int64Field in {empty_list}`, map[string]*schemapb.TemplateValue{ + "empty_list": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{}), + }}, + } + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + + s.NoError(err) + s.NotNil(plan) + } + }) + + s.Run("failed case", func() { + testcases := []testcase{ + {`Int64Field in {age}`, map[string]*schemapb.TemplateValue{ + "age": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_String, "abc"), + generateExpressionFieldData(schemapb.DataType_String, "def"), + }), + }}, + {`StringField in {list}`, map[string]*schemapb.TemplateValue{ + "list": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_String, "abc"), + generateExpressionFieldData(schemapb.DataType_Float, 2.2), + generateExpressionFieldData(schemapb.DataType_Bool, false), + }), + }}, + {"ArrayField[0] in {list}", map[string]*schemapb.TemplateValue{ + "list": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_String, "abc"), + generateExpressionFieldData(schemapb.DataType_Float, 3.2), + }), + }}, + {"Int64Field not in {not_list}", map[string]*schemapb.TemplateValue{ + "not_list": generateExpressionFieldData(schemapb.DataType_Int64, int64(33)), + }}, + } + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + s.Error(err) + s.Nil(plan) + fmt.Println(plan) + } + }) +} + +func (s *FillExpressionValueSuite) TestUnaryRange() { + s.Run("normal case", func() { + testcases := []testcase{ + {`Int64Field == 10`, nil}, + {`Int64Field > {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Int64, int64(11)), + }}, + {`FloatField < {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Float, float64(12.3)), + }}, + {`DoubleField != {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Double, 3.5), + }}, + {`ArrayField[0] >= {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + }}, + {`BoolField == {bool}`, map[string]*schemapb.TemplateValue{ + "bool": generateExpressionFieldData(schemapb.DataType_Bool, false), + }}, + {`{str} != StringField`, map[string]*schemapb.TemplateValue{ + "str": generateExpressionFieldData(schemapb.DataType_String, "abc"), + }}, + {`{target} > Int64Field`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Int64, int64(11)), + }}, + } + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + + s.NoError(err) + s.NotNil(plan) + s.NotNil(plan.GetVectorAnns()) + s.NotNil(plan.GetVectorAnns().GetPredicates()) + } + }) + + s.Run("failed case", func() { + testcases := []testcase{ + {`Int64Field == 10.5`, nil}, + {`Int64Field > {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Double, 11.2), + }}, + {`FloatField < {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_String, "abc"), + }}, + {`DoubleField != {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Bool, false), + }}, + {`ArrayField[0] >= {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Double, 3.5), + }}, + {`BoolField == {bool}`, map[string]*schemapb.TemplateValue{ + "bool": generateExpressionFieldData(schemapb.DataType_String, "abc"), + }}, + {`{str} != StringField`, map[string]*schemapb.TemplateValue{ + "str": generateExpressionFieldData(schemapb.DataType_Int64, int64(5)), + }}, + {`{int} != StringField`, map[string]*schemapb.TemplateValue{ + "int": generateExpressionFieldData(schemapb.DataType_Int64, int64(5)), + }}, + } + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + + s.Error(err) + s.Nil(plan) + } + }) +} + +func (s *FillExpressionValueSuite) TestBinaryRange() { + s.Run("normal case", func() { + testcases := []testcase{ + {`10 < Int64Field < 20`, nil}, + {`{max} > Int64Field > {min}`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_Int64, int64(11)), + "max": generateExpressionFieldData(schemapb.DataType_Int64, int64(22)), + }}, + {`{min} <= FloatField <= {max}`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_Float, float64(11)), + "max": generateExpressionFieldData(schemapb.DataType_Float, float64(22)), + }}, + {`{min} < DoubleField < {max}`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_Double, float64(11)), + "max": generateExpressionFieldData(schemapb.DataType_Double, float64(22)), + }}, + {`{max} >= ArrayField[0] >= {min}`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_Int64, int64(11)), + "max": generateExpressionFieldData(schemapb.DataType_Int64, int64(22)), + }}, + {`{max} > Int64Field >= 10`, map[string]*schemapb.TemplateValue{ + "max": generateExpressionFieldData(schemapb.DataType_Int64, int64(22)), + }}, + {`30 >= Int64Field > {min}`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_Int64, int64(11)), + }}, + {`10 < Int64Field <= {max}`, map[string]*schemapb.TemplateValue{ + "max": generateExpressionFieldData(schemapb.DataType_Int64, int64(22)), + }}, + {`{min} <= Int64Field < 20`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_Int64, int64(11)), + }}, + } + + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + + s.NoError(err) + s.NotNil(plan) + s.NotNil(plan.GetVectorAnns()) + s.NotNil(plan.GetVectorAnns().GetPredicates()) + } + }) + + s.Run("failed case", func() { + testcases := []testcase{ + {`10 < Int64Field < 20.5`, nil}, + {`{max} > Int64Field > {min}`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_Int64, int64(11)), + "max": generateExpressionFieldData(schemapb.DataType_Double, 22.5), + }}, + {`{min} <= FloatField <= {max}`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_String, "abc"), + "max": generateExpressionFieldData(schemapb.DataType_Int64, int64(11)), + }}, + {`{min} < DoubleField < {max}`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_Int64, int64(33)), + "max": generateExpressionFieldData(schemapb.DataType_Int64, int64(22)), + }}, + {`{max} >= ArrayField[0] >= {min}`, map[string]*schemapb.TemplateValue{ + "min": generateExpressionFieldData(schemapb.DataType_Double, 11.5), + "max": generateExpressionFieldData(schemapb.DataType_Int64, int64(22)), + }}, + {`{max} >= Int64Field >= {min}`, map[string]*schemapb.TemplateValue{ + "max": generateExpressionFieldData(schemapb.DataType_Int64, int64(22)), + }}, + {`{max} > Int64Field`, map[string]*schemapb.TemplateValue{ + "max": generateExpressionFieldData(schemapb.DataType_Bool, false), + }}, + {`{$meta} > Int64Field`, map[string]*schemapb.TemplateValue{ + "$meta": generateExpressionFieldData(schemapb.DataType_Int64, int64(22)), + }}, + } + + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + + s.Error(err) + s.Nil(plan) + } + }) +} + +func (s *FillExpressionValueSuite) TestBinaryArithOpEvalRange() { + s.Run("normal case", func() { + testcases := []testcase{ + {`Int64Field + 5.5 == 10.5`, nil}, + {`Int64Field - {offset} >= {target}`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_Double, 3.5), + "target": generateExpressionFieldData(schemapb.DataType_Double, 11.5), + }}, + {`Int64Field * 3.5 <= {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Double, 11.5), + }}, + {`Int64Field / {offset} > 11.5`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_Double, 3.5), + }}, + {`ArrayField[0] % {offset} < 11`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + }}, + } + + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + + s.NoError(err) + s.NotNil(plan) + s.NotNil(plan.GetVectorAnns()) + s.NotNil(plan.GetVectorAnns().GetPredicates()) + } + }) + + s.Run("failed case", func() { + testcases := []testcase{ + {`Int64Field + 6 == 12.5`, nil}, + {`Int64Field - {offset} == {target}`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_Int64, int64(4)), + "target": generateExpressionFieldData(schemapb.DataType_Double, 13.5), + }}, + {`Int64Field * 6 == {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Double, 13.5), + }}, + {`Int64Field / {offset} == 11.5`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_Int64, int64(6)), + }}, + {`Int64Field % {offset} < 11`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_Double, 3.5), + }}, + {`Int64Field + {offset} < {target}`, map[string]*schemapb.TemplateValue{ + "target": generateExpressionFieldData(schemapb.DataType_Double, 3.5), + }}, + {`Int64Field + {offset} < {target}`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_String, "abc"), + "target": generateExpressionFieldData(schemapb.DataType_Int64, int64(15)), + }}, + {`Int64Field + {offset} < {target}`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_Int64, int64(15)), + "target": generateExpressionFieldData(schemapb.DataType_String, "def"), + }}, + {`ArrayField + {offset} < {target}`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_Double, 3.5), + "target": generateExpressionFieldData(schemapb.DataType_Int64, int64(5)), + }}, + {`ArrayField[0] + {offset} < {target}`, map[string]*schemapb.TemplateValue{ + "offset": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + }), + "target": generateExpressionFieldData(schemapb.DataType_Int64, int64(5)), + }}, + } + + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + + s.Error(err) + s.Nil(plan) + } + }) +} + +func (s *FillExpressionValueSuite) TestJSONContainsExpression() { + s.Run("normal case", func() { + testcases := []testcase{ + {`json_contains(A, 5)`, nil}, + {`json_contains(A, {age})`, map[string]*schemapb.TemplateValue{ + "age": generateExpressionFieldData(schemapb.DataType_Int64, int64(18)), + }}, + {`json_contains(A, {str})`, map[string]*schemapb.TemplateValue{ + "str": generateExpressionFieldData(schemapb.DataType_String, "abc"), + }}, + {`json_contains(A, {bool})`, map[string]*schemapb.TemplateValue{ + "bool": generateExpressionFieldData(schemapb.DataType_Bool, false), + }}, + {`json_contains_any(JSONField, {array})`, map[string]*schemapb.TemplateValue{ + "array": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_String, "abc"), + generateExpressionFieldData(schemapb.DataType_Double, 2.2), + generateExpressionFieldData(schemapb.DataType_Bool, false), + }), + }}, + {`json_contains_any(JSONField, {array})`, map[string]*schemapb.TemplateValue{ + "array": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(4)), + }), + }}, + {`json_contains_any(JSONField["A"], {array})`, map[string]*schemapb.TemplateValue{ + "array": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(4)), + }), + }}, + {`json_contains_all(JSONField["A"], {array})`, map[string]*schemapb.TemplateValue{ + "array": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_String, "abc"), + generateExpressionFieldData(schemapb.DataType_Double, 2.2), + generateExpressionFieldData(schemapb.DataType_Bool, false), + }), + }}, + {`json_contains_all(JSONField["A"], {array})`, map[string]*schemapb.TemplateValue{ + "array": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + }), + generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(4)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(5)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(6)), + }), + }), + }}, + {`json_contains(ArrayField, {int})`, map[string]*schemapb.TemplateValue{ + "int": generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + }}, + {`json_contains_any(ArrayField, {list})`, map[string]*schemapb.TemplateValue{ + "list": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(4)), + }), + }}, + } + + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + + s.NoError(err) + s.NotNil(plan) + s.NotNil(plan.GetVectorAnns()) + s.NotNil(plan.GetVectorAnns().GetPredicates()) + } + }) + + s.Run("failed case", func() { + testcases := []testcase{ + {`json_contains(ArrayField[0], {str})`, map[string]*schemapb.TemplateValue{ + "str": generateExpressionFieldData(schemapb.DataType_String, "abc"), + }}, + {`json_contains_any(JSONField, {not_array})`, map[string]*schemapb.TemplateValue{ + "not_array": generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + }}, + {`json_contains_all(JSONField, {not_array})`, map[string]*schemapb.TemplateValue{ + "not_array": generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + }}, + {`json_contains_all(JSONField, {not_array})`, map[string]*schemapb.TemplateValue{ + "array": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + }), + }}, + {`json_contains_all(ArrayField, {array})`, map[string]*schemapb.TemplateValue{ + "array": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_String, "abc"), + generateExpressionFieldData(schemapb.DataType_Double, 2.2), + generateExpressionFieldData(schemapb.DataType_Bool, false), + }), + }}, + {`json_contains(ArrayField, {array})`, map[string]*schemapb.TemplateValue{ + "array": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(2)), + generateExpressionFieldData(schemapb.DataType_Int64, int64(3)), + }), + }}, + {`json_contains_any(ArrayField, {array})`, map[string]*schemapb.TemplateValue{ + "array": generateExpressionFieldData(schemapb.DataType_Array, []interface{}{ + generateExpressionFieldData(schemapb.DataType_Int64, int64(1)), + generateExpressionFieldData(schemapb.DataType_String, "abc"), + generateExpressionFieldData(schemapb.DataType_Double, 2.2), + generateExpressionFieldData(schemapb.DataType_Bool, false), + }), + }}, + } + + schemaH := newTestSchemaHelper(s.T()) + + for _, c := range testcases { + plan, err := CreateSearchPlan(schemaH, c.expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, c.values) + + s.Error(err) + s.Nil(plan) + } + }) +} diff --git a/internal/parser/planparserv2/generated/Plan.interp b/internal/parser/planparserv2/generated/Plan.interp index 1c4888f9bffed..d39784dd205b0 100644 --- a/internal/parser/planparserv2/generated/Plan.interp +++ b/internal/parser/planparserv2/generated/Plan.interp @@ -5,6 +5,8 @@ null '[' ',' ']' +'{' +'}' '<' '<=' '>' @@ -28,8 +30,6 @@ null null '~' null -'in' -'not in' null null null @@ -43,6 +43,8 @@ null null null null +'$meta' +null null null null @@ -54,6 +56,8 @@ null null null null +LBRACE +RBRACE LT LE GT @@ -78,8 +82,7 @@ OR BNOT NOT IN -NIN -EmptyTerm +EmptyArray JSONContains JSONContainsAll JSONContainsAny @@ -91,6 +94,7 @@ BooleanConstant IntegerConstant FloatingConstant Identifier +Meta StringLiteral JSONIdentifier Whitespace @@ -101,4 +105,4 @@ expr atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 48, 131, 4, 2, 9, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 20, 10, 2, 12, 2, 14, 2, 23, 11, 2, 3, 2, 5, 2, 26, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 59, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 113, 10, 2, 12, 2, 14, 2, 116, 11, 2, 3, 2, 5, 2, 119, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 126, 10, 2, 12, 2, 14, 2, 129, 11, 2, 3, 2, 2, 3, 2, 3, 2, 2, 15, 4, 2, 16, 17, 29, 30, 4, 2, 34, 34, 37, 37, 4, 2, 35, 35, 38, 38, 4, 2, 36, 36, 39, 39, 4, 2, 44, 44, 46, 46, 3, 2, 18, 20, 3, 2, 16, 17, 3, 2, 22, 23, 3, 2, 8, 9, 3, 2, 10, 11, 3, 2, 8, 11, 3, 2, 12, 13, 3, 2, 31, 32, 2, 162, 2, 58, 3, 2, 2, 2, 4, 5, 8, 2, 1, 2, 5, 59, 7, 42, 2, 2, 6, 59, 7, 43, 2, 2, 7, 59, 7, 41, 2, 2, 8, 59, 7, 45, 2, 2, 9, 59, 7, 44, 2, 2, 10, 59, 7, 46, 2, 2, 11, 12, 7, 3, 2, 2, 12, 13, 5, 2, 2, 2, 13, 14, 7, 4, 2, 2, 14, 59, 3, 2, 2, 2, 15, 16, 7, 5, 2, 2, 16, 21, 5, 2, 2, 2, 17, 18, 7, 6, 2, 2, 18, 20, 5, 2, 2, 2, 19, 17, 3, 2, 2, 2, 20, 23, 3, 2, 2, 2, 21, 19, 3, 2, 2, 2, 21, 22, 3, 2, 2, 2, 22, 25, 3, 2, 2, 2, 23, 21, 3, 2, 2, 2, 24, 26, 7, 6, 2, 2, 25, 24, 3, 2, 2, 2, 25, 26, 3, 2, 2, 2, 26, 27, 3, 2, 2, 2, 27, 28, 7, 7, 2, 2, 28, 59, 3, 2, 2, 2, 29, 30, 9, 2, 2, 2, 30, 59, 5, 2, 2, 22, 31, 32, 9, 3, 2, 2, 32, 33, 7, 3, 2, 2, 33, 34, 5, 2, 2, 2, 34, 35, 7, 6, 2, 2, 35, 36, 5, 2, 2, 2, 36, 37, 7, 4, 2, 2, 37, 59, 3, 2, 2, 2, 38, 39, 9, 4, 2, 2, 39, 40, 7, 3, 2, 2, 40, 41, 5, 2, 2, 2, 41, 42, 7, 6, 2, 2, 42, 43, 5, 2, 2, 2, 43, 44, 7, 4, 2, 2, 44, 59, 3, 2, 2, 2, 45, 46, 9, 5, 2, 2, 46, 47, 7, 3, 2, 2, 47, 48, 5, 2, 2, 2, 48, 49, 7, 6, 2, 2, 49, 50, 5, 2, 2, 2, 50, 51, 7, 4, 2, 2, 51, 59, 3, 2, 2, 2, 52, 53, 7, 40, 2, 2, 53, 54, 7, 3, 2, 2, 54, 55, 9, 6, 2, 2, 55, 59, 7, 4, 2, 2, 56, 57, 7, 15, 2, 2, 57, 59, 5, 2, 2, 3, 58, 4, 3, 2, 2, 2, 58, 6, 3, 2, 2, 2, 58, 7, 3, 2, 2, 2, 58, 8, 3, 2, 2, 2, 58, 9, 3, 2, 2, 2, 58, 10, 3, 2, 2, 2, 58, 11, 3, 2, 2, 2, 58, 15, 3, 2, 2, 2, 58, 29, 3, 2, 2, 2, 58, 31, 3, 2, 2, 2, 58, 38, 3, 2, 2, 2, 58, 45, 3, 2, 2, 2, 58, 52, 3, 2, 2, 2, 58, 56, 3, 2, 2, 2, 59, 127, 3, 2, 2, 2, 60, 61, 12, 23, 2, 2, 61, 62, 7, 21, 2, 2, 62, 126, 5, 2, 2, 24, 63, 64, 12, 21, 2, 2, 64, 65, 9, 7, 2, 2, 65, 126, 5, 2, 2, 22, 66, 67, 12, 20, 2, 2, 67, 68, 9, 8, 2, 2, 68, 126, 5, 2, 2, 21, 69, 70, 12, 19, 2, 2, 70, 71, 9, 9, 2, 2, 71, 126, 5, 2, 2, 20, 72, 73, 12, 12, 2, 2, 73, 74, 9, 10, 2, 2, 74, 75, 9, 6, 2, 2, 75, 76, 9, 10, 2, 2, 76, 126, 5, 2, 2, 13, 77, 78, 12, 11, 2, 2, 78, 79, 9, 11, 2, 2, 79, 80, 9, 6, 2, 2, 80, 81, 9, 11, 2, 2, 81, 126, 5, 2, 2, 12, 82, 83, 12, 10, 2, 2, 83, 84, 9, 12, 2, 2, 84, 126, 5, 2, 2, 11, 85, 86, 12, 9, 2, 2, 86, 87, 9, 13, 2, 2, 87, 126, 5, 2, 2, 10, 88, 89, 12, 8, 2, 2, 89, 90, 7, 24, 2, 2, 90, 126, 5, 2, 2, 9, 91, 92, 12, 7, 2, 2, 92, 93, 7, 26, 2, 2, 93, 126, 5, 2, 2, 8, 94, 95, 12, 6, 2, 2, 95, 96, 7, 25, 2, 2, 96, 126, 5, 2, 2, 7, 97, 98, 12, 5, 2, 2, 98, 99, 7, 27, 2, 2, 99, 126, 5, 2, 2, 6, 100, 101, 12, 4, 2, 2, 101, 102, 7, 28, 2, 2, 102, 126, 5, 2, 2, 5, 103, 104, 12, 24, 2, 2, 104, 105, 7, 14, 2, 2, 105, 126, 7, 45, 2, 2, 106, 107, 12, 18, 2, 2, 107, 108, 9, 14, 2, 2, 108, 109, 7, 5, 2, 2, 109, 114, 5, 2, 2, 2, 110, 111, 7, 6, 2, 2, 111, 113, 5, 2, 2, 2, 112, 110, 3, 2, 2, 2, 113, 116, 3, 2, 2, 2, 114, 112, 3, 2, 2, 2, 114, 115, 3, 2, 2, 2, 115, 118, 3, 2, 2, 2, 116, 114, 3, 2, 2, 2, 117, 119, 7, 6, 2, 2, 118, 117, 3, 2, 2, 2, 118, 119, 3, 2, 2, 2, 119, 120, 3, 2, 2, 2, 120, 121, 7, 7, 2, 2, 121, 126, 3, 2, 2, 2, 122, 123, 12, 17, 2, 2, 123, 124, 9, 14, 2, 2, 124, 126, 7, 33, 2, 2, 125, 60, 3, 2, 2, 2, 125, 63, 3, 2, 2, 2, 125, 66, 3, 2, 2, 2, 125, 69, 3, 2, 2, 2, 125, 72, 3, 2, 2, 2, 125, 77, 3, 2, 2, 2, 125, 82, 3, 2, 2, 2, 125, 85, 3, 2, 2, 2, 125, 88, 3, 2, 2, 2, 125, 91, 3, 2, 2, 2, 125, 94, 3, 2, 2, 2, 125, 97, 3, 2, 2, 2, 125, 100, 3, 2, 2, 2, 125, 103, 3, 2, 2, 2, 125, 106, 3, 2, 2, 2, 125, 122, 3, 2, 2, 2, 126, 129, 3, 2, 2, 2, 127, 125, 3, 2, 2, 2, 127, 128, 3, 2, 2, 2, 128, 3, 3, 2, 2, 2, 129, 127, 3, 2, 2, 2, 9, 21, 25, 58, 114, 118, 125, 127] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 50, 122, 4, 2, 9, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 23, 10, 2, 12, 2, 14, 2, 26, 11, 2, 3, 2, 5, 2, 29, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 63, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 79, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 117, 10, 2, 12, 2, 14, 2, 120, 11, 2, 3, 2, 2, 3, 2, 3, 2, 2, 15, 3, 2, 45, 46, 4, 2, 18, 19, 31, 32, 4, 2, 35, 35, 38, 38, 4, 2, 36, 36, 39, 39, 4, 2, 37, 37, 40, 40, 4, 2, 45, 45, 48, 48, 3, 2, 20, 22, 3, 2, 18, 19, 3, 2, 24, 25, 3, 2, 10, 11, 3, 2, 12, 13, 3, 2, 10, 13, 3, 2, 14, 15, 2, 153, 2, 62, 3, 2, 2, 2, 4, 5, 8, 2, 1, 2, 5, 63, 7, 43, 2, 2, 6, 63, 7, 44, 2, 2, 7, 63, 7, 42, 2, 2, 8, 63, 7, 47, 2, 2, 9, 63, 9, 2, 2, 2, 10, 63, 7, 48, 2, 2, 11, 12, 7, 8, 2, 2, 12, 13, 7, 45, 2, 2, 13, 63, 7, 9, 2, 2, 14, 15, 7, 3, 2, 2, 15, 16, 5, 2, 2, 2, 16, 17, 7, 4, 2, 2, 17, 63, 3, 2, 2, 2, 18, 19, 7, 5, 2, 2, 19, 24, 5, 2, 2, 2, 20, 21, 7, 6, 2, 2, 21, 23, 5, 2, 2, 2, 22, 20, 3, 2, 2, 2, 23, 26, 3, 2, 2, 2, 24, 22, 3, 2, 2, 2, 24, 25, 3, 2, 2, 2, 25, 28, 3, 2, 2, 2, 26, 24, 3, 2, 2, 2, 27, 29, 7, 6, 2, 2, 28, 27, 3, 2, 2, 2, 28, 29, 3, 2, 2, 2, 29, 30, 3, 2, 2, 2, 30, 31, 7, 7, 2, 2, 31, 63, 3, 2, 2, 2, 32, 63, 7, 34, 2, 2, 33, 34, 9, 3, 2, 2, 34, 63, 5, 2, 2, 21, 35, 36, 9, 4, 2, 2, 36, 37, 7, 3, 2, 2, 37, 38, 5, 2, 2, 2, 38, 39, 7, 6, 2, 2, 39, 40, 5, 2, 2, 2, 40, 41, 7, 4, 2, 2, 41, 63, 3, 2, 2, 2, 42, 43, 9, 5, 2, 2, 43, 44, 7, 3, 2, 2, 44, 45, 5, 2, 2, 2, 45, 46, 7, 6, 2, 2, 46, 47, 5, 2, 2, 2, 47, 48, 7, 4, 2, 2, 48, 63, 3, 2, 2, 2, 49, 50, 9, 6, 2, 2, 50, 51, 7, 3, 2, 2, 51, 52, 5, 2, 2, 2, 52, 53, 7, 6, 2, 2, 53, 54, 5, 2, 2, 2, 54, 55, 7, 4, 2, 2, 55, 63, 3, 2, 2, 2, 56, 57, 7, 41, 2, 2, 57, 58, 7, 3, 2, 2, 58, 59, 9, 7, 2, 2, 59, 63, 7, 4, 2, 2, 60, 61, 7, 17, 2, 2, 61, 63, 5, 2, 2, 3, 62, 4, 3, 2, 2, 2, 62, 6, 3, 2, 2, 2, 62, 7, 3, 2, 2, 2, 62, 8, 3, 2, 2, 2, 62, 9, 3, 2, 2, 2, 62, 10, 3, 2, 2, 2, 62, 11, 3, 2, 2, 2, 62, 14, 3, 2, 2, 2, 62, 18, 3, 2, 2, 2, 62, 32, 3, 2, 2, 2, 62, 33, 3, 2, 2, 2, 62, 35, 3, 2, 2, 2, 62, 42, 3, 2, 2, 2, 62, 49, 3, 2, 2, 2, 62, 56, 3, 2, 2, 2, 62, 60, 3, 2, 2, 2, 63, 118, 3, 2, 2, 2, 64, 65, 12, 22, 2, 2, 65, 66, 7, 23, 2, 2, 66, 117, 5, 2, 2, 23, 67, 68, 12, 20, 2, 2, 68, 69, 9, 8, 2, 2, 69, 117, 5, 2, 2, 21, 70, 71, 12, 19, 2, 2, 71, 72, 9, 9, 2, 2, 72, 117, 5, 2, 2, 20, 73, 74, 12, 18, 2, 2, 74, 75, 9, 10, 2, 2, 75, 117, 5, 2, 2, 19, 76, 78, 12, 17, 2, 2, 77, 79, 7, 32, 2, 2, 78, 77, 3, 2, 2, 2, 78, 79, 3, 2, 2, 2, 79, 80, 3, 2, 2, 2, 80, 81, 7, 33, 2, 2, 81, 117, 5, 2, 2, 18, 82, 83, 12, 12, 2, 2, 83, 84, 9, 11, 2, 2, 84, 85, 9, 7, 2, 2, 85, 86, 9, 11, 2, 2, 86, 117, 5, 2, 2, 13, 87, 88, 12, 11, 2, 2, 88, 89, 9, 12, 2, 2, 89, 90, 9, 7, 2, 2, 90, 91, 9, 12, 2, 2, 91, 117, 5, 2, 2, 12, 92, 93, 12, 10, 2, 2, 93, 94, 9, 13, 2, 2, 94, 117, 5, 2, 2, 11, 95, 96, 12, 9, 2, 2, 96, 97, 9, 14, 2, 2, 97, 117, 5, 2, 2, 10, 98, 99, 12, 8, 2, 2, 99, 100, 7, 26, 2, 2, 100, 117, 5, 2, 2, 9, 101, 102, 12, 7, 2, 2, 102, 103, 7, 28, 2, 2, 103, 117, 5, 2, 2, 8, 104, 105, 12, 6, 2, 2, 105, 106, 7, 27, 2, 2, 106, 117, 5, 2, 2, 7, 107, 108, 12, 5, 2, 2, 108, 109, 7, 29, 2, 2, 109, 117, 5, 2, 2, 6, 110, 111, 12, 4, 2, 2, 111, 112, 7, 30, 2, 2, 112, 117, 5, 2, 2, 5, 113, 114, 12, 23, 2, 2, 114, 115, 7, 16, 2, 2, 115, 117, 7, 47, 2, 2, 116, 64, 3, 2, 2, 2, 116, 67, 3, 2, 2, 2, 116, 70, 3, 2, 2, 2, 116, 73, 3, 2, 2, 2, 116, 76, 3, 2, 2, 2, 116, 82, 3, 2, 2, 2, 116, 87, 3, 2, 2, 2, 116, 92, 3, 2, 2, 2, 116, 95, 3, 2, 2, 2, 116, 98, 3, 2, 2, 2, 116, 101, 3, 2, 2, 2, 116, 104, 3, 2, 2, 2, 116, 107, 3, 2, 2, 2, 116, 110, 3, 2, 2, 2, 116, 113, 3, 2, 2, 2, 117, 120, 3, 2, 2, 2, 118, 116, 3, 2, 2, 2, 118, 119, 3, 2, 2, 2, 119, 3, 3, 2, 2, 2, 120, 118, 3, 2, 2, 2, 8, 24, 28, 62, 78, 116, 118] \ No newline at end of file diff --git a/internal/parser/planparserv2/generated/Plan.tokens b/internal/parser/planparserv2/generated/Plan.tokens index e808c9b6391b3..864a9f9ebcd9d 100644 --- a/internal/parser/planparserv2/generated/Plan.tokens +++ b/internal/parser/planparserv2/generated/Plan.tokens @@ -3,69 +3,72 @@ T__1=2 T__2=3 T__3=4 T__4=5 -LT=6 -LE=7 -GT=8 -GE=9 -EQ=10 -NE=11 -LIKE=12 -EXISTS=13 -ADD=14 -SUB=15 -MUL=16 -DIV=17 -MOD=18 -POW=19 -SHL=20 -SHR=21 -BAND=22 -BOR=23 -BXOR=24 -AND=25 -OR=26 -BNOT=27 -NOT=28 -IN=29 -NIN=30 -EmptyTerm=31 -JSONContains=32 -JSONContainsAll=33 -JSONContainsAny=34 -ArrayContains=35 -ArrayContainsAll=36 -ArrayContainsAny=37 -ArrayLength=38 -BooleanConstant=39 -IntegerConstant=40 -FloatingConstant=41 -Identifier=42 -StringLiteral=43 -JSONIdentifier=44 -Whitespace=45 -Newline=46 +LBRACE=6 +RBRACE=7 +LT=8 +LE=9 +GT=10 +GE=11 +EQ=12 +NE=13 +LIKE=14 +EXISTS=15 +ADD=16 +SUB=17 +MUL=18 +DIV=19 +MOD=20 +POW=21 +SHL=22 +SHR=23 +BAND=24 +BOR=25 +BXOR=26 +AND=27 +OR=28 +BNOT=29 +NOT=30 +IN=31 +EmptyArray=32 +JSONContains=33 +JSONContainsAll=34 +JSONContainsAny=35 +ArrayContains=36 +ArrayContainsAll=37 +ArrayContainsAny=38 +ArrayLength=39 +BooleanConstant=40 +IntegerConstant=41 +FloatingConstant=42 +Identifier=43 +Meta=44 +StringLiteral=45 +JSONIdentifier=46 +Whitespace=47 +Newline=48 '('=1 ')'=2 '['=3 ','=4 ']'=5 -'<'=6 -'<='=7 -'>'=8 -'>='=9 -'=='=10 -'!='=11 -'+'=14 -'-'=15 -'*'=16 -'/'=17 -'%'=18 -'**'=19 -'<<'=20 -'>>'=21 -'&'=22 -'|'=23 -'^'=24 -'~'=27 -'in'=29 -'not in'=30 +'{'=6 +'}'=7 +'<'=8 +'<='=9 +'>'=10 +'>='=11 +'=='=12 +'!='=13 +'+'=16 +'-'=17 +'*'=18 +'/'=19 +'%'=20 +'**'=21 +'<<'=22 +'>>'=23 +'&'=24 +'|'=25 +'^'=26 +'~'=29 +'$meta'=44 diff --git a/internal/parser/planparserv2/generated/PlanLexer.interp b/internal/parser/planparserv2/generated/PlanLexer.interp index e4294edea7641..e6355e17504c7 100644 --- a/internal/parser/planparserv2/generated/PlanLexer.interp +++ b/internal/parser/planparserv2/generated/PlanLexer.interp @@ -5,6 +5,8 @@ null '[' ',' ']' +'{' +'}' '<' '<=' '>' @@ -28,8 +30,6 @@ null null '~' null -'in' -'not in' null null null @@ -43,6 +43,8 @@ null null null null +'$meta' +null null null null @@ -54,6 +56,8 @@ null null null null +LBRACE +RBRACE LT LE GT @@ -78,8 +82,7 @@ OR BNOT NOT IN -NIN -EmptyTerm +EmptyArray JSONContains JSONContainsAll JSONContainsAny @@ -91,6 +94,7 @@ BooleanConstant IntegerConstant FloatingConstant Identifier +Meta StringLiteral JSONIdentifier Whitespace @@ -102,6 +106,8 @@ T__1 T__2 T__3 T__4 +LBRACE +RBRACE LT LE GT @@ -126,8 +132,7 @@ OR BNOT NOT IN -NIN -EmptyTerm +EmptyArray JSONContains JSONContainsAll JSONContainsAny @@ -139,6 +144,7 @@ BooleanConstant IntegerConstant FloatingConstant Identifier +Meta StringLiteral JSONIdentifier EncodingPrefix @@ -177,4 +183,4 @@ mode names: DEFAULT_MODE atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 48, 754, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 180, 10, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 194, 10, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 226, 10, 26, 3, 27, 3, 27, 3, 27, 3, 27, 5, 27, 232, 10, 27, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 5, 29, 240, 10, 29, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 7, 32, 255, 10, 32, 12, 32, 14, 32, 258, 11, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 288, 10, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, 324, 10, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 5, 35, 360, 10, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 5, 36, 390, 10, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 5, 37, 428, 10, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 466, 10, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 5, 39, 492, 10, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 521, 10, 40, 3, 41, 3, 41, 3, 41, 3, 41, 5, 41, 527, 10, 41, 3, 42, 3, 42, 5, 42, 531, 10, 42, 3, 43, 3, 43, 3, 43, 7, 43, 536, 10, 43, 12, 43, 14, 43, 539, 11, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 5, 43, 546, 10, 43, 3, 44, 5, 44, 549, 10, 44, 3, 44, 3, 44, 5, 44, 553, 10, 44, 3, 44, 3, 44, 3, 44, 5, 44, 558, 10, 44, 3, 44, 5, 44, 561, 10, 44, 3, 45, 3, 45, 3, 45, 3, 45, 5, 45, 567, 10, 45, 3, 45, 3, 45, 6, 45, 571, 10, 45, 13, 45, 14, 45, 572, 3, 46, 3, 46, 3, 46, 5, 46, 578, 10, 46, 3, 47, 6, 47, 581, 10, 47, 13, 47, 14, 47, 582, 3, 48, 6, 48, 586, 10, 48, 13, 48, 14, 48, 587, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 5, 49, 597, 10, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 5, 50, 606, 10, 50, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, 53, 3, 53, 6, 53, 615, 10, 53, 13, 53, 14, 53, 616, 3, 54, 3, 54, 7, 54, 621, 10, 54, 12, 54, 14, 54, 624, 11, 54, 3, 54, 5, 54, 627, 10, 54, 3, 55, 3, 55, 7, 55, 631, 10, 55, 12, 55, 14, 55, 634, 11, 55, 3, 56, 3, 56, 3, 56, 3, 56, 3, 57, 3, 57, 3, 58, 3, 58, 3, 59, 3, 59, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 5, 61, 661, 10, 61, 3, 62, 3, 62, 5, 62, 665, 10, 62, 3, 62, 3, 62, 3, 62, 5, 62, 670, 10, 62, 3, 63, 3, 63, 3, 63, 3, 63, 5, 63, 676, 10, 63, 3, 63, 3, 63, 3, 64, 5, 64, 681, 10, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 5, 64, 688, 10, 64, 3, 65, 3, 65, 5, 65, 692, 10, 65, 3, 65, 3, 65, 3, 66, 6, 66, 697, 10, 66, 13, 66, 14, 66, 698, 3, 67, 5, 67, 702, 10, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 5, 67, 709, 10, 67, 3, 68, 6, 68, 712, 10, 68, 13, 68, 14, 68, 713, 3, 69, 3, 69, 5, 69, 718, 10, 69, 3, 69, 3, 69, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 5, 70, 727, 10, 70, 3, 70, 5, 70, 730, 10, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 5, 70, 737, 10, 70, 3, 71, 6, 71, 740, 10, 71, 13, 71, 14, 71, 741, 3, 71, 3, 71, 3, 72, 3, 72, 5, 72, 748, 10, 72, 3, 72, 5, 72, 751, 10, 72, 3, 72, 3, 72, 2, 2, 73, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 2, 93, 2, 95, 2, 97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2, 113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 2, 125, 2, 127, 2, 129, 2, 131, 2, 133, 2, 135, 2, 137, 2, 139, 2, 141, 47, 143, 48, 3, 2, 18, 5, 2, 78, 78, 87, 87, 119, 119, 6, 2, 12, 12, 15, 15, 36, 36, 94, 94, 6, 2, 12, 12, 15, 15, 41, 41, 94, 94, 5, 2, 67, 92, 97, 97, 99, 124, 3, 2, 50, 59, 4, 2, 68, 68, 100, 100, 3, 2, 50, 51, 4, 2, 90, 90, 122, 122, 3, 2, 51, 59, 3, 2, 50, 57, 5, 2, 50, 59, 67, 72, 99, 104, 4, 2, 71, 71, 103, 103, 4, 2, 45, 45, 47, 47, 4, 2, 82, 82, 114, 114, 12, 2, 36, 36, 41, 41, 65, 65, 94, 94, 99, 100, 104, 104, 112, 112, 116, 116, 118, 118, 120, 120, 4, 2, 11, 11, 34, 34, 2, 793, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 141, 3, 2, 2, 2, 2, 143, 3, 2, 2, 2, 3, 145, 3, 2, 2, 2, 5, 147, 3, 2, 2, 2, 7, 149, 3, 2, 2, 2, 9, 151, 3, 2, 2, 2, 11, 153, 3, 2, 2, 2, 13, 155, 3, 2, 2, 2, 15, 157, 3, 2, 2, 2, 17, 160, 3, 2, 2, 2, 19, 162, 3, 2, 2, 2, 21, 165, 3, 2, 2, 2, 23, 168, 3, 2, 2, 2, 25, 179, 3, 2, 2, 2, 27, 193, 3, 2, 2, 2, 29, 195, 3, 2, 2, 2, 31, 197, 3, 2, 2, 2, 33, 199, 3, 2, 2, 2, 35, 201, 3, 2, 2, 2, 37, 203, 3, 2, 2, 2, 39, 205, 3, 2, 2, 2, 41, 208, 3, 2, 2, 2, 43, 211, 3, 2, 2, 2, 45, 214, 3, 2, 2, 2, 47, 216, 3, 2, 2, 2, 49, 218, 3, 2, 2, 2, 51, 225, 3, 2, 2, 2, 53, 231, 3, 2, 2, 2, 55, 233, 3, 2, 2, 2, 57, 239, 3, 2, 2, 2, 59, 241, 3, 2, 2, 2, 61, 244, 3, 2, 2, 2, 63, 251, 3, 2, 2, 2, 65, 287, 3, 2, 2, 2, 67, 323, 3, 2, 2, 2, 69, 359, 3, 2, 2, 2, 71, 389, 3, 2, 2, 2, 73, 427, 3, 2, 2, 2, 75, 465, 3, 2, 2, 2, 77, 491, 3, 2, 2, 2, 79, 520, 3, 2, 2, 2, 81, 526, 3, 2, 2, 2, 83, 530, 3, 2, 2, 2, 85, 545, 3, 2, 2, 2, 87, 548, 3, 2, 2, 2, 89, 562, 3, 2, 2, 2, 91, 577, 3, 2, 2, 2, 93, 580, 3, 2, 2, 2, 95, 585, 3, 2, 2, 2, 97, 596, 3, 2, 2, 2, 99, 605, 3, 2, 2, 2, 101, 607, 3, 2, 2, 2, 103, 609, 3, 2, 2, 2, 105, 611, 3, 2, 2, 2, 107, 626, 3, 2, 2, 2, 109, 628, 3, 2, 2, 2, 111, 635, 3, 2, 2, 2, 113, 639, 3, 2, 2, 2, 115, 641, 3, 2, 2, 2, 117, 643, 3, 2, 2, 2, 119, 645, 3, 2, 2, 2, 121, 660, 3, 2, 2, 2, 123, 669, 3, 2, 2, 2, 125, 671, 3, 2, 2, 2, 127, 687, 3, 2, 2, 2, 129, 689, 3, 2, 2, 2, 131, 696, 3, 2, 2, 2, 133, 708, 3, 2, 2, 2, 135, 711, 3, 2, 2, 2, 137, 715, 3, 2, 2, 2, 139, 736, 3, 2, 2, 2, 141, 739, 3, 2, 2, 2, 143, 750, 3, 2, 2, 2, 145, 146, 7, 42, 2, 2, 146, 4, 3, 2, 2, 2, 147, 148, 7, 43, 2, 2, 148, 6, 3, 2, 2, 2, 149, 150, 7, 93, 2, 2, 150, 8, 3, 2, 2, 2, 151, 152, 7, 46, 2, 2, 152, 10, 3, 2, 2, 2, 153, 154, 7, 95, 2, 2, 154, 12, 3, 2, 2, 2, 155, 156, 7, 62, 2, 2, 156, 14, 3, 2, 2, 2, 157, 158, 7, 62, 2, 2, 158, 159, 7, 63, 2, 2, 159, 16, 3, 2, 2, 2, 160, 161, 7, 64, 2, 2, 161, 18, 3, 2, 2, 2, 162, 163, 7, 64, 2, 2, 163, 164, 7, 63, 2, 2, 164, 20, 3, 2, 2, 2, 165, 166, 7, 63, 2, 2, 166, 167, 7, 63, 2, 2, 167, 22, 3, 2, 2, 2, 168, 169, 7, 35, 2, 2, 169, 170, 7, 63, 2, 2, 170, 24, 3, 2, 2, 2, 171, 172, 7, 110, 2, 2, 172, 173, 7, 107, 2, 2, 173, 174, 7, 109, 2, 2, 174, 180, 7, 103, 2, 2, 175, 176, 7, 78, 2, 2, 176, 177, 7, 75, 2, 2, 177, 178, 7, 77, 2, 2, 178, 180, 7, 71, 2, 2, 179, 171, 3, 2, 2, 2, 179, 175, 3, 2, 2, 2, 180, 26, 3, 2, 2, 2, 181, 182, 7, 103, 2, 2, 182, 183, 7, 122, 2, 2, 183, 184, 7, 107, 2, 2, 184, 185, 7, 117, 2, 2, 185, 186, 7, 118, 2, 2, 186, 194, 7, 117, 2, 2, 187, 188, 7, 71, 2, 2, 188, 189, 7, 90, 2, 2, 189, 190, 7, 75, 2, 2, 190, 191, 7, 85, 2, 2, 191, 192, 7, 86, 2, 2, 192, 194, 7, 85, 2, 2, 193, 181, 3, 2, 2, 2, 193, 187, 3, 2, 2, 2, 194, 28, 3, 2, 2, 2, 195, 196, 7, 45, 2, 2, 196, 30, 3, 2, 2, 2, 197, 198, 7, 47, 2, 2, 198, 32, 3, 2, 2, 2, 199, 200, 7, 44, 2, 2, 200, 34, 3, 2, 2, 2, 201, 202, 7, 49, 2, 2, 202, 36, 3, 2, 2, 2, 203, 204, 7, 39, 2, 2, 204, 38, 3, 2, 2, 2, 205, 206, 7, 44, 2, 2, 206, 207, 7, 44, 2, 2, 207, 40, 3, 2, 2, 2, 208, 209, 7, 62, 2, 2, 209, 210, 7, 62, 2, 2, 210, 42, 3, 2, 2, 2, 211, 212, 7, 64, 2, 2, 212, 213, 7, 64, 2, 2, 213, 44, 3, 2, 2, 2, 214, 215, 7, 40, 2, 2, 215, 46, 3, 2, 2, 2, 216, 217, 7, 126, 2, 2, 217, 48, 3, 2, 2, 2, 218, 219, 7, 96, 2, 2, 219, 50, 3, 2, 2, 2, 220, 221, 7, 40, 2, 2, 221, 226, 7, 40, 2, 2, 222, 223, 7, 99, 2, 2, 223, 224, 7, 112, 2, 2, 224, 226, 7, 102, 2, 2, 225, 220, 3, 2, 2, 2, 225, 222, 3, 2, 2, 2, 226, 52, 3, 2, 2, 2, 227, 228, 7, 126, 2, 2, 228, 232, 7, 126, 2, 2, 229, 230, 7, 113, 2, 2, 230, 232, 7, 116, 2, 2, 231, 227, 3, 2, 2, 2, 231, 229, 3, 2, 2, 2, 232, 54, 3, 2, 2, 2, 233, 234, 7, 128, 2, 2, 234, 56, 3, 2, 2, 2, 235, 240, 7, 35, 2, 2, 236, 237, 7, 112, 2, 2, 237, 238, 7, 113, 2, 2, 238, 240, 7, 118, 2, 2, 239, 235, 3, 2, 2, 2, 239, 236, 3, 2, 2, 2, 240, 58, 3, 2, 2, 2, 241, 242, 7, 107, 2, 2, 242, 243, 7, 112, 2, 2, 243, 60, 3, 2, 2, 2, 244, 245, 7, 112, 2, 2, 245, 246, 7, 113, 2, 2, 246, 247, 7, 118, 2, 2, 247, 248, 7, 34, 2, 2, 248, 249, 7, 107, 2, 2, 249, 250, 7, 112, 2, 2, 250, 62, 3, 2, 2, 2, 251, 256, 7, 93, 2, 2, 252, 255, 5, 141, 71, 2, 253, 255, 5, 143, 72, 2, 254, 252, 3, 2, 2, 2, 254, 253, 3, 2, 2, 2, 255, 258, 3, 2, 2, 2, 256, 254, 3, 2, 2, 2, 256, 257, 3, 2, 2, 2, 257, 259, 3, 2, 2, 2, 258, 256, 3, 2, 2, 2, 259, 260, 7, 95, 2, 2, 260, 64, 3, 2, 2, 2, 261, 262, 7, 108, 2, 2, 262, 263, 7, 117, 2, 2, 263, 264, 7, 113, 2, 2, 264, 265, 7, 112, 2, 2, 265, 266, 7, 97, 2, 2, 266, 267, 7, 101, 2, 2, 267, 268, 7, 113, 2, 2, 268, 269, 7, 112, 2, 2, 269, 270, 7, 118, 2, 2, 270, 271, 7, 99, 2, 2, 271, 272, 7, 107, 2, 2, 272, 273, 7, 112, 2, 2, 273, 288, 7, 117, 2, 2, 274, 275, 7, 76, 2, 2, 275, 276, 7, 85, 2, 2, 276, 277, 7, 81, 2, 2, 277, 278, 7, 80, 2, 2, 278, 279, 7, 97, 2, 2, 279, 280, 7, 69, 2, 2, 280, 281, 7, 81, 2, 2, 281, 282, 7, 80, 2, 2, 282, 283, 7, 86, 2, 2, 283, 284, 7, 67, 2, 2, 284, 285, 7, 75, 2, 2, 285, 286, 7, 80, 2, 2, 286, 288, 7, 85, 2, 2, 287, 261, 3, 2, 2, 2, 287, 274, 3, 2, 2, 2, 288, 66, 3, 2, 2, 2, 289, 290, 7, 108, 2, 2, 290, 291, 7, 117, 2, 2, 291, 292, 7, 113, 2, 2, 292, 293, 7, 112, 2, 2, 293, 294, 7, 97, 2, 2, 294, 295, 7, 101, 2, 2, 295, 296, 7, 113, 2, 2, 296, 297, 7, 112, 2, 2, 297, 298, 7, 118, 2, 2, 298, 299, 7, 99, 2, 2, 299, 300, 7, 107, 2, 2, 300, 301, 7, 112, 2, 2, 301, 302, 7, 117, 2, 2, 302, 303, 7, 97, 2, 2, 303, 304, 7, 99, 2, 2, 304, 305, 7, 110, 2, 2, 305, 324, 7, 110, 2, 2, 306, 307, 7, 76, 2, 2, 307, 308, 7, 85, 2, 2, 308, 309, 7, 81, 2, 2, 309, 310, 7, 80, 2, 2, 310, 311, 7, 97, 2, 2, 311, 312, 7, 69, 2, 2, 312, 313, 7, 81, 2, 2, 313, 314, 7, 80, 2, 2, 314, 315, 7, 86, 2, 2, 315, 316, 7, 67, 2, 2, 316, 317, 7, 75, 2, 2, 317, 318, 7, 80, 2, 2, 318, 319, 7, 85, 2, 2, 319, 320, 7, 97, 2, 2, 320, 321, 7, 67, 2, 2, 321, 322, 7, 78, 2, 2, 322, 324, 7, 78, 2, 2, 323, 289, 3, 2, 2, 2, 323, 306, 3, 2, 2, 2, 324, 68, 3, 2, 2, 2, 325, 326, 7, 108, 2, 2, 326, 327, 7, 117, 2, 2, 327, 328, 7, 113, 2, 2, 328, 329, 7, 112, 2, 2, 329, 330, 7, 97, 2, 2, 330, 331, 7, 101, 2, 2, 331, 332, 7, 113, 2, 2, 332, 333, 7, 112, 2, 2, 333, 334, 7, 118, 2, 2, 334, 335, 7, 99, 2, 2, 335, 336, 7, 107, 2, 2, 336, 337, 7, 112, 2, 2, 337, 338, 7, 117, 2, 2, 338, 339, 7, 97, 2, 2, 339, 340, 7, 99, 2, 2, 340, 341, 7, 112, 2, 2, 341, 360, 7, 123, 2, 2, 342, 343, 7, 76, 2, 2, 343, 344, 7, 85, 2, 2, 344, 345, 7, 81, 2, 2, 345, 346, 7, 80, 2, 2, 346, 347, 7, 97, 2, 2, 347, 348, 7, 69, 2, 2, 348, 349, 7, 81, 2, 2, 349, 350, 7, 80, 2, 2, 350, 351, 7, 86, 2, 2, 351, 352, 7, 67, 2, 2, 352, 353, 7, 75, 2, 2, 353, 354, 7, 80, 2, 2, 354, 355, 7, 85, 2, 2, 355, 356, 7, 97, 2, 2, 356, 357, 7, 67, 2, 2, 357, 358, 7, 80, 2, 2, 358, 360, 7, 91, 2, 2, 359, 325, 3, 2, 2, 2, 359, 342, 3, 2, 2, 2, 360, 70, 3, 2, 2, 2, 361, 362, 7, 99, 2, 2, 362, 363, 7, 116, 2, 2, 363, 364, 7, 116, 2, 2, 364, 365, 7, 99, 2, 2, 365, 366, 7, 123, 2, 2, 366, 367, 7, 97, 2, 2, 367, 368, 7, 101, 2, 2, 368, 369, 7, 113, 2, 2, 369, 370, 7, 112, 2, 2, 370, 371, 7, 118, 2, 2, 371, 372, 7, 99, 2, 2, 372, 373, 7, 107, 2, 2, 373, 374, 7, 112, 2, 2, 374, 390, 7, 117, 2, 2, 375, 376, 7, 67, 2, 2, 376, 377, 7, 84, 2, 2, 377, 378, 7, 84, 2, 2, 378, 379, 7, 67, 2, 2, 379, 380, 7, 91, 2, 2, 380, 381, 7, 97, 2, 2, 381, 382, 7, 69, 2, 2, 382, 383, 7, 81, 2, 2, 383, 384, 7, 80, 2, 2, 384, 385, 7, 86, 2, 2, 385, 386, 7, 67, 2, 2, 386, 387, 7, 75, 2, 2, 387, 388, 7, 80, 2, 2, 388, 390, 7, 85, 2, 2, 389, 361, 3, 2, 2, 2, 389, 375, 3, 2, 2, 2, 390, 72, 3, 2, 2, 2, 391, 392, 7, 99, 2, 2, 392, 393, 7, 116, 2, 2, 393, 394, 7, 116, 2, 2, 394, 395, 7, 99, 2, 2, 395, 396, 7, 123, 2, 2, 396, 397, 7, 97, 2, 2, 397, 398, 7, 101, 2, 2, 398, 399, 7, 113, 2, 2, 399, 400, 7, 112, 2, 2, 400, 401, 7, 118, 2, 2, 401, 402, 7, 99, 2, 2, 402, 403, 7, 107, 2, 2, 403, 404, 7, 112, 2, 2, 404, 405, 7, 117, 2, 2, 405, 406, 7, 97, 2, 2, 406, 407, 7, 99, 2, 2, 407, 408, 7, 110, 2, 2, 408, 428, 7, 110, 2, 2, 409, 410, 7, 67, 2, 2, 410, 411, 7, 84, 2, 2, 411, 412, 7, 84, 2, 2, 412, 413, 7, 67, 2, 2, 413, 414, 7, 91, 2, 2, 414, 415, 7, 97, 2, 2, 415, 416, 7, 69, 2, 2, 416, 417, 7, 81, 2, 2, 417, 418, 7, 80, 2, 2, 418, 419, 7, 86, 2, 2, 419, 420, 7, 67, 2, 2, 420, 421, 7, 75, 2, 2, 421, 422, 7, 80, 2, 2, 422, 423, 7, 85, 2, 2, 423, 424, 7, 97, 2, 2, 424, 425, 7, 67, 2, 2, 425, 426, 7, 78, 2, 2, 426, 428, 7, 78, 2, 2, 427, 391, 3, 2, 2, 2, 427, 409, 3, 2, 2, 2, 428, 74, 3, 2, 2, 2, 429, 430, 7, 99, 2, 2, 430, 431, 7, 116, 2, 2, 431, 432, 7, 116, 2, 2, 432, 433, 7, 99, 2, 2, 433, 434, 7, 123, 2, 2, 434, 435, 7, 97, 2, 2, 435, 436, 7, 101, 2, 2, 436, 437, 7, 113, 2, 2, 437, 438, 7, 112, 2, 2, 438, 439, 7, 118, 2, 2, 439, 440, 7, 99, 2, 2, 440, 441, 7, 107, 2, 2, 441, 442, 7, 112, 2, 2, 442, 443, 7, 117, 2, 2, 443, 444, 7, 97, 2, 2, 444, 445, 7, 99, 2, 2, 445, 446, 7, 112, 2, 2, 446, 466, 7, 123, 2, 2, 447, 448, 7, 67, 2, 2, 448, 449, 7, 84, 2, 2, 449, 450, 7, 84, 2, 2, 450, 451, 7, 67, 2, 2, 451, 452, 7, 91, 2, 2, 452, 453, 7, 97, 2, 2, 453, 454, 7, 69, 2, 2, 454, 455, 7, 81, 2, 2, 455, 456, 7, 80, 2, 2, 456, 457, 7, 86, 2, 2, 457, 458, 7, 67, 2, 2, 458, 459, 7, 75, 2, 2, 459, 460, 7, 80, 2, 2, 460, 461, 7, 85, 2, 2, 461, 462, 7, 97, 2, 2, 462, 463, 7, 67, 2, 2, 463, 464, 7, 80, 2, 2, 464, 466, 7, 91, 2, 2, 465, 429, 3, 2, 2, 2, 465, 447, 3, 2, 2, 2, 466, 76, 3, 2, 2, 2, 467, 468, 7, 99, 2, 2, 468, 469, 7, 116, 2, 2, 469, 470, 7, 116, 2, 2, 470, 471, 7, 99, 2, 2, 471, 472, 7, 123, 2, 2, 472, 473, 7, 97, 2, 2, 473, 474, 7, 110, 2, 2, 474, 475, 7, 103, 2, 2, 475, 476, 7, 112, 2, 2, 476, 477, 7, 105, 2, 2, 477, 478, 7, 118, 2, 2, 478, 492, 7, 106, 2, 2, 479, 480, 7, 67, 2, 2, 480, 481, 7, 84, 2, 2, 481, 482, 7, 84, 2, 2, 482, 483, 7, 67, 2, 2, 483, 484, 7, 91, 2, 2, 484, 485, 7, 97, 2, 2, 485, 486, 7, 78, 2, 2, 486, 487, 7, 71, 2, 2, 487, 488, 7, 80, 2, 2, 488, 489, 7, 73, 2, 2, 489, 490, 7, 86, 2, 2, 490, 492, 7, 74, 2, 2, 491, 467, 3, 2, 2, 2, 491, 479, 3, 2, 2, 2, 492, 78, 3, 2, 2, 2, 493, 494, 7, 118, 2, 2, 494, 495, 7, 116, 2, 2, 495, 496, 7, 119, 2, 2, 496, 521, 7, 103, 2, 2, 497, 498, 7, 86, 2, 2, 498, 499, 7, 116, 2, 2, 499, 500, 7, 119, 2, 2, 500, 521, 7, 103, 2, 2, 501, 502, 7, 86, 2, 2, 502, 503, 7, 84, 2, 2, 503, 504, 7, 87, 2, 2, 504, 521, 7, 71, 2, 2, 505, 506, 7, 104, 2, 2, 506, 507, 7, 99, 2, 2, 507, 508, 7, 110, 2, 2, 508, 509, 7, 117, 2, 2, 509, 521, 7, 103, 2, 2, 510, 511, 7, 72, 2, 2, 511, 512, 7, 99, 2, 2, 512, 513, 7, 110, 2, 2, 513, 514, 7, 117, 2, 2, 514, 521, 7, 103, 2, 2, 515, 516, 7, 72, 2, 2, 516, 517, 7, 67, 2, 2, 517, 518, 7, 78, 2, 2, 518, 519, 7, 85, 2, 2, 519, 521, 7, 71, 2, 2, 520, 493, 3, 2, 2, 2, 520, 497, 3, 2, 2, 2, 520, 501, 3, 2, 2, 2, 520, 505, 3, 2, 2, 2, 520, 510, 3, 2, 2, 2, 520, 515, 3, 2, 2, 2, 521, 80, 3, 2, 2, 2, 522, 527, 5, 107, 54, 2, 523, 527, 5, 109, 55, 2, 524, 527, 5, 111, 56, 2, 525, 527, 5, 105, 53, 2, 526, 522, 3, 2, 2, 2, 526, 523, 3, 2, 2, 2, 526, 524, 3, 2, 2, 2, 526, 525, 3, 2, 2, 2, 527, 82, 3, 2, 2, 2, 528, 531, 5, 123, 62, 2, 529, 531, 5, 125, 63, 2, 530, 528, 3, 2, 2, 2, 530, 529, 3, 2, 2, 2, 531, 84, 3, 2, 2, 2, 532, 537, 5, 101, 51, 2, 533, 536, 5, 101, 51, 2, 534, 536, 5, 103, 52, 2, 535, 533, 3, 2, 2, 2, 535, 534, 3, 2, 2, 2, 536, 539, 3, 2, 2, 2, 537, 535, 3, 2, 2, 2, 537, 538, 3, 2, 2, 2, 538, 546, 3, 2, 2, 2, 539, 537, 3, 2, 2, 2, 540, 541, 7, 38, 2, 2, 541, 542, 7, 111, 2, 2, 542, 543, 7, 103, 2, 2, 543, 544, 7, 118, 2, 2, 544, 546, 7, 99, 2, 2, 545, 532, 3, 2, 2, 2, 545, 540, 3, 2, 2, 2, 546, 86, 3, 2, 2, 2, 547, 549, 5, 91, 46, 2, 548, 547, 3, 2, 2, 2, 548, 549, 3, 2, 2, 2, 549, 560, 3, 2, 2, 2, 550, 552, 7, 36, 2, 2, 551, 553, 5, 93, 47, 2, 552, 551, 3, 2, 2, 2, 552, 553, 3, 2, 2, 2, 553, 554, 3, 2, 2, 2, 554, 561, 7, 36, 2, 2, 555, 557, 7, 41, 2, 2, 556, 558, 5, 95, 48, 2, 557, 556, 3, 2, 2, 2, 557, 558, 3, 2, 2, 2, 558, 559, 3, 2, 2, 2, 559, 561, 7, 41, 2, 2, 560, 550, 3, 2, 2, 2, 560, 555, 3, 2, 2, 2, 561, 88, 3, 2, 2, 2, 562, 570, 5, 85, 43, 2, 563, 566, 7, 93, 2, 2, 564, 567, 5, 87, 44, 2, 565, 567, 5, 107, 54, 2, 566, 564, 3, 2, 2, 2, 566, 565, 3, 2, 2, 2, 567, 568, 3, 2, 2, 2, 568, 569, 7, 95, 2, 2, 569, 571, 3, 2, 2, 2, 570, 563, 3, 2, 2, 2, 571, 572, 3, 2, 2, 2, 572, 570, 3, 2, 2, 2, 572, 573, 3, 2, 2, 2, 573, 90, 3, 2, 2, 2, 574, 575, 7, 119, 2, 2, 575, 578, 7, 58, 2, 2, 576, 578, 9, 2, 2, 2, 577, 574, 3, 2, 2, 2, 577, 576, 3, 2, 2, 2, 578, 92, 3, 2, 2, 2, 579, 581, 5, 97, 49, 2, 580, 579, 3, 2, 2, 2, 581, 582, 3, 2, 2, 2, 582, 580, 3, 2, 2, 2, 582, 583, 3, 2, 2, 2, 583, 94, 3, 2, 2, 2, 584, 586, 5, 99, 50, 2, 585, 584, 3, 2, 2, 2, 586, 587, 3, 2, 2, 2, 587, 585, 3, 2, 2, 2, 587, 588, 3, 2, 2, 2, 588, 96, 3, 2, 2, 2, 589, 597, 10, 3, 2, 2, 590, 597, 5, 139, 70, 2, 591, 592, 7, 94, 2, 2, 592, 597, 7, 12, 2, 2, 593, 594, 7, 94, 2, 2, 594, 595, 7, 15, 2, 2, 595, 597, 7, 12, 2, 2, 596, 589, 3, 2, 2, 2, 596, 590, 3, 2, 2, 2, 596, 591, 3, 2, 2, 2, 596, 593, 3, 2, 2, 2, 597, 98, 3, 2, 2, 2, 598, 606, 10, 4, 2, 2, 599, 606, 5, 139, 70, 2, 600, 601, 7, 94, 2, 2, 601, 606, 7, 12, 2, 2, 602, 603, 7, 94, 2, 2, 603, 604, 7, 15, 2, 2, 604, 606, 7, 12, 2, 2, 605, 598, 3, 2, 2, 2, 605, 599, 3, 2, 2, 2, 605, 600, 3, 2, 2, 2, 605, 602, 3, 2, 2, 2, 606, 100, 3, 2, 2, 2, 607, 608, 9, 5, 2, 2, 608, 102, 3, 2, 2, 2, 609, 610, 9, 6, 2, 2, 610, 104, 3, 2, 2, 2, 611, 612, 7, 50, 2, 2, 612, 614, 9, 7, 2, 2, 613, 615, 9, 8, 2, 2, 614, 613, 3, 2, 2, 2, 615, 616, 3, 2, 2, 2, 616, 614, 3, 2, 2, 2, 616, 617, 3, 2, 2, 2, 617, 106, 3, 2, 2, 2, 618, 622, 5, 113, 57, 2, 619, 621, 5, 103, 52, 2, 620, 619, 3, 2, 2, 2, 621, 624, 3, 2, 2, 2, 622, 620, 3, 2, 2, 2, 622, 623, 3, 2, 2, 2, 623, 627, 3, 2, 2, 2, 624, 622, 3, 2, 2, 2, 625, 627, 7, 50, 2, 2, 626, 618, 3, 2, 2, 2, 626, 625, 3, 2, 2, 2, 627, 108, 3, 2, 2, 2, 628, 632, 7, 50, 2, 2, 629, 631, 5, 115, 58, 2, 630, 629, 3, 2, 2, 2, 631, 634, 3, 2, 2, 2, 632, 630, 3, 2, 2, 2, 632, 633, 3, 2, 2, 2, 633, 110, 3, 2, 2, 2, 634, 632, 3, 2, 2, 2, 635, 636, 7, 50, 2, 2, 636, 637, 9, 9, 2, 2, 637, 638, 5, 135, 68, 2, 638, 112, 3, 2, 2, 2, 639, 640, 9, 10, 2, 2, 640, 114, 3, 2, 2, 2, 641, 642, 9, 11, 2, 2, 642, 116, 3, 2, 2, 2, 643, 644, 9, 12, 2, 2, 644, 118, 3, 2, 2, 2, 645, 646, 5, 117, 59, 2, 646, 647, 5, 117, 59, 2, 647, 648, 5, 117, 59, 2, 648, 649, 5, 117, 59, 2, 649, 120, 3, 2, 2, 2, 650, 651, 7, 94, 2, 2, 651, 652, 7, 119, 2, 2, 652, 653, 3, 2, 2, 2, 653, 661, 5, 119, 60, 2, 654, 655, 7, 94, 2, 2, 655, 656, 7, 87, 2, 2, 656, 657, 3, 2, 2, 2, 657, 658, 5, 119, 60, 2, 658, 659, 5, 119, 60, 2, 659, 661, 3, 2, 2, 2, 660, 650, 3, 2, 2, 2, 660, 654, 3, 2, 2, 2, 661, 122, 3, 2, 2, 2, 662, 664, 5, 127, 64, 2, 663, 665, 5, 129, 65, 2, 664, 663, 3, 2, 2, 2, 664, 665, 3, 2, 2, 2, 665, 670, 3, 2, 2, 2, 666, 667, 5, 131, 66, 2, 667, 668, 5, 129, 65, 2, 668, 670, 3, 2, 2, 2, 669, 662, 3, 2, 2, 2, 669, 666, 3, 2, 2, 2, 670, 124, 3, 2, 2, 2, 671, 672, 7, 50, 2, 2, 672, 675, 9, 9, 2, 2, 673, 676, 5, 133, 67, 2, 674, 676, 5, 135, 68, 2, 675, 673, 3, 2, 2, 2, 675, 674, 3, 2, 2, 2, 676, 677, 3, 2, 2, 2, 677, 678, 5, 137, 69, 2, 678, 126, 3, 2, 2, 2, 679, 681, 5, 131, 66, 2, 680, 679, 3, 2, 2, 2, 680, 681, 3, 2, 2, 2, 681, 682, 3, 2, 2, 2, 682, 683, 7, 48, 2, 2, 683, 688, 5, 131, 66, 2, 684, 685, 5, 131, 66, 2, 685, 686, 7, 48, 2, 2, 686, 688, 3, 2, 2, 2, 687, 680, 3, 2, 2, 2, 687, 684, 3, 2, 2, 2, 688, 128, 3, 2, 2, 2, 689, 691, 9, 13, 2, 2, 690, 692, 9, 14, 2, 2, 691, 690, 3, 2, 2, 2, 691, 692, 3, 2, 2, 2, 692, 693, 3, 2, 2, 2, 693, 694, 5, 131, 66, 2, 694, 130, 3, 2, 2, 2, 695, 697, 5, 103, 52, 2, 696, 695, 3, 2, 2, 2, 697, 698, 3, 2, 2, 2, 698, 696, 3, 2, 2, 2, 698, 699, 3, 2, 2, 2, 699, 132, 3, 2, 2, 2, 700, 702, 5, 135, 68, 2, 701, 700, 3, 2, 2, 2, 701, 702, 3, 2, 2, 2, 702, 703, 3, 2, 2, 2, 703, 704, 7, 48, 2, 2, 704, 709, 5, 135, 68, 2, 705, 706, 5, 135, 68, 2, 706, 707, 7, 48, 2, 2, 707, 709, 3, 2, 2, 2, 708, 701, 3, 2, 2, 2, 708, 705, 3, 2, 2, 2, 709, 134, 3, 2, 2, 2, 710, 712, 5, 117, 59, 2, 711, 710, 3, 2, 2, 2, 712, 713, 3, 2, 2, 2, 713, 711, 3, 2, 2, 2, 713, 714, 3, 2, 2, 2, 714, 136, 3, 2, 2, 2, 715, 717, 9, 15, 2, 2, 716, 718, 9, 14, 2, 2, 717, 716, 3, 2, 2, 2, 717, 718, 3, 2, 2, 2, 718, 719, 3, 2, 2, 2, 719, 720, 5, 131, 66, 2, 720, 138, 3, 2, 2, 2, 721, 722, 7, 94, 2, 2, 722, 737, 9, 16, 2, 2, 723, 724, 7, 94, 2, 2, 724, 726, 5, 115, 58, 2, 725, 727, 5, 115, 58, 2, 726, 725, 3, 2, 2, 2, 726, 727, 3, 2, 2, 2, 727, 729, 3, 2, 2, 2, 728, 730, 5, 115, 58, 2, 729, 728, 3, 2, 2, 2, 729, 730, 3, 2, 2, 2, 730, 737, 3, 2, 2, 2, 731, 732, 7, 94, 2, 2, 732, 733, 7, 122, 2, 2, 733, 734, 3, 2, 2, 2, 734, 737, 5, 135, 68, 2, 735, 737, 5, 121, 61, 2, 736, 721, 3, 2, 2, 2, 736, 723, 3, 2, 2, 2, 736, 731, 3, 2, 2, 2, 736, 735, 3, 2, 2, 2, 737, 140, 3, 2, 2, 2, 738, 740, 9, 17, 2, 2, 739, 738, 3, 2, 2, 2, 740, 741, 3, 2, 2, 2, 741, 739, 3, 2, 2, 2, 741, 742, 3, 2, 2, 2, 742, 743, 3, 2, 2, 2, 743, 744, 8, 71, 2, 2, 744, 142, 3, 2, 2, 2, 745, 747, 7, 15, 2, 2, 746, 748, 7, 12, 2, 2, 747, 746, 3, 2, 2, 2, 747, 748, 3, 2, 2, 2, 748, 751, 3, 2, 2, 2, 749, 751, 7, 12, 2, 2, 750, 745, 3, 2, 2, 2, 750, 749, 3, 2, 2, 2, 751, 752, 3, 2, 2, 2, 752, 753, 8, 72, 2, 2, 753, 144, 3, 2, 2, 2, 56, 2, 179, 193, 225, 231, 239, 254, 256, 287, 323, 359, 389, 427, 465, 491, 520, 526, 530, 535, 537, 545, 548, 552, 557, 560, 566, 572, 577, 582, 587, 596, 605, 616, 622, 626, 632, 660, 664, 669, 675, 680, 687, 691, 698, 701, 708, 713, 717, 726, 729, 736, 741, 747, 750, 3, 8, 2, 2] \ No newline at end of file +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 50, 760, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, 188, 10, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 5, 16, 202, 10, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 5, 28, 234, 10, 28, 3, 29, 3, 29, 3, 29, 3, 29, 5, 29, 240, 10, 29, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 5, 31, 248, 10, 31, 3, 32, 3, 32, 3, 32, 3, 32, 5, 32, 254, 10, 32, 3, 33, 3, 33, 3, 33, 7, 33, 259, 10, 33, 12, 33, 14, 33, 262, 11, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, 292, 10, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 5, 35, 328, 10, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 5, 36, 364, 10, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 5, 37, 394, 10, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 432, 10, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 5, 39, 470, 10, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 496, 10, 40, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 5, 41, 525, 10, 41, 3, 42, 3, 42, 3, 42, 3, 42, 5, 42, 531, 10, 42, 3, 43, 3, 43, 5, 43, 535, 10, 43, 3, 44, 3, 44, 3, 44, 7, 44, 540, 10, 44, 12, 44, 14, 44, 543, 11, 44, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 46, 5, 46, 552, 10, 46, 3, 46, 3, 46, 5, 46, 556, 10, 46, 3, 46, 3, 46, 3, 46, 5, 46, 561, 10, 46, 3, 46, 5, 46, 564, 10, 46, 3, 47, 3, 47, 5, 47, 568, 10, 47, 3, 47, 3, 47, 3, 47, 5, 47, 573, 10, 47, 3, 47, 3, 47, 6, 47, 577, 10, 47, 13, 47, 14, 47, 578, 3, 48, 3, 48, 3, 48, 5, 48, 584, 10, 48, 3, 49, 6, 49, 587, 10, 49, 13, 49, 14, 49, 588, 3, 50, 6, 50, 592, 10, 50, 13, 50, 14, 50, 593, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 5, 51, 603, 10, 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 5, 52, 612, 10, 52, 3, 53, 3, 53, 3, 54, 3, 54, 3, 55, 3, 55, 3, 55, 6, 55, 621, 10, 55, 13, 55, 14, 55, 622, 3, 56, 3, 56, 7, 56, 627, 10, 56, 12, 56, 14, 56, 630, 11, 56, 3, 56, 5, 56, 633, 10, 56, 3, 57, 3, 57, 7, 57, 637, 10, 57, 12, 57, 14, 57, 640, 11, 57, 3, 58, 3, 58, 3, 58, 3, 58, 3, 59, 3, 59, 3, 60, 3, 60, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 5, 63, 667, 10, 63, 3, 64, 3, 64, 5, 64, 671, 10, 64, 3, 64, 3, 64, 3, 64, 5, 64, 676, 10, 64, 3, 65, 3, 65, 3, 65, 3, 65, 5, 65, 682, 10, 65, 3, 65, 3, 65, 3, 66, 5, 66, 687, 10, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 5, 66, 694, 10, 66, 3, 67, 3, 67, 5, 67, 698, 10, 67, 3, 67, 3, 67, 3, 68, 6, 68, 703, 10, 68, 13, 68, 14, 68, 704, 3, 69, 5, 69, 708, 10, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 5, 69, 715, 10, 69, 3, 70, 6, 70, 718, 10, 70, 13, 70, 14, 70, 719, 3, 71, 3, 71, 5, 71, 724, 10, 71, 3, 71, 3, 71, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 5, 72, 733, 10, 72, 3, 72, 5, 72, 736, 10, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 5, 72, 743, 10, 72, 3, 73, 6, 73, 746, 10, 73, 13, 73, 14, 73, 747, 3, 73, 3, 73, 3, 74, 3, 74, 5, 74, 754, 10, 74, 3, 74, 5, 74, 757, 10, 74, 3, 74, 3, 74, 2, 2, 75, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 95, 2, 97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2, 113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 2, 125, 2, 127, 2, 129, 2, 131, 2, 133, 2, 135, 2, 137, 2, 139, 2, 141, 2, 143, 2, 145, 49, 147, 50, 3, 2, 18, 5, 2, 78, 78, 87, 87, 119, 119, 6, 2, 12, 12, 15, 15, 36, 36, 94, 94, 6, 2, 12, 12, 15, 15, 41, 41, 94, 94, 5, 2, 67, 92, 97, 97, 99, 124, 3, 2, 50, 59, 4, 2, 68, 68, 100, 100, 3, 2, 50, 51, 4, 2, 90, 90, 122, 122, 3, 2, 51, 59, 3, 2, 50, 57, 5, 2, 50, 59, 67, 72, 99, 104, 4, 2, 71, 71, 103, 103, 4, 2, 45, 45, 47, 47, 4, 2, 82, 82, 114, 114, 12, 2, 36, 36, 41, 41, 65, 65, 94, 94, 99, 100, 104, 104, 112, 112, 116, 116, 118, 118, 120, 120, 4, 2, 11, 11, 34, 34, 2, 800, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 2, 145, 3, 2, 2, 2, 2, 147, 3, 2, 2, 2, 3, 149, 3, 2, 2, 2, 5, 151, 3, 2, 2, 2, 7, 153, 3, 2, 2, 2, 9, 155, 3, 2, 2, 2, 11, 157, 3, 2, 2, 2, 13, 159, 3, 2, 2, 2, 15, 161, 3, 2, 2, 2, 17, 163, 3, 2, 2, 2, 19, 165, 3, 2, 2, 2, 21, 168, 3, 2, 2, 2, 23, 170, 3, 2, 2, 2, 25, 173, 3, 2, 2, 2, 27, 176, 3, 2, 2, 2, 29, 187, 3, 2, 2, 2, 31, 201, 3, 2, 2, 2, 33, 203, 3, 2, 2, 2, 35, 205, 3, 2, 2, 2, 37, 207, 3, 2, 2, 2, 39, 209, 3, 2, 2, 2, 41, 211, 3, 2, 2, 2, 43, 213, 3, 2, 2, 2, 45, 216, 3, 2, 2, 2, 47, 219, 3, 2, 2, 2, 49, 222, 3, 2, 2, 2, 51, 224, 3, 2, 2, 2, 53, 226, 3, 2, 2, 2, 55, 233, 3, 2, 2, 2, 57, 239, 3, 2, 2, 2, 59, 241, 3, 2, 2, 2, 61, 247, 3, 2, 2, 2, 63, 253, 3, 2, 2, 2, 65, 255, 3, 2, 2, 2, 67, 291, 3, 2, 2, 2, 69, 327, 3, 2, 2, 2, 71, 363, 3, 2, 2, 2, 73, 393, 3, 2, 2, 2, 75, 431, 3, 2, 2, 2, 77, 469, 3, 2, 2, 2, 79, 495, 3, 2, 2, 2, 81, 524, 3, 2, 2, 2, 83, 530, 3, 2, 2, 2, 85, 534, 3, 2, 2, 2, 87, 536, 3, 2, 2, 2, 89, 544, 3, 2, 2, 2, 91, 551, 3, 2, 2, 2, 93, 567, 3, 2, 2, 2, 95, 583, 3, 2, 2, 2, 97, 586, 3, 2, 2, 2, 99, 591, 3, 2, 2, 2, 101, 602, 3, 2, 2, 2, 103, 611, 3, 2, 2, 2, 105, 613, 3, 2, 2, 2, 107, 615, 3, 2, 2, 2, 109, 617, 3, 2, 2, 2, 111, 632, 3, 2, 2, 2, 113, 634, 3, 2, 2, 2, 115, 641, 3, 2, 2, 2, 117, 645, 3, 2, 2, 2, 119, 647, 3, 2, 2, 2, 121, 649, 3, 2, 2, 2, 123, 651, 3, 2, 2, 2, 125, 666, 3, 2, 2, 2, 127, 675, 3, 2, 2, 2, 129, 677, 3, 2, 2, 2, 131, 693, 3, 2, 2, 2, 133, 695, 3, 2, 2, 2, 135, 702, 3, 2, 2, 2, 137, 714, 3, 2, 2, 2, 139, 717, 3, 2, 2, 2, 141, 721, 3, 2, 2, 2, 143, 742, 3, 2, 2, 2, 145, 745, 3, 2, 2, 2, 147, 756, 3, 2, 2, 2, 149, 150, 7, 42, 2, 2, 150, 4, 3, 2, 2, 2, 151, 152, 7, 43, 2, 2, 152, 6, 3, 2, 2, 2, 153, 154, 7, 93, 2, 2, 154, 8, 3, 2, 2, 2, 155, 156, 7, 46, 2, 2, 156, 10, 3, 2, 2, 2, 157, 158, 7, 95, 2, 2, 158, 12, 3, 2, 2, 2, 159, 160, 7, 125, 2, 2, 160, 14, 3, 2, 2, 2, 161, 162, 7, 127, 2, 2, 162, 16, 3, 2, 2, 2, 163, 164, 7, 62, 2, 2, 164, 18, 3, 2, 2, 2, 165, 166, 7, 62, 2, 2, 166, 167, 7, 63, 2, 2, 167, 20, 3, 2, 2, 2, 168, 169, 7, 64, 2, 2, 169, 22, 3, 2, 2, 2, 170, 171, 7, 64, 2, 2, 171, 172, 7, 63, 2, 2, 172, 24, 3, 2, 2, 2, 173, 174, 7, 63, 2, 2, 174, 175, 7, 63, 2, 2, 175, 26, 3, 2, 2, 2, 176, 177, 7, 35, 2, 2, 177, 178, 7, 63, 2, 2, 178, 28, 3, 2, 2, 2, 179, 180, 7, 110, 2, 2, 180, 181, 7, 107, 2, 2, 181, 182, 7, 109, 2, 2, 182, 188, 7, 103, 2, 2, 183, 184, 7, 78, 2, 2, 184, 185, 7, 75, 2, 2, 185, 186, 7, 77, 2, 2, 186, 188, 7, 71, 2, 2, 187, 179, 3, 2, 2, 2, 187, 183, 3, 2, 2, 2, 188, 30, 3, 2, 2, 2, 189, 190, 7, 103, 2, 2, 190, 191, 7, 122, 2, 2, 191, 192, 7, 107, 2, 2, 192, 193, 7, 117, 2, 2, 193, 194, 7, 118, 2, 2, 194, 202, 7, 117, 2, 2, 195, 196, 7, 71, 2, 2, 196, 197, 7, 90, 2, 2, 197, 198, 7, 75, 2, 2, 198, 199, 7, 85, 2, 2, 199, 200, 7, 86, 2, 2, 200, 202, 7, 85, 2, 2, 201, 189, 3, 2, 2, 2, 201, 195, 3, 2, 2, 2, 202, 32, 3, 2, 2, 2, 203, 204, 7, 45, 2, 2, 204, 34, 3, 2, 2, 2, 205, 206, 7, 47, 2, 2, 206, 36, 3, 2, 2, 2, 207, 208, 7, 44, 2, 2, 208, 38, 3, 2, 2, 2, 209, 210, 7, 49, 2, 2, 210, 40, 3, 2, 2, 2, 211, 212, 7, 39, 2, 2, 212, 42, 3, 2, 2, 2, 213, 214, 7, 44, 2, 2, 214, 215, 7, 44, 2, 2, 215, 44, 3, 2, 2, 2, 216, 217, 7, 62, 2, 2, 217, 218, 7, 62, 2, 2, 218, 46, 3, 2, 2, 2, 219, 220, 7, 64, 2, 2, 220, 221, 7, 64, 2, 2, 221, 48, 3, 2, 2, 2, 222, 223, 7, 40, 2, 2, 223, 50, 3, 2, 2, 2, 224, 225, 7, 126, 2, 2, 225, 52, 3, 2, 2, 2, 226, 227, 7, 96, 2, 2, 227, 54, 3, 2, 2, 2, 228, 229, 7, 40, 2, 2, 229, 234, 7, 40, 2, 2, 230, 231, 7, 99, 2, 2, 231, 232, 7, 112, 2, 2, 232, 234, 7, 102, 2, 2, 233, 228, 3, 2, 2, 2, 233, 230, 3, 2, 2, 2, 234, 56, 3, 2, 2, 2, 235, 236, 7, 126, 2, 2, 236, 240, 7, 126, 2, 2, 237, 238, 7, 113, 2, 2, 238, 240, 7, 116, 2, 2, 239, 235, 3, 2, 2, 2, 239, 237, 3, 2, 2, 2, 240, 58, 3, 2, 2, 2, 241, 242, 7, 128, 2, 2, 242, 60, 3, 2, 2, 2, 243, 248, 7, 35, 2, 2, 244, 245, 7, 112, 2, 2, 245, 246, 7, 113, 2, 2, 246, 248, 7, 118, 2, 2, 247, 243, 3, 2, 2, 2, 247, 244, 3, 2, 2, 2, 248, 62, 3, 2, 2, 2, 249, 250, 7, 107, 2, 2, 250, 254, 7, 112, 2, 2, 251, 252, 7, 75, 2, 2, 252, 254, 7, 80, 2, 2, 253, 249, 3, 2, 2, 2, 253, 251, 3, 2, 2, 2, 254, 64, 3, 2, 2, 2, 255, 260, 7, 93, 2, 2, 256, 259, 5, 145, 73, 2, 257, 259, 5, 147, 74, 2, 258, 256, 3, 2, 2, 2, 258, 257, 3, 2, 2, 2, 259, 262, 3, 2, 2, 2, 260, 258, 3, 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 263, 3, 2, 2, 2, 262, 260, 3, 2, 2, 2, 263, 264, 7, 95, 2, 2, 264, 66, 3, 2, 2, 2, 265, 266, 7, 108, 2, 2, 266, 267, 7, 117, 2, 2, 267, 268, 7, 113, 2, 2, 268, 269, 7, 112, 2, 2, 269, 270, 7, 97, 2, 2, 270, 271, 7, 101, 2, 2, 271, 272, 7, 113, 2, 2, 272, 273, 7, 112, 2, 2, 273, 274, 7, 118, 2, 2, 274, 275, 7, 99, 2, 2, 275, 276, 7, 107, 2, 2, 276, 277, 7, 112, 2, 2, 277, 292, 7, 117, 2, 2, 278, 279, 7, 76, 2, 2, 279, 280, 7, 85, 2, 2, 280, 281, 7, 81, 2, 2, 281, 282, 7, 80, 2, 2, 282, 283, 7, 97, 2, 2, 283, 284, 7, 69, 2, 2, 284, 285, 7, 81, 2, 2, 285, 286, 7, 80, 2, 2, 286, 287, 7, 86, 2, 2, 287, 288, 7, 67, 2, 2, 288, 289, 7, 75, 2, 2, 289, 290, 7, 80, 2, 2, 290, 292, 7, 85, 2, 2, 291, 265, 3, 2, 2, 2, 291, 278, 3, 2, 2, 2, 292, 68, 3, 2, 2, 2, 293, 294, 7, 108, 2, 2, 294, 295, 7, 117, 2, 2, 295, 296, 7, 113, 2, 2, 296, 297, 7, 112, 2, 2, 297, 298, 7, 97, 2, 2, 298, 299, 7, 101, 2, 2, 299, 300, 7, 113, 2, 2, 300, 301, 7, 112, 2, 2, 301, 302, 7, 118, 2, 2, 302, 303, 7, 99, 2, 2, 303, 304, 7, 107, 2, 2, 304, 305, 7, 112, 2, 2, 305, 306, 7, 117, 2, 2, 306, 307, 7, 97, 2, 2, 307, 308, 7, 99, 2, 2, 308, 309, 7, 110, 2, 2, 309, 328, 7, 110, 2, 2, 310, 311, 7, 76, 2, 2, 311, 312, 7, 85, 2, 2, 312, 313, 7, 81, 2, 2, 313, 314, 7, 80, 2, 2, 314, 315, 7, 97, 2, 2, 315, 316, 7, 69, 2, 2, 316, 317, 7, 81, 2, 2, 317, 318, 7, 80, 2, 2, 318, 319, 7, 86, 2, 2, 319, 320, 7, 67, 2, 2, 320, 321, 7, 75, 2, 2, 321, 322, 7, 80, 2, 2, 322, 323, 7, 85, 2, 2, 323, 324, 7, 97, 2, 2, 324, 325, 7, 67, 2, 2, 325, 326, 7, 78, 2, 2, 326, 328, 7, 78, 2, 2, 327, 293, 3, 2, 2, 2, 327, 310, 3, 2, 2, 2, 328, 70, 3, 2, 2, 2, 329, 330, 7, 108, 2, 2, 330, 331, 7, 117, 2, 2, 331, 332, 7, 113, 2, 2, 332, 333, 7, 112, 2, 2, 333, 334, 7, 97, 2, 2, 334, 335, 7, 101, 2, 2, 335, 336, 7, 113, 2, 2, 336, 337, 7, 112, 2, 2, 337, 338, 7, 118, 2, 2, 338, 339, 7, 99, 2, 2, 339, 340, 7, 107, 2, 2, 340, 341, 7, 112, 2, 2, 341, 342, 7, 117, 2, 2, 342, 343, 7, 97, 2, 2, 343, 344, 7, 99, 2, 2, 344, 345, 7, 112, 2, 2, 345, 364, 7, 123, 2, 2, 346, 347, 7, 76, 2, 2, 347, 348, 7, 85, 2, 2, 348, 349, 7, 81, 2, 2, 349, 350, 7, 80, 2, 2, 350, 351, 7, 97, 2, 2, 351, 352, 7, 69, 2, 2, 352, 353, 7, 81, 2, 2, 353, 354, 7, 80, 2, 2, 354, 355, 7, 86, 2, 2, 355, 356, 7, 67, 2, 2, 356, 357, 7, 75, 2, 2, 357, 358, 7, 80, 2, 2, 358, 359, 7, 85, 2, 2, 359, 360, 7, 97, 2, 2, 360, 361, 7, 67, 2, 2, 361, 362, 7, 80, 2, 2, 362, 364, 7, 91, 2, 2, 363, 329, 3, 2, 2, 2, 363, 346, 3, 2, 2, 2, 364, 72, 3, 2, 2, 2, 365, 366, 7, 99, 2, 2, 366, 367, 7, 116, 2, 2, 367, 368, 7, 116, 2, 2, 368, 369, 7, 99, 2, 2, 369, 370, 7, 123, 2, 2, 370, 371, 7, 97, 2, 2, 371, 372, 7, 101, 2, 2, 372, 373, 7, 113, 2, 2, 373, 374, 7, 112, 2, 2, 374, 375, 7, 118, 2, 2, 375, 376, 7, 99, 2, 2, 376, 377, 7, 107, 2, 2, 377, 378, 7, 112, 2, 2, 378, 394, 7, 117, 2, 2, 379, 380, 7, 67, 2, 2, 380, 381, 7, 84, 2, 2, 381, 382, 7, 84, 2, 2, 382, 383, 7, 67, 2, 2, 383, 384, 7, 91, 2, 2, 384, 385, 7, 97, 2, 2, 385, 386, 7, 69, 2, 2, 386, 387, 7, 81, 2, 2, 387, 388, 7, 80, 2, 2, 388, 389, 7, 86, 2, 2, 389, 390, 7, 67, 2, 2, 390, 391, 7, 75, 2, 2, 391, 392, 7, 80, 2, 2, 392, 394, 7, 85, 2, 2, 393, 365, 3, 2, 2, 2, 393, 379, 3, 2, 2, 2, 394, 74, 3, 2, 2, 2, 395, 396, 7, 99, 2, 2, 396, 397, 7, 116, 2, 2, 397, 398, 7, 116, 2, 2, 398, 399, 7, 99, 2, 2, 399, 400, 7, 123, 2, 2, 400, 401, 7, 97, 2, 2, 401, 402, 7, 101, 2, 2, 402, 403, 7, 113, 2, 2, 403, 404, 7, 112, 2, 2, 404, 405, 7, 118, 2, 2, 405, 406, 7, 99, 2, 2, 406, 407, 7, 107, 2, 2, 407, 408, 7, 112, 2, 2, 408, 409, 7, 117, 2, 2, 409, 410, 7, 97, 2, 2, 410, 411, 7, 99, 2, 2, 411, 412, 7, 110, 2, 2, 412, 432, 7, 110, 2, 2, 413, 414, 7, 67, 2, 2, 414, 415, 7, 84, 2, 2, 415, 416, 7, 84, 2, 2, 416, 417, 7, 67, 2, 2, 417, 418, 7, 91, 2, 2, 418, 419, 7, 97, 2, 2, 419, 420, 7, 69, 2, 2, 420, 421, 7, 81, 2, 2, 421, 422, 7, 80, 2, 2, 422, 423, 7, 86, 2, 2, 423, 424, 7, 67, 2, 2, 424, 425, 7, 75, 2, 2, 425, 426, 7, 80, 2, 2, 426, 427, 7, 85, 2, 2, 427, 428, 7, 97, 2, 2, 428, 429, 7, 67, 2, 2, 429, 430, 7, 78, 2, 2, 430, 432, 7, 78, 2, 2, 431, 395, 3, 2, 2, 2, 431, 413, 3, 2, 2, 2, 432, 76, 3, 2, 2, 2, 433, 434, 7, 99, 2, 2, 434, 435, 7, 116, 2, 2, 435, 436, 7, 116, 2, 2, 436, 437, 7, 99, 2, 2, 437, 438, 7, 123, 2, 2, 438, 439, 7, 97, 2, 2, 439, 440, 7, 101, 2, 2, 440, 441, 7, 113, 2, 2, 441, 442, 7, 112, 2, 2, 442, 443, 7, 118, 2, 2, 443, 444, 7, 99, 2, 2, 444, 445, 7, 107, 2, 2, 445, 446, 7, 112, 2, 2, 446, 447, 7, 117, 2, 2, 447, 448, 7, 97, 2, 2, 448, 449, 7, 99, 2, 2, 449, 450, 7, 112, 2, 2, 450, 470, 7, 123, 2, 2, 451, 452, 7, 67, 2, 2, 452, 453, 7, 84, 2, 2, 453, 454, 7, 84, 2, 2, 454, 455, 7, 67, 2, 2, 455, 456, 7, 91, 2, 2, 456, 457, 7, 97, 2, 2, 457, 458, 7, 69, 2, 2, 458, 459, 7, 81, 2, 2, 459, 460, 7, 80, 2, 2, 460, 461, 7, 86, 2, 2, 461, 462, 7, 67, 2, 2, 462, 463, 7, 75, 2, 2, 463, 464, 7, 80, 2, 2, 464, 465, 7, 85, 2, 2, 465, 466, 7, 97, 2, 2, 466, 467, 7, 67, 2, 2, 467, 468, 7, 80, 2, 2, 468, 470, 7, 91, 2, 2, 469, 433, 3, 2, 2, 2, 469, 451, 3, 2, 2, 2, 470, 78, 3, 2, 2, 2, 471, 472, 7, 99, 2, 2, 472, 473, 7, 116, 2, 2, 473, 474, 7, 116, 2, 2, 474, 475, 7, 99, 2, 2, 475, 476, 7, 123, 2, 2, 476, 477, 7, 97, 2, 2, 477, 478, 7, 110, 2, 2, 478, 479, 7, 103, 2, 2, 479, 480, 7, 112, 2, 2, 480, 481, 7, 105, 2, 2, 481, 482, 7, 118, 2, 2, 482, 496, 7, 106, 2, 2, 483, 484, 7, 67, 2, 2, 484, 485, 7, 84, 2, 2, 485, 486, 7, 84, 2, 2, 486, 487, 7, 67, 2, 2, 487, 488, 7, 91, 2, 2, 488, 489, 7, 97, 2, 2, 489, 490, 7, 78, 2, 2, 490, 491, 7, 71, 2, 2, 491, 492, 7, 80, 2, 2, 492, 493, 7, 73, 2, 2, 493, 494, 7, 86, 2, 2, 494, 496, 7, 74, 2, 2, 495, 471, 3, 2, 2, 2, 495, 483, 3, 2, 2, 2, 496, 80, 3, 2, 2, 2, 497, 498, 7, 118, 2, 2, 498, 499, 7, 116, 2, 2, 499, 500, 7, 119, 2, 2, 500, 525, 7, 103, 2, 2, 501, 502, 7, 86, 2, 2, 502, 503, 7, 116, 2, 2, 503, 504, 7, 119, 2, 2, 504, 525, 7, 103, 2, 2, 505, 506, 7, 86, 2, 2, 506, 507, 7, 84, 2, 2, 507, 508, 7, 87, 2, 2, 508, 525, 7, 71, 2, 2, 509, 510, 7, 104, 2, 2, 510, 511, 7, 99, 2, 2, 511, 512, 7, 110, 2, 2, 512, 513, 7, 117, 2, 2, 513, 525, 7, 103, 2, 2, 514, 515, 7, 72, 2, 2, 515, 516, 7, 99, 2, 2, 516, 517, 7, 110, 2, 2, 517, 518, 7, 117, 2, 2, 518, 525, 7, 103, 2, 2, 519, 520, 7, 72, 2, 2, 520, 521, 7, 67, 2, 2, 521, 522, 7, 78, 2, 2, 522, 523, 7, 85, 2, 2, 523, 525, 7, 71, 2, 2, 524, 497, 3, 2, 2, 2, 524, 501, 3, 2, 2, 2, 524, 505, 3, 2, 2, 2, 524, 509, 3, 2, 2, 2, 524, 514, 3, 2, 2, 2, 524, 519, 3, 2, 2, 2, 525, 82, 3, 2, 2, 2, 526, 531, 5, 111, 56, 2, 527, 531, 5, 113, 57, 2, 528, 531, 5, 115, 58, 2, 529, 531, 5, 109, 55, 2, 530, 526, 3, 2, 2, 2, 530, 527, 3, 2, 2, 2, 530, 528, 3, 2, 2, 2, 530, 529, 3, 2, 2, 2, 531, 84, 3, 2, 2, 2, 532, 535, 5, 127, 64, 2, 533, 535, 5, 129, 65, 2, 534, 532, 3, 2, 2, 2, 534, 533, 3, 2, 2, 2, 535, 86, 3, 2, 2, 2, 536, 541, 5, 105, 53, 2, 537, 540, 5, 105, 53, 2, 538, 540, 5, 107, 54, 2, 539, 537, 3, 2, 2, 2, 539, 538, 3, 2, 2, 2, 540, 543, 3, 2, 2, 2, 541, 539, 3, 2, 2, 2, 541, 542, 3, 2, 2, 2, 542, 88, 3, 2, 2, 2, 543, 541, 3, 2, 2, 2, 544, 545, 7, 38, 2, 2, 545, 546, 7, 111, 2, 2, 546, 547, 7, 103, 2, 2, 547, 548, 7, 118, 2, 2, 548, 549, 7, 99, 2, 2, 549, 90, 3, 2, 2, 2, 550, 552, 5, 95, 48, 2, 551, 550, 3, 2, 2, 2, 551, 552, 3, 2, 2, 2, 552, 563, 3, 2, 2, 2, 553, 555, 7, 36, 2, 2, 554, 556, 5, 97, 49, 2, 555, 554, 3, 2, 2, 2, 555, 556, 3, 2, 2, 2, 556, 557, 3, 2, 2, 2, 557, 564, 7, 36, 2, 2, 558, 560, 7, 41, 2, 2, 559, 561, 5, 99, 50, 2, 560, 559, 3, 2, 2, 2, 560, 561, 3, 2, 2, 2, 561, 562, 3, 2, 2, 2, 562, 564, 7, 41, 2, 2, 563, 553, 3, 2, 2, 2, 563, 558, 3, 2, 2, 2, 564, 92, 3, 2, 2, 2, 565, 568, 5, 87, 44, 2, 566, 568, 5, 89, 45, 2, 567, 565, 3, 2, 2, 2, 567, 566, 3, 2, 2, 2, 568, 576, 3, 2, 2, 2, 569, 572, 7, 93, 2, 2, 570, 573, 5, 91, 46, 2, 571, 573, 5, 111, 56, 2, 572, 570, 3, 2, 2, 2, 572, 571, 3, 2, 2, 2, 573, 574, 3, 2, 2, 2, 574, 575, 7, 95, 2, 2, 575, 577, 3, 2, 2, 2, 576, 569, 3, 2, 2, 2, 577, 578, 3, 2, 2, 2, 578, 576, 3, 2, 2, 2, 578, 579, 3, 2, 2, 2, 579, 94, 3, 2, 2, 2, 580, 581, 7, 119, 2, 2, 581, 584, 7, 58, 2, 2, 582, 584, 9, 2, 2, 2, 583, 580, 3, 2, 2, 2, 583, 582, 3, 2, 2, 2, 584, 96, 3, 2, 2, 2, 585, 587, 5, 101, 51, 2, 586, 585, 3, 2, 2, 2, 587, 588, 3, 2, 2, 2, 588, 586, 3, 2, 2, 2, 588, 589, 3, 2, 2, 2, 589, 98, 3, 2, 2, 2, 590, 592, 5, 103, 52, 2, 591, 590, 3, 2, 2, 2, 592, 593, 3, 2, 2, 2, 593, 591, 3, 2, 2, 2, 593, 594, 3, 2, 2, 2, 594, 100, 3, 2, 2, 2, 595, 603, 10, 3, 2, 2, 596, 603, 5, 143, 72, 2, 597, 598, 7, 94, 2, 2, 598, 603, 7, 12, 2, 2, 599, 600, 7, 94, 2, 2, 600, 601, 7, 15, 2, 2, 601, 603, 7, 12, 2, 2, 602, 595, 3, 2, 2, 2, 602, 596, 3, 2, 2, 2, 602, 597, 3, 2, 2, 2, 602, 599, 3, 2, 2, 2, 603, 102, 3, 2, 2, 2, 604, 612, 10, 4, 2, 2, 605, 612, 5, 143, 72, 2, 606, 607, 7, 94, 2, 2, 607, 612, 7, 12, 2, 2, 608, 609, 7, 94, 2, 2, 609, 610, 7, 15, 2, 2, 610, 612, 7, 12, 2, 2, 611, 604, 3, 2, 2, 2, 611, 605, 3, 2, 2, 2, 611, 606, 3, 2, 2, 2, 611, 608, 3, 2, 2, 2, 612, 104, 3, 2, 2, 2, 613, 614, 9, 5, 2, 2, 614, 106, 3, 2, 2, 2, 615, 616, 9, 6, 2, 2, 616, 108, 3, 2, 2, 2, 617, 618, 7, 50, 2, 2, 618, 620, 9, 7, 2, 2, 619, 621, 9, 8, 2, 2, 620, 619, 3, 2, 2, 2, 621, 622, 3, 2, 2, 2, 622, 620, 3, 2, 2, 2, 622, 623, 3, 2, 2, 2, 623, 110, 3, 2, 2, 2, 624, 628, 5, 117, 59, 2, 625, 627, 5, 107, 54, 2, 626, 625, 3, 2, 2, 2, 627, 630, 3, 2, 2, 2, 628, 626, 3, 2, 2, 2, 628, 629, 3, 2, 2, 2, 629, 633, 3, 2, 2, 2, 630, 628, 3, 2, 2, 2, 631, 633, 7, 50, 2, 2, 632, 624, 3, 2, 2, 2, 632, 631, 3, 2, 2, 2, 633, 112, 3, 2, 2, 2, 634, 638, 7, 50, 2, 2, 635, 637, 5, 119, 60, 2, 636, 635, 3, 2, 2, 2, 637, 640, 3, 2, 2, 2, 638, 636, 3, 2, 2, 2, 638, 639, 3, 2, 2, 2, 639, 114, 3, 2, 2, 2, 640, 638, 3, 2, 2, 2, 641, 642, 7, 50, 2, 2, 642, 643, 9, 9, 2, 2, 643, 644, 5, 139, 70, 2, 644, 116, 3, 2, 2, 2, 645, 646, 9, 10, 2, 2, 646, 118, 3, 2, 2, 2, 647, 648, 9, 11, 2, 2, 648, 120, 3, 2, 2, 2, 649, 650, 9, 12, 2, 2, 650, 122, 3, 2, 2, 2, 651, 652, 5, 121, 61, 2, 652, 653, 5, 121, 61, 2, 653, 654, 5, 121, 61, 2, 654, 655, 5, 121, 61, 2, 655, 124, 3, 2, 2, 2, 656, 657, 7, 94, 2, 2, 657, 658, 7, 119, 2, 2, 658, 659, 3, 2, 2, 2, 659, 667, 5, 123, 62, 2, 660, 661, 7, 94, 2, 2, 661, 662, 7, 87, 2, 2, 662, 663, 3, 2, 2, 2, 663, 664, 5, 123, 62, 2, 664, 665, 5, 123, 62, 2, 665, 667, 3, 2, 2, 2, 666, 656, 3, 2, 2, 2, 666, 660, 3, 2, 2, 2, 667, 126, 3, 2, 2, 2, 668, 670, 5, 131, 66, 2, 669, 671, 5, 133, 67, 2, 670, 669, 3, 2, 2, 2, 670, 671, 3, 2, 2, 2, 671, 676, 3, 2, 2, 2, 672, 673, 5, 135, 68, 2, 673, 674, 5, 133, 67, 2, 674, 676, 3, 2, 2, 2, 675, 668, 3, 2, 2, 2, 675, 672, 3, 2, 2, 2, 676, 128, 3, 2, 2, 2, 677, 678, 7, 50, 2, 2, 678, 681, 9, 9, 2, 2, 679, 682, 5, 137, 69, 2, 680, 682, 5, 139, 70, 2, 681, 679, 3, 2, 2, 2, 681, 680, 3, 2, 2, 2, 682, 683, 3, 2, 2, 2, 683, 684, 5, 141, 71, 2, 684, 130, 3, 2, 2, 2, 685, 687, 5, 135, 68, 2, 686, 685, 3, 2, 2, 2, 686, 687, 3, 2, 2, 2, 687, 688, 3, 2, 2, 2, 688, 689, 7, 48, 2, 2, 689, 694, 5, 135, 68, 2, 690, 691, 5, 135, 68, 2, 691, 692, 7, 48, 2, 2, 692, 694, 3, 2, 2, 2, 693, 686, 3, 2, 2, 2, 693, 690, 3, 2, 2, 2, 694, 132, 3, 2, 2, 2, 695, 697, 9, 13, 2, 2, 696, 698, 9, 14, 2, 2, 697, 696, 3, 2, 2, 2, 697, 698, 3, 2, 2, 2, 698, 699, 3, 2, 2, 2, 699, 700, 5, 135, 68, 2, 700, 134, 3, 2, 2, 2, 701, 703, 5, 107, 54, 2, 702, 701, 3, 2, 2, 2, 703, 704, 3, 2, 2, 2, 704, 702, 3, 2, 2, 2, 704, 705, 3, 2, 2, 2, 705, 136, 3, 2, 2, 2, 706, 708, 5, 139, 70, 2, 707, 706, 3, 2, 2, 2, 707, 708, 3, 2, 2, 2, 708, 709, 3, 2, 2, 2, 709, 710, 7, 48, 2, 2, 710, 715, 5, 139, 70, 2, 711, 712, 5, 139, 70, 2, 712, 713, 7, 48, 2, 2, 713, 715, 3, 2, 2, 2, 714, 707, 3, 2, 2, 2, 714, 711, 3, 2, 2, 2, 715, 138, 3, 2, 2, 2, 716, 718, 5, 121, 61, 2, 717, 716, 3, 2, 2, 2, 718, 719, 3, 2, 2, 2, 719, 717, 3, 2, 2, 2, 719, 720, 3, 2, 2, 2, 720, 140, 3, 2, 2, 2, 721, 723, 9, 15, 2, 2, 722, 724, 9, 14, 2, 2, 723, 722, 3, 2, 2, 2, 723, 724, 3, 2, 2, 2, 724, 725, 3, 2, 2, 2, 725, 726, 5, 135, 68, 2, 726, 142, 3, 2, 2, 2, 727, 728, 7, 94, 2, 2, 728, 743, 9, 16, 2, 2, 729, 730, 7, 94, 2, 2, 730, 732, 5, 119, 60, 2, 731, 733, 5, 119, 60, 2, 732, 731, 3, 2, 2, 2, 732, 733, 3, 2, 2, 2, 733, 735, 3, 2, 2, 2, 734, 736, 5, 119, 60, 2, 735, 734, 3, 2, 2, 2, 735, 736, 3, 2, 2, 2, 736, 743, 3, 2, 2, 2, 737, 738, 7, 94, 2, 2, 738, 739, 7, 122, 2, 2, 739, 740, 3, 2, 2, 2, 740, 743, 5, 139, 70, 2, 741, 743, 5, 125, 63, 2, 742, 727, 3, 2, 2, 2, 742, 729, 3, 2, 2, 2, 742, 737, 3, 2, 2, 2, 742, 741, 3, 2, 2, 2, 743, 144, 3, 2, 2, 2, 744, 746, 9, 17, 2, 2, 745, 744, 3, 2, 2, 2, 746, 747, 3, 2, 2, 2, 747, 745, 3, 2, 2, 2, 747, 748, 3, 2, 2, 2, 748, 749, 3, 2, 2, 2, 749, 750, 8, 73, 2, 2, 750, 146, 3, 2, 2, 2, 751, 753, 7, 15, 2, 2, 752, 754, 7, 12, 2, 2, 753, 752, 3, 2, 2, 2, 753, 754, 3, 2, 2, 2, 754, 757, 3, 2, 2, 2, 755, 757, 7, 12, 2, 2, 756, 751, 3, 2, 2, 2, 756, 755, 3, 2, 2, 2, 757, 758, 3, 2, 2, 2, 758, 759, 8, 74, 2, 2, 759, 148, 3, 2, 2, 2, 57, 2, 187, 201, 233, 239, 247, 253, 258, 260, 291, 327, 363, 393, 431, 469, 495, 524, 530, 534, 539, 541, 551, 555, 560, 563, 567, 572, 578, 583, 588, 593, 602, 611, 622, 628, 632, 638, 666, 670, 675, 681, 686, 693, 697, 704, 707, 714, 719, 723, 732, 735, 742, 747, 753, 756, 3, 8, 2, 2] \ No newline at end of file diff --git a/internal/parser/planparserv2/generated/PlanLexer.tokens b/internal/parser/planparserv2/generated/PlanLexer.tokens index e808c9b6391b3..864a9f9ebcd9d 100644 --- a/internal/parser/planparserv2/generated/PlanLexer.tokens +++ b/internal/parser/planparserv2/generated/PlanLexer.tokens @@ -3,69 +3,72 @@ T__1=2 T__2=3 T__3=4 T__4=5 -LT=6 -LE=7 -GT=8 -GE=9 -EQ=10 -NE=11 -LIKE=12 -EXISTS=13 -ADD=14 -SUB=15 -MUL=16 -DIV=17 -MOD=18 -POW=19 -SHL=20 -SHR=21 -BAND=22 -BOR=23 -BXOR=24 -AND=25 -OR=26 -BNOT=27 -NOT=28 -IN=29 -NIN=30 -EmptyTerm=31 -JSONContains=32 -JSONContainsAll=33 -JSONContainsAny=34 -ArrayContains=35 -ArrayContainsAll=36 -ArrayContainsAny=37 -ArrayLength=38 -BooleanConstant=39 -IntegerConstant=40 -FloatingConstant=41 -Identifier=42 -StringLiteral=43 -JSONIdentifier=44 -Whitespace=45 -Newline=46 +LBRACE=6 +RBRACE=7 +LT=8 +LE=9 +GT=10 +GE=11 +EQ=12 +NE=13 +LIKE=14 +EXISTS=15 +ADD=16 +SUB=17 +MUL=18 +DIV=19 +MOD=20 +POW=21 +SHL=22 +SHR=23 +BAND=24 +BOR=25 +BXOR=26 +AND=27 +OR=28 +BNOT=29 +NOT=30 +IN=31 +EmptyArray=32 +JSONContains=33 +JSONContainsAll=34 +JSONContainsAny=35 +ArrayContains=36 +ArrayContainsAll=37 +ArrayContainsAny=38 +ArrayLength=39 +BooleanConstant=40 +IntegerConstant=41 +FloatingConstant=42 +Identifier=43 +Meta=44 +StringLiteral=45 +JSONIdentifier=46 +Whitespace=47 +Newline=48 '('=1 ')'=2 '['=3 ','=4 ']'=5 -'<'=6 -'<='=7 -'>'=8 -'>='=9 -'=='=10 -'!='=11 -'+'=14 -'-'=15 -'*'=16 -'/'=17 -'%'=18 -'**'=19 -'<<'=20 -'>>'=21 -'&'=22 -'|'=23 -'^'=24 -'~'=27 -'in'=29 -'not in'=30 +'{'=6 +'}'=7 +'<'=8 +'<='=9 +'>'=10 +'>='=11 +'=='=12 +'!='=13 +'+'=16 +'-'=17 +'*'=18 +'/'=19 +'%'=20 +'**'=21 +'<<'=22 +'>>'=23 +'&'=24 +'|'=25 +'^'=26 +'~'=29 +'$meta'=44 diff --git a/internal/parser/planparserv2/generated/plan_base_visitor.go b/internal/parser/planparserv2/generated/plan_base_visitor.go index 8752aa2555122..73fef4e39674b 100644 --- a/internal/parser/planparserv2/generated/plan_base_visitor.go +++ b/internal/parser/planparserv2/generated/plan_base_visitor.go @@ -47,6 +47,10 @@ func (v *BasePlanVisitor) VisitLogicalAnd(ctx *LogicalAndContext) interface{} { return v.VisitChildren(ctx) } +func (v *BasePlanVisitor) VisitTemplateVariable(ctx *TemplateVariableContext) interface{} { + return v.VisitChildren(ctx) +} + func (v *BasePlanVisitor) VisitEquality(ctx *EqualityContext) interface{} { return v.VisitChildren(ctx) } @@ -67,6 +71,10 @@ func (v *BasePlanVisitor) VisitBitOr(ctx *BitOrContext) interface{} { return v.VisitChildren(ctx) } +func (v *BasePlanVisitor) VisitEmptyArray(ctx *EmptyArrayContext) interface{} { + return v.VisitChildren(ctx) +} + func (v *BasePlanVisitor) VisitAddSub(ctx *AddSubContext) interface{} { return v.VisitChildren(ctx) } @@ -119,10 +127,6 @@ func (v *BasePlanVisitor) VisitBitAnd(ctx *BitAndContext) interface{} { return v.VisitChildren(ctx) } -func (v *BasePlanVisitor) VisitEmptyTerm(ctx *EmptyTermContext) interface{} { - return v.VisitChildren(ctx) -} - func (v *BasePlanVisitor) VisitPower(ctx *PowerContext) interface{} { return v.VisitChildren(ctx) } diff --git a/internal/parser/planparserv2/generated/plan_lexer.go b/internal/parser/planparserv2/generated/plan_lexer.go index cab7502bc7241..278343c8aaf43 100644 --- a/internal/parser/planparserv2/generated/plan_lexer.go +++ b/internal/parser/planparserv2/generated/plan_lexer.go @@ -14,7 +14,7 @@ var _ = fmt.Printf var _ = unicode.IsLetter var serializedLexerAtn = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 48, 754, + 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 50, 760, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, @@ -28,335 +28,338 @@ var serializedLexerAtn = []uint16{ 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, - 70, 4, 71, 9, 71, 4, 72, 9, 72, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, - 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, - 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, - 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 180, 10, 13, 3, 14, 3, 14, 3, - 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, - 194, 10, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, - 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, - 3, 23, 3, 23, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, - 26, 5, 26, 226, 10, 26, 3, 27, 3, 27, 3, 27, 3, 27, 5, 27, 232, 10, 27, - 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 5, 29, 240, 10, 29, 3, 30, 3, - 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, - 3, 32, 7, 32, 255, 10, 32, 12, 32, 14, 32, 258, 11, 32, 3, 32, 3, 32, 3, - 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, - 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, - 33, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 288, 10, 33, 3, 34, 3, 34, 3, 34, + 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 3, 2, 3, 2, + 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, + 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, + 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, + 3, 15, 3, 15, 3, 15, 5, 15, 188, 10, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, + 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 5, 16, 202, 10, 16, + 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, + 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, + 3, 26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 5, 28, 234, + 10, 28, 3, 29, 3, 29, 3, 29, 3, 29, 5, 29, 240, 10, 29, 3, 30, 3, 30, 3, + 31, 3, 31, 3, 31, 3, 31, 5, 31, 248, 10, 31, 3, 32, 3, 32, 3, 32, 3, 32, + 5, 32, 254, 10, 32, 3, 33, 3, 33, 3, 33, 7, 33, 259, 10, 33, 12, 33, 14, + 33, 262, 11, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, - 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, - 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, - 34, 324, 10, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, - 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, + 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, + 292, 10, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, - 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 5, 35, 360, 10, 35, 3, 36, 3, 36, 3, - 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, + 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, + 35, 3, 35, 3, 35, 3, 35, 3, 35, 5, 35, 328, 10, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, - 36, 3, 36, 3, 36, 3, 36, 3, 36, 5, 36, 390, 10, 36, 3, 37, 3, 37, 3, 37, - 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, - 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, + 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, + 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 5, + 36, 364, 10, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, - 37, 3, 37, 5, 37, 428, 10, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, - 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, + 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 5, 37, + 394, 10, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, - 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 466, - 10, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, + 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, + 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 432, 10, 38, 3, 39, + 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, + 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, - 39, 3, 39, 3, 39, 3, 39, 3, 39, 5, 39, 492, 10, 39, 3, 40, 3, 40, 3, 40, + 39, 3, 39, 3, 39, 3, 39, 5, 39, 470, 10, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, - 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, - 3, 40, 3, 40, 3, 40, 5, 40, 521, 10, 40, 3, 41, 3, 41, 3, 41, 3, 41, 5, - 41, 527, 10, 41, 3, 42, 3, 42, 5, 42, 531, 10, 42, 3, 43, 3, 43, 3, 43, - 7, 43, 536, 10, 43, 12, 43, 14, 43, 539, 11, 43, 3, 43, 3, 43, 3, 43, 3, - 43, 3, 43, 5, 43, 546, 10, 43, 3, 44, 5, 44, 549, 10, 44, 3, 44, 3, 44, - 5, 44, 553, 10, 44, 3, 44, 3, 44, 3, 44, 5, 44, 558, 10, 44, 3, 44, 5, - 44, 561, 10, 44, 3, 45, 3, 45, 3, 45, 3, 45, 5, 45, 567, 10, 45, 3, 45, - 3, 45, 6, 45, 571, 10, 45, 13, 45, 14, 45, 572, 3, 46, 3, 46, 3, 46, 5, - 46, 578, 10, 46, 3, 47, 6, 47, 581, 10, 47, 13, 47, 14, 47, 582, 3, 48, - 6, 48, 586, 10, 48, 13, 48, 14, 48, 587, 3, 49, 3, 49, 3, 49, 3, 49, 3, - 49, 3, 49, 3, 49, 5, 49, 597, 10, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, - 3, 50, 3, 50, 5, 50, 606, 10, 50, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, - 53, 3, 53, 6, 53, 615, 10, 53, 13, 53, 14, 53, 616, 3, 54, 3, 54, 7, 54, - 621, 10, 54, 12, 54, 14, 54, 624, 11, 54, 3, 54, 5, 54, 627, 10, 54, 3, - 55, 3, 55, 7, 55, 631, 10, 55, 12, 55, 14, 55, 634, 11, 55, 3, 56, 3, 56, - 3, 56, 3, 56, 3, 57, 3, 57, 3, 58, 3, 58, 3, 59, 3, 59, 3, 60, 3, 60, 3, - 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, - 3, 61, 3, 61, 5, 61, 661, 10, 61, 3, 62, 3, 62, 5, 62, 665, 10, 62, 3, - 62, 3, 62, 3, 62, 5, 62, 670, 10, 62, 3, 63, 3, 63, 3, 63, 3, 63, 5, 63, - 676, 10, 63, 3, 63, 3, 63, 3, 64, 5, 64, 681, 10, 64, 3, 64, 3, 64, 3, - 64, 3, 64, 3, 64, 5, 64, 688, 10, 64, 3, 65, 3, 65, 5, 65, 692, 10, 65, - 3, 65, 3, 65, 3, 66, 6, 66, 697, 10, 66, 13, 66, 14, 66, 698, 3, 67, 5, - 67, 702, 10, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 5, 67, 709, 10, 67, - 3, 68, 6, 68, 712, 10, 68, 13, 68, 14, 68, 713, 3, 69, 3, 69, 5, 69, 718, - 10, 69, 3, 69, 3, 69, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 5, 70, 727, 10, - 70, 3, 70, 5, 70, 730, 10, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 5, 70, - 737, 10, 70, 3, 71, 6, 71, 740, 10, 71, 13, 71, 14, 71, 741, 3, 71, 3, - 71, 3, 72, 3, 72, 5, 72, 748, 10, 72, 3, 72, 5, 72, 751, 10, 72, 3, 72, - 3, 72, 2, 2, 73, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, - 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, - 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, - 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, - 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, - 2, 93, 2, 95, 2, 97, 2, 99, 2, 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, - 111, 2, 113, 2, 115, 2, 117, 2, 119, 2, 121, 2, 123, 2, 125, 2, 127, 2, - 129, 2, 131, 2, 133, 2, 135, 2, 137, 2, 139, 2, 141, 47, 143, 48, 3, 2, - 18, 5, 2, 78, 78, 87, 87, 119, 119, 6, 2, 12, 12, 15, 15, 36, 36, 94, 94, - 6, 2, 12, 12, 15, 15, 41, 41, 94, 94, 5, 2, 67, 92, 97, 97, 99, 124, 3, - 2, 50, 59, 4, 2, 68, 68, 100, 100, 3, 2, 50, 51, 4, 2, 90, 90, 122, 122, - 3, 2, 51, 59, 3, 2, 50, 57, 5, 2, 50, 59, 67, 72, 99, 104, 4, 2, 71, 71, - 103, 103, 4, 2, 45, 45, 47, 47, 4, 2, 82, 82, 114, 114, 12, 2, 36, 36, - 41, 41, 65, 65, 94, 94, 99, 100, 104, 104, 112, 112, 116, 116, 118, 118, - 120, 120, 4, 2, 11, 11, 34, 34, 2, 793, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, - 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, - 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, - 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, - 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, - 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, - 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, - 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, - 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, - 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, - 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, - 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, - 2, 141, 3, 2, 2, 2, 2, 143, 3, 2, 2, 2, 3, 145, 3, 2, 2, 2, 5, 147, 3, - 2, 2, 2, 7, 149, 3, 2, 2, 2, 9, 151, 3, 2, 2, 2, 11, 153, 3, 2, 2, 2, 13, - 155, 3, 2, 2, 2, 15, 157, 3, 2, 2, 2, 17, 160, 3, 2, 2, 2, 19, 162, 3, - 2, 2, 2, 21, 165, 3, 2, 2, 2, 23, 168, 3, 2, 2, 2, 25, 179, 3, 2, 2, 2, - 27, 193, 3, 2, 2, 2, 29, 195, 3, 2, 2, 2, 31, 197, 3, 2, 2, 2, 33, 199, - 3, 2, 2, 2, 35, 201, 3, 2, 2, 2, 37, 203, 3, 2, 2, 2, 39, 205, 3, 2, 2, - 2, 41, 208, 3, 2, 2, 2, 43, 211, 3, 2, 2, 2, 45, 214, 3, 2, 2, 2, 47, 216, - 3, 2, 2, 2, 49, 218, 3, 2, 2, 2, 51, 225, 3, 2, 2, 2, 53, 231, 3, 2, 2, - 2, 55, 233, 3, 2, 2, 2, 57, 239, 3, 2, 2, 2, 59, 241, 3, 2, 2, 2, 61, 244, - 3, 2, 2, 2, 63, 251, 3, 2, 2, 2, 65, 287, 3, 2, 2, 2, 67, 323, 3, 2, 2, - 2, 69, 359, 3, 2, 2, 2, 71, 389, 3, 2, 2, 2, 73, 427, 3, 2, 2, 2, 75, 465, - 3, 2, 2, 2, 77, 491, 3, 2, 2, 2, 79, 520, 3, 2, 2, 2, 81, 526, 3, 2, 2, - 2, 83, 530, 3, 2, 2, 2, 85, 545, 3, 2, 2, 2, 87, 548, 3, 2, 2, 2, 89, 562, - 3, 2, 2, 2, 91, 577, 3, 2, 2, 2, 93, 580, 3, 2, 2, 2, 95, 585, 3, 2, 2, - 2, 97, 596, 3, 2, 2, 2, 99, 605, 3, 2, 2, 2, 101, 607, 3, 2, 2, 2, 103, - 609, 3, 2, 2, 2, 105, 611, 3, 2, 2, 2, 107, 626, 3, 2, 2, 2, 109, 628, - 3, 2, 2, 2, 111, 635, 3, 2, 2, 2, 113, 639, 3, 2, 2, 2, 115, 641, 3, 2, - 2, 2, 117, 643, 3, 2, 2, 2, 119, 645, 3, 2, 2, 2, 121, 660, 3, 2, 2, 2, - 123, 669, 3, 2, 2, 2, 125, 671, 3, 2, 2, 2, 127, 687, 3, 2, 2, 2, 129, - 689, 3, 2, 2, 2, 131, 696, 3, 2, 2, 2, 133, 708, 3, 2, 2, 2, 135, 711, - 3, 2, 2, 2, 137, 715, 3, 2, 2, 2, 139, 736, 3, 2, 2, 2, 141, 739, 3, 2, - 2, 2, 143, 750, 3, 2, 2, 2, 145, 146, 7, 42, 2, 2, 146, 4, 3, 2, 2, 2, - 147, 148, 7, 43, 2, 2, 148, 6, 3, 2, 2, 2, 149, 150, 7, 93, 2, 2, 150, - 8, 3, 2, 2, 2, 151, 152, 7, 46, 2, 2, 152, 10, 3, 2, 2, 2, 153, 154, 7, - 95, 2, 2, 154, 12, 3, 2, 2, 2, 155, 156, 7, 62, 2, 2, 156, 14, 3, 2, 2, - 2, 157, 158, 7, 62, 2, 2, 158, 159, 7, 63, 2, 2, 159, 16, 3, 2, 2, 2, 160, - 161, 7, 64, 2, 2, 161, 18, 3, 2, 2, 2, 162, 163, 7, 64, 2, 2, 163, 164, - 7, 63, 2, 2, 164, 20, 3, 2, 2, 2, 165, 166, 7, 63, 2, 2, 166, 167, 7, 63, - 2, 2, 167, 22, 3, 2, 2, 2, 168, 169, 7, 35, 2, 2, 169, 170, 7, 63, 2, 2, - 170, 24, 3, 2, 2, 2, 171, 172, 7, 110, 2, 2, 172, 173, 7, 107, 2, 2, 173, - 174, 7, 109, 2, 2, 174, 180, 7, 103, 2, 2, 175, 176, 7, 78, 2, 2, 176, - 177, 7, 75, 2, 2, 177, 178, 7, 77, 2, 2, 178, 180, 7, 71, 2, 2, 179, 171, - 3, 2, 2, 2, 179, 175, 3, 2, 2, 2, 180, 26, 3, 2, 2, 2, 181, 182, 7, 103, - 2, 2, 182, 183, 7, 122, 2, 2, 183, 184, 7, 107, 2, 2, 184, 185, 7, 117, - 2, 2, 185, 186, 7, 118, 2, 2, 186, 194, 7, 117, 2, 2, 187, 188, 7, 71, - 2, 2, 188, 189, 7, 90, 2, 2, 189, 190, 7, 75, 2, 2, 190, 191, 7, 85, 2, - 2, 191, 192, 7, 86, 2, 2, 192, 194, 7, 85, 2, 2, 193, 181, 3, 2, 2, 2, - 193, 187, 3, 2, 2, 2, 194, 28, 3, 2, 2, 2, 195, 196, 7, 45, 2, 2, 196, - 30, 3, 2, 2, 2, 197, 198, 7, 47, 2, 2, 198, 32, 3, 2, 2, 2, 199, 200, 7, - 44, 2, 2, 200, 34, 3, 2, 2, 2, 201, 202, 7, 49, 2, 2, 202, 36, 3, 2, 2, - 2, 203, 204, 7, 39, 2, 2, 204, 38, 3, 2, 2, 2, 205, 206, 7, 44, 2, 2, 206, - 207, 7, 44, 2, 2, 207, 40, 3, 2, 2, 2, 208, 209, 7, 62, 2, 2, 209, 210, - 7, 62, 2, 2, 210, 42, 3, 2, 2, 2, 211, 212, 7, 64, 2, 2, 212, 213, 7, 64, - 2, 2, 213, 44, 3, 2, 2, 2, 214, 215, 7, 40, 2, 2, 215, 46, 3, 2, 2, 2, - 216, 217, 7, 126, 2, 2, 217, 48, 3, 2, 2, 2, 218, 219, 7, 96, 2, 2, 219, - 50, 3, 2, 2, 2, 220, 221, 7, 40, 2, 2, 221, 226, 7, 40, 2, 2, 222, 223, - 7, 99, 2, 2, 223, 224, 7, 112, 2, 2, 224, 226, 7, 102, 2, 2, 225, 220, - 3, 2, 2, 2, 225, 222, 3, 2, 2, 2, 226, 52, 3, 2, 2, 2, 227, 228, 7, 126, - 2, 2, 228, 232, 7, 126, 2, 2, 229, 230, 7, 113, 2, 2, 230, 232, 7, 116, - 2, 2, 231, 227, 3, 2, 2, 2, 231, 229, 3, 2, 2, 2, 232, 54, 3, 2, 2, 2, - 233, 234, 7, 128, 2, 2, 234, 56, 3, 2, 2, 2, 235, 240, 7, 35, 2, 2, 236, - 237, 7, 112, 2, 2, 237, 238, 7, 113, 2, 2, 238, 240, 7, 118, 2, 2, 239, - 235, 3, 2, 2, 2, 239, 236, 3, 2, 2, 2, 240, 58, 3, 2, 2, 2, 241, 242, 7, - 107, 2, 2, 242, 243, 7, 112, 2, 2, 243, 60, 3, 2, 2, 2, 244, 245, 7, 112, - 2, 2, 245, 246, 7, 113, 2, 2, 246, 247, 7, 118, 2, 2, 247, 248, 7, 34, - 2, 2, 248, 249, 7, 107, 2, 2, 249, 250, 7, 112, 2, 2, 250, 62, 3, 2, 2, - 2, 251, 256, 7, 93, 2, 2, 252, 255, 5, 141, 71, 2, 253, 255, 5, 143, 72, - 2, 254, 252, 3, 2, 2, 2, 254, 253, 3, 2, 2, 2, 255, 258, 3, 2, 2, 2, 256, - 254, 3, 2, 2, 2, 256, 257, 3, 2, 2, 2, 257, 259, 3, 2, 2, 2, 258, 256, - 3, 2, 2, 2, 259, 260, 7, 95, 2, 2, 260, 64, 3, 2, 2, 2, 261, 262, 7, 108, - 2, 2, 262, 263, 7, 117, 2, 2, 263, 264, 7, 113, 2, 2, 264, 265, 7, 112, - 2, 2, 265, 266, 7, 97, 2, 2, 266, 267, 7, 101, 2, 2, 267, 268, 7, 113, - 2, 2, 268, 269, 7, 112, 2, 2, 269, 270, 7, 118, 2, 2, 270, 271, 7, 99, - 2, 2, 271, 272, 7, 107, 2, 2, 272, 273, 7, 112, 2, 2, 273, 288, 7, 117, - 2, 2, 274, 275, 7, 76, 2, 2, 275, 276, 7, 85, 2, 2, 276, 277, 7, 81, 2, - 2, 277, 278, 7, 80, 2, 2, 278, 279, 7, 97, 2, 2, 279, 280, 7, 69, 2, 2, - 280, 281, 7, 81, 2, 2, 281, 282, 7, 80, 2, 2, 282, 283, 7, 86, 2, 2, 283, - 284, 7, 67, 2, 2, 284, 285, 7, 75, 2, 2, 285, 286, 7, 80, 2, 2, 286, 288, - 7, 85, 2, 2, 287, 261, 3, 2, 2, 2, 287, 274, 3, 2, 2, 2, 288, 66, 3, 2, - 2, 2, 289, 290, 7, 108, 2, 2, 290, 291, 7, 117, 2, 2, 291, 292, 7, 113, - 2, 2, 292, 293, 7, 112, 2, 2, 293, 294, 7, 97, 2, 2, 294, 295, 7, 101, - 2, 2, 295, 296, 7, 113, 2, 2, 296, 297, 7, 112, 2, 2, 297, 298, 7, 118, - 2, 2, 298, 299, 7, 99, 2, 2, 299, 300, 7, 107, 2, 2, 300, 301, 7, 112, - 2, 2, 301, 302, 7, 117, 2, 2, 302, 303, 7, 97, 2, 2, 303, 304, 7, 99, 2, - 2, 304, 305, 7, 110, 2, 2, 305, 324, 7, 110, 2, 2, 306, 307, 7, 76, 2, - 2, 307, 308, 7, 85, 2, 2, 308, 309, 7, 81, 2, 2, 309, 310, 7, 80, 2, 2, - 310, 311, 7, 97, 2, 2, 311, 312, 7, 69, 2, 2, 312, 313, 7, 81, 2, 2, 313, - 314, 7, 80, 2, 2, 314, 315, 7, 86, 2, 2, 315, 316, 7, 67, 2, 2, 316, 317, - 7, 75, 2, 2, 317, 318, 7, 80, 2, 2, 318, 319, 7, 85, 2, 2, 319, 320, 7, - 97, 2, 2, 320, 321, 7, 67, 2, 2, 321, 322, 7, 78, 2, 2, 322, 324, 7, 78, - 2, 2, 323, 289, 3, 2, 2, 2, 323, 306, 3, 2, 2, 2, 324, 68, 3, 2, 2, 2, - 325, 326, 7, 108, 2, 2, 326, 327, 7, 117, 2, 2, 327, 328, 7, 113, 2, 2, - 328, 329, 7, 112, 2, 2, 329, 330, 7, 97, 2, 2, 330, 331, 7, 101, 2, 2, - 331, 332, 7, 113, 2, 2, 332, 333, 7, 112, 2, 2, 333, 334, 7, 118, 2, 2, - 334, 335, 7, 99, 2, 2, 335, 336, 7, 107, 2, 2, 336, 337, 7, 112, 2, 2, - 337, 338, 7, 117, 2, 2, 338, 339, 7, 97, 2, 2, 339, 340, 7, 99, 2, 2, 340, - 341, 7, 112, 2, 2, 341, 360, 7, 123, 2, 2, 342, 343, 7, 76, 2, 2, 343, - 344, 7, 85, 2, 2, 344, 345, 7, 81, 2, 2, 345, 346, 7, 80, 2, 2, 346, 347, - 7, 97, 2, 2, 347, 348, 7, 69, 2, 2, 348, 349, 7, 81, 2, 2, 349, 350, 7, - 80, 2, 2, 350, 351, 7, 86, 2, 2, 351, 352, 7, 67, 2, 2, 352, 353, 7, 75, - 2, 2, 353, 354, 7, 80, 2, 2, 354, 355, 7, 85, 2, 2, 355, 356, 7, 97, 2, - 2, 356, 357, 7, 67, 2, 2, 357, 358, 7, 80, 2, 2, 358, 360, 7, 91, 2, 2, - 359, 325, 3, 2, 2, 2, 359, 342, 3, 2, 2, 2, 360, 70, 3, 2, 2, 2, 361, 362, - 7, 99, 2, 2, 362, 363, 7, 116, 2, 2, 363, 364, 7, 116, 2, 2, 364, 365, - 7, 99, 2, 2, 365, 366, 7, 123, 2, 2, 366, 367, 7, 97, 2, 2, 367, 368, 7, - 101, 2, 2, 368, 369, 7, 113, 2, 2, 369, 370, 7, 112, 2, 2, 370, 371, 7, - 118, 2, 2, 371, 372, 7, 99, 2, 2, 372, 373, 7, 107, 2, 2, 373, 374, 7, - 112, 2, 2, 374, 390, 7, 117, 2, 2, 375, 376, 7, 67, 2, 2, 376, 377, 7, - 84, 2, 2, 377, 378, 7, 84, 2, 2, 378, 379, 7, 67, 2, 2, 379, 380, 7, 91, - 2, 2, 380, 381, 7, 97, 2, 2, 381, 382, 7, 69, 2, 2, 382, 383, 7, 81, 2, - 2, 383, 384, 7, 80, 2, 2, 384, 385, 7, 86, 2, 2, 385, 386, 7, 67, 2, 2, - 386, 387, 7, 75, 2, 2, 387, 388, 7, 80, 2, 2, 388, 390, 7, 85, 2, 2, 389, - 361, 3, 2, 2, 2, 389, 375, 3, 2, 2, 2, 390, 72, 3, 2, 2, 2, 391, 392, 7, - 99, 2, 2, 392, 393, 7, 116, 2, 2, 393, 394, 7, 116, 2, 2, 394, 395, 7, - 99, 2, 2, 395, 396, 7, 123, 2, 2, 396, 397, 7, 97, 2, 2, 397, 398, 7, 101, - 2, 2, 398, 399, 7, 113, 2, 2, 399, 400, 7, 112, 2, 2, 400, 401, 7, 118, - 2, 2, 401, 402, 7, 99, 2, 2, 402, 403, 7, 107, 2, 2, 403, 404, 7, 112, - 2, 2, 404, 405, 7, 117, 2, 2, 405, 406, 7, 97, 2, 2, 406, 407, 7, 99, 2, - 2, 407, 408, 7, 110, 2, 2, 408, 428, 7, 110, 2, 2, 409, 410, 7, 67, 2, - 2, 410, 411, 7, 84, 2, 2, 411, 412, 7, 84, 2, 2, 412, 413, 7, 67, 2, 2, - 413, 414, 7, 91, 2, 2, 414, 415, 7, 97, 2, 2, 415, 416, 7, 69, 2, 2, 416, - 417, 7, 81, 2, 2, 417, 418, 7, 80, 2, 2, 418, 419, 7, 86, 2, 2, 419, 420, - 7, 67, 2, 2, 420, 421, 7, 75, 2, 2, 421, 422, 7, 80, 2, 2, 422, 423, 7, - 85, 2, 2, 423, 424, 7, 97, 2, 2, 424, 425, 7, 67, 2, 2, 425, 426, 7, 78, - 2, 2, 426, 428, 7, 78, 2, 2, 427, 391, 3, 2, 2, 2, 427, 409, 3, 2, 2, 2, - 428, 74, 3, 2, 2, 2, 429, 430, 7, 99, 2, 2, 430, 431, 7, 116, 2, 2, 431, - 432, 7, 116, 2, 2, 432, 433, 7, 99, 2, 2, 433, 434, 7, 123, 2, 2, 434, - 435, 7, 97, 2, 2, 435, 436, 7, 101, 2, 2, 436, 437, 7, 113, 2, 2, 437, - 438, 7, 112, 2, 2, 438, 439, 7, 118, 2, 2, 439, 440, 7, 99, 2, 2, 440, - 441, 7, 107, 2, 2, 441, 442, 7, 112, 2, 2, 442, 443, 7, 117, 2, 2, 443, - 444, 7, 97, 2, 2, 444, 445, 7, 99, 2, 2, 445, 446, 7, 112, 2, 2, 446, 466, - 7, 123, 2, 2, 447, 448, 7, 67, 2, 2, 448, 449, 7, 84, 2, 2, 449, 450, 7, - 84, 2, 2, 450, 451, 7, 67, 2, 2, 451, 452, 7, 91, 2, 2, 452, 453, 7, 97, - 2, 2, 453, 454, 7, 69, 2, 2, 454, 455, 7, 81, 2, 2, 455, 456, 7, 80, 2, - 2, 456, 457, 7, 86, 2, 2, 457, 458, 7, 67, 2, 2, 458, 459, 7, 75, 2, 2, - 459, 460, 7, 80, 2, 2, 460, 461, 7, 85, 2, 2, 461, 462, 7, 97, 2, 2, 462, - 463, 7, 67, 2, 2, 463, 464, 7, 80, 2, 2, 464, 466, 7, 91, 2, 2, 465, 429, - 3, 2, 2, 2, 465, 447, 3, 2, 2, 2, 466, 76, 3, 2, 2, 2, 467, 468, 7, 99, - 2, 2, 468, 469, 7, 116, 2, 2, 469, 470, 7, 116, 2, 2, 470, 471, 7, 99, - 2, 2, 471, 472, 7, 123, 2, 2, 472, 473, 7, 97, 2, 2, 473, 474, 7, 110, - 2, 2, 474, 475, 7, 103, 2, 2, 475, 476, 7, 112, 2, 2, 476, 477, 7, 105, - 2, 2, 477, 478, 7, 118, 2, 2, 478, 492, 7, 106, 2, 2, 479, 480, 7, 67, - 2, 2, 480, 481, 7, 84, 2, 2, 481, 482, 7, 84, 2, 2, 482, 483, 7, 67, 2, - 2, 483, 484, 7, 91, 2, 2, 484, 485, 7, 97, 2, 2, 485, 486, 7, 78, 2, 2, - 486, 487, 7, 71, 2, 2, 487, 488, 7, 80, 2, 2, 488, 489, 7, 73, 2, 2, 489, - 490, 7, 86, 2, 2, 490, 492, 7, 74, 2, 2, 491, 467, 3, 2, 2, 2, 491, 479, - 3, 2, 2, 2, 492, 78, 3, 2, 2, 2, 493, 494, 7, 118, 2, 2, 494, 495, 7, 116, - 2, 2, 495, 496, 7, 119, 2, 2, 496, 521, 7, 103, 2, 2, 497, 498, 7, 86, - 2, 2, 498, 499, 7, 116, 2, 2, 499, 500, 7, 119, 2, 2, 500, 521, 7, 103, - 2, 2, 501, 502, 7, 86, 2, 2, 502, 503, 7, 84, 2, 2, 503, 504, 7, 87, 2, - 2, 504, 521, 7, 71, 2, 2, 505, 506, 7, 104, 2, 2, 506, 507, 7, 99, 2, 2, - 507, 508, 7, 110, 2, 2, 508, 509, 7, 117, 2, 2, 509, 521, 7, 103, 2, 2, - 510, 511, 7, 72, 2, 2, 511, 512, 7, 99, 2, 2, 512, 513, 7, 110, 2, 2, 513, - 514, 7, 117, 2, 2, 514, 521, 7, 103, 2, 2, 515, 516, 7, 72, 2, 2, 516, - 517, 7, 67, 2, 2, 517, 518, 7, 78, 2, 2, 518, 519, 7, 85, 2, 2, 519, 521, - 7, 71, 2, 2, 520, 493, 3, 2, 2, 2, 520, 497, 3, 2, 2, 2, 520, 501, 3, 2, - 2, 2, 520, 505, 3, 2, 2, 2, 520, 510, 3, 2, 2, 2, 520, 515, 3, 2, 2, 2, - 521, 80, 3, 2, 2, 2, 522, 527, 5, 107, 54, 2, 523, 527, 5, 109, 55, 2, - 524, 527, 5, 111, 56, 2, 525, 527, 5, 105, 53, 2, 526, 522, 3, 2, 2, 2, - 526, 523, 3, 2, 2, 2, 526, 524, 3, 2, 2, 2, 526, 525, 3, 2, 2, 2, 527, - 82, 3, 2, 2, 2, 528, 531, 5, 123, 62, 2, 529, 531, 5, 125, 63, 2, 530, - 528, 3, 2, 2, 2, 530, 529, 3, 2, 2, 2, 531, 84, 3, 2, 2, 2, 532, 537, 5, - 101, 51, 2, 533, 536, 5, 101, 51, 2, 534, 536, 5, 103, 52, 2, 535, 533, - 3, 2, 2, 2, 535, 534, 3, 2, 2, 2, 536, 539, 3, 2, 2, 2, 537, 535, 3, 2, - 2, 2, 537, 538, 3, 2, 2, 2, 538, 546, 3, 2, 2, 2, 539, 537, 3, 2, 2, 2, - 540, 541, 7, 38, 2, 2, 541, 542, 7, 111, 2, 2, 542, 543, 7, 103, 2, 2, - 543, 544, 7, 118, 2, 2, 544, 546, 7, 99, 2, 2, 545, 532, 3, 2, 2, 2, 545, - 540, 3, 2, 2, 2, 546, 86, 3, 2, 2, 2, 547, 549, 5, 91, 46, 2, 548, 547, - 3, 2, 2, 2, 548, 549, 3, 2, 2, 2, 549, 560, 3, 2, 2, 2, 550, 552, 7, 36, - 2, 2, 551, 553, 5, 93, 47, 2, 552, 551, 3, 2, 2, 2, 552, 553, 3, 2, 2, - 2, 553, 554, 3, 2, 2, 2, 554, 561, 7, 36, 2, 2, 555, 557, 7, 41, 2, 2, - 556, 558, 5, 95, 48, 2, 557, 556, 3, 2, 2, 2, 557, 558, 3, 2, 2, 2, 558, - 559, 3, 2, 2, 2, 559, 561, 7, 41, 2, 2, 560, 550, 3, 2, 2, 2, 560, 555, - 3, 2, 2, 2, 561, 88, 3, 2, 2, 2, 562, 570, 5, 85, 43, 2, 563, 566, 7, 93, - 2, 2, 564, 567, 5, 87, 44, 2, 565, 567, 5, 107, 54, 2, 566, 564, 3, 2, - 2, 2, 566, 565, 3, 2, 2, 2, 567, 568, 3, 2, 2, 2, 568, 569, 7, 95, 2, 2, - 569, 571, 3, 2, 2, 2, 570, 563, 3, 2, 2, 2, 571, 572, 3, 2, 2, 2, 572, - 570, 3, 2, 2, 2, 572, 573, 3, 2, 2, 2, 573, 90, 3, 2, 2, 2, 574, 575, 7, - 119, 2, 2, 575, 578, 7, 58, 2, 2, 576, 578, 9, 2, 2, 2, 577, 574, 3, 2, - 2, 2, 577, 576, 3, 2, 2, 2, 578, 92, 3, 2, 2, 2, 579, 581, 5, 97, 49, 2, - 580, 579, 3, 2, 2, 2, 581, 582, 3, 2, 2, 2, 582, 580, 3, 2, 2, 2, 582, - 583, 3, 2, 2, 2, 583, 94, 3, 2, 2, 2, 584, 586, 5, 99, 50, 2, 585, 584, - 3, 2, 2, 2, 586, 587, 3, 2, 2, 2, 587, 585, 3, 2, 2, 2, 587, 588, 3, 2, - 2, 2, 588, 96, 3, 2, 2, 2, 589, 597, 10, 3, 2, 2, 590, 597, 5, 139, 70, - 2, 591, 592, 7, 94, 2, 2, 592, 597, 7, 12, 2, 2, 593, 594, 7, 94, 2, 2, - 594, 595, 7, 15, 2, 2, 595, 597, 7, 12, 2, 2, 596, 589, 3, 2, 2, 2, 596, - 590, 3, 2, 2, 2, 596, 591, 3, 2, 2, 2, 596, 593, 3, 2, 2, 2, 597, 98, 3, - 2, 2, 2, 598, 606, 10, 4, 2, 2, 599, 606, 5, 139, 70, 2, 600, 601, 7, 94, - 2, 2, 601, 606, 7, 12, 2, 2, 602, 603, 7, 94, 2, 2, 603, 604, 7, 15, 2, - 2, 604, 606, 7, 12, 2, 2, 605, 598, 3, 2, 2, 2, 605, 599, 3, 2, 2, 2, 605, - 600, 3, 2, 2, 2, 605, 602, 3, 2, 2, 2, 606, 100, 3, 2, 2, 2, 607, 608, - 9, 5, 2, 2, 608, 102, 3, 2, 2, 2, 609, 610, 9, 6, 2, 2, 610, 104, 3, 2, - 2, 2, 611, 612, 7, 50, 2, 2, 612, 614, 9, 7, 2, 2, 613, 615, 9, 8, 2, 2, - 614, 613, 3, 2, 2, 2, 615, 616, 3, 2, 2, 2, 616, 614, 3, 2, 2, 2, 616, - 617, 3, 2, 2, 2, 617, 106, 3, 2, 2, 2, 618, 622, 5, 113, 57, 2, 619, 621, - 5, 103, 52, 2, 620, 619, 3, 2, 2, 2, 621, 624, 3, 2, 2, 2, 622, 620, 3, - 2, 2, 2, 622, 623, 3, 2, 2, 2, 623, 627, 3, 2, 2, 2, 624, 622, 3, 2, 2, - 2, 625, 627, 7, 50, 2, 2, 626, 618, 3, 2, 2, 2, 626, 625, 3, 2, 2, 2, 627, - 108, 3, 2, 2, 2, 628, 632, 7, 50, 2, 2, 629, 631, 5, 115, 58, 2, 630, 629, - 3, 2, 2, 2, 631, 634, 3, 2, 2, 2, 632, 630, 3, 2, 2, 2, 632, 633, 3, 2, - 2, 2, 633, 110, 3, 2, 2, 2, 634, 632, 3, 2, 2, 2, 635, 636, 7, 50, 2, 2, - 636, 637, 9, 9, 2, 2, 637, 638, 5, 135, 68, 2, 638, 112, 3, 2, 2, 2, 639, - 640, 9, 10, 2, 2, 640, 114, 3, 2, 2, 2, 641, 642, 9, 11, 2, 2, 642, 116, - 3, 2, 2, 2, 643, 644, 9, 12, 2, 2, 644, 118, 3, 2, 2, 2, 645, 646, 5, 117, - 59, 2, 646, 647, 5, 117, 59, 2, 647, 648, 5, 117, 59, 2, 648, 649, 5, 117, - 59, 2, 649, 120, 3, 2, 2, 2, 650, 651, 7, 94, 2, 2, 651, 652, 7, 119, 2, - 2, 652, 653, 3, 2, 2, 2, 653, 661, 5, 119, 60, 2, 654, 655, 7, 94, 2, 2, - 655, 656, 7, 87, 2, 2, 656, 657, 3, 2, 2, 2, 657, 658, 5, 119, 60, 2, 658, - 659, 5, 119, 60, 2, 659, 661, 3, 2, 2, 2, 660, 650, 3, 2, 2, 2, 660, 654, - 3, 2, 2, 2, 661, 122, 3, 2, 2, 2, 662, 664, 5, 127, 64, 2, 663, 665, 5, - 129, 65, 2, 664, 663, 3, 2, 2, 2, 664, 665, 3, 2, 2, 2, 665, 670, 3, 2, - 2, 2, 666, 667, 5, 131, 66, 2, 667, 668, 5, 129, 65, 2, 668, 670, 3, 2, - 2, 2, 669, 662, 3, 2, 2, 2, 669, 666, 3, 2, 2, 2, 670, 124, 3, 2, 2, 2, - 671, 672, 7, 50, 2, 2, 672, 675, 9, 9, 2, 2, 673, 676, 5, 133, 67, 2, 674, - 676, 5, 135, 68, 2, 675, 673, 3, 2, 2, 2, 675, 674, 3, 2, 2, 2, 676, 677, - 3, 2, 2, 2, 677, 678, 5, 137, 69, 2, 678, 126, 3, 2, 2, 2, 679, 681, 5, - 131, 66, 2, 680, 679, 3, 2, 2, 2, 680, 681, 3, 2, 2, 2, 681, 682, 3, 2, - 2, 2, 682, 683, 7, 48, 2, 2, 683, 688, 5, 131, 66, 2, 684, 685, 5, 131, - 66, 2, 685, 686, 7, 48, 2, 2, 686, 688, 3, 2, 2, 2, 687, 680, 3, 2, 2, - 2, 687, 684, 3, 2, 2, 2, 688, 128, 3, 2, 2, 2, 689, 691, 9, 13, 2, 2, 690, - 692, 9, 14, 2, 2, 691, 690, 3, 2, 2, 2, 691, 692, 3, 2, 2, 2, 692, 693, - 3, 2, 2, 2, 693, 694, 5, 131, 66, 2, 694, 130, 3, 2, 2, 2, 695, 697, 5, - 103, 52, 2, 696, 695, 3, 2, 2, 2, 697, 698, 3, 2, 2, 2, 698, 696, 3, 2, - 2, 2, 698, 699, 3, 2, 2, 2, 699, 132, 3, 2, 2, 2, 700, 702, 5, 135, 68, - 2, 701, 700, 3, 2, 2, 2, 701, 702, 3, 2, 2, 2, 702, 703, 3, 2, 2, 2, 703, - 704, 7, 48, 2, 2, 704, 709, 5, 135, 68, 2, 705, 706, 5, 135, 68, 2, 706, - 707, 7, 48, 2, 2, 707, 709, 3, 2, 2, 2, 708, 701, 3, 2, 2, 2, 708, 705, - 3, 2, 2, 2, 709, 134, 3, 2, 2, 2, 710, 712, 5, 117, 59, 2, 711, 710, 3, - 2, 2, 2, 712, 713, 3, 2, 2, 2, 713, 711, 3, 2, 2, 2, 713, 714, 3, 2, 2, - 2, 714, 136, 3, 2, 2, 2, 715, 717, 9, 15, 2, 2, 716, 718, 9, 14, 2, 2, - 717, 716, 3, 2, 2, 2, 717, 718, 3, 2, 2, 2, 718, 719, 3, 2, 2, 2, 719, - 720, 5, 131, 66, 2, 720, 138, 3, 2, 2, 2, 721, 722, 7, 94, 2, 2, 722, 737, - 9, 16, 2, 2, 723, 724, 7, 94, 2, 2, 724, 726, 5, 115, 58, 2, 725, 727, - 5, 115, 58, 2, 726, 725, 3, 2, 2, 2, 726, 727, 3, 2, 2, 2, 727, 729, 3, - 2, 2, 2, 728, 730, 5, 115, 58, 2, 729, 728, 3, 2, 2, 2, 729, 730, 3, 2, - 2, 2, 730, 737, 3, 2, 2, 2, 731, 732, 7, 94, 2, 2, 732, 733, 7, 122, 2, - 2, 733, 734, 3, 2, 2, 2, 734, 737, 5, 135, 68, 2, 735, 737, 5, 121, 61, - 2, 736, 721, 3, 2, 2, 2, 736, 723, 3, 2, 2, 2, 736, 731, 3, 2, 2, 2, 736, - 735, 3, 2, 2, 2, 737, 140, 3, 2, 2, 2, 738, 740, 9, 17, 2, 2, 739, 738, - 3, 2, 2, 2, 740, 741, 3, 2, 2, 2, 741, 739, 3, 2, 2, 2, 741, 742, 3, 2, - 2, 2, 742, 743, 3, 2, 2, 2, 743, 744, 8, 71, 2, 2, 744, 142, 3, 2, 2, 2, - 745, 747, 7, 15, 2, 2, 746, 748, 7, 12, 2, 2, 747, 746, 3, 2, 2, 2, 747, - 748, 3, 2, 2, 2, 748, 751, 3, 2, 2, 2, 749, 751, 7, 12, 2, 2, 750, 745, - 3, 2, 2, 2, 750, 749, 3, 2, 2, 2, 751, 752, 3, 2, 2, 2, 752, 753, 8, 72, - 2, 2, 753, 144, 3, 2, 2, 2, 56, 2, 179, 193, 225, 231, 239, 254, 256, 287, - 323, 359, 389, 427, 465, 491, 520, 526, 530, 535, 537, 545, 548, 552, 557, - 560, 566, 572, 577, 582, 587, 596, 605, 616, 622, 626, 632, 660, 664, 669, - 675, 680, 687, 691, 698, 701, 708, 713, 717, 726, 729, 736, 741, 747, 750, - 3, 8, 2, 2, + 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, + 496, 10, 40, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, + 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, + 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 5, 41, 525, 10, + 41, 3, 42, 3, 42, 3, 42, 3, 42, 5, 42, 531, 10, 42, 3, 43, 3, 43, 5, 43, + 535, 10, 43, 3, 44, 3, 44, 3, 44, 7, 44, 540, 10, 44, 12, 44, 14, 44, 543, + 11, 44, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 46, 5, 46, 552, 10, + 46, 3, 46, 3, 46, 5, 46, 556, 10, 46, 3, 46, 3, 46, 3, 46, 5, 46, 561, + 10, 46, 3, 46, 5, 46, 564, 10, 46, 3, 47, 3, 47, 5, 47, 568, 10, 47, 3, + 47, 3, 47, 3, 47, 5, 47, 573, 10, 47, 3, 47, 3, 47, 6, 47, 577, 10, 47, + 13, 47, 14, 47, 578, 3, 48, 3, 48, 3, 48, 5, 48, 584, 10, 48, 3, 49, 6, + 49, 587, 10, 49, 13, 49, 14, 49, 588, 3, 50, 6, 50, 592, 10, 50, 13, 50, + 14, 50, 593, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 5, 51, 603, + 10, 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 5, 52, 612, 10, + 52, 3, 53, 3, 53, 3, 54, 3, 54, 3, 55, 3, 55, 3, 55, 6, 55, 621, 10, 55, + 13, 55, 14, 55, 622, 3, 56, 3, 56, 7, 56, 627, 10, 56, 12, 56, 14, 56, + 630, 11, 56, 3, 56, 5, 56, 633, 10, 56, 3, 57, 3, 57, 7, 57, 637, 10, 57, + 12, 57, 14, 57, 640, 11, 57, 3, 58, 3, 58, 3, 58, 3, 58, 3, 59, 3, 59, + 3, 60, 3, 60, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 63, 3, + 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 5, 63, 667, + 10, 63, 3, 64, 3, 64, 5, 64, 671, 10, 64, 3, 64, 3, 64, 3, 64, 5, 64, 676, + 10, 64, 3, 65, 3, 65, 3, 65, 3, 65, 5, 65, 682, 10, 65, 3, 65, 3, 65, 3, + 66, 5, 66, 687, 10, 66, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 5, 66, 694, + 10, 66, 3, 67, 3, 67, 5, 67, 698, 10, 67, 3, 67, 3, 67, 3, 68, 6, 68, 703, + 10, 68, 13, 68, 14, 68, 704, 3, 69, 5, 69, 708, 10, 69, 3, 69, 3, 69, 3, + 69, 3, 69, 3, 69, 5, 69, 715, 10, 69, 3, 70, 6, 70, 718, 10, 70, 13, 70, + 14, 70, 719, 3, 71, 3, 71, 5, 71, 724, 10, 71, 3, 71, 3, 71, 3, 72, 3, + 72, 3, 72, 3, 72, 3, 72, 5, 72, 733, 10, 72, 3, 72, 5, 72, 736, 10, 72, + 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 5, 72, 743, 10, 72, 3, 73, 6, 73, 746, + 10, 73, 13, 73, 14, 73, 747, 3, 73, 3, 73, 3, 74, 3, 74, 5, 74, 754, 10, + 74, 3, 74, 5, 74, 757, 10, 74, 3, 74, 3, 74, 2, 2, 75, 3, 3, 5, 4, 7, 5, + 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, + 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, + 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, + 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, + 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 95, 2, 97, 2, 99, 2, + 101, 2, 103, 2, 105, 2, 107, 2, 109, 2, 111, 2, 113, 2, 115, 2, 117, 2, + 119, 2, 121, 2, 123, 2, 125, 2, 127, 2, 129, 2, 131, 2, 133, 2, 135, 2, + 137, 2, 139, 2, 141, 2, 143, 2, 145, 49, 147, 50, 3, 2, 18, 5, 2, 78, 78, + 87, 87, 119, 119, 6, 2, 12, 12, 15, 15, 36, 36, 94, 94, 6, 2, 12, 12, 15, + 15, 41, 41, 94, 94, 5, 2, 67, 92, 97, 97, 99, 124, 3, 2, 50, 59, 4, 2, + 68, 68, 100, 100, 3, 2, 50, 51, 4, 2, 90, 90, 122, 122, 3, 2, 51, 59, 3, + 2, 50, 57, 5, 2, 50, 59, 67, 72, 99, 104, 4, 2, 71, 71, 103, 103, 4, 2, + 45, 45, 47, 47, 4, 2, 82, 82, 114, 114, 12, 2, 36, 36, 41, 41, 65, 65, + 94, 94, 99, 100, 104, 104, 112, 112, 116, 116, 118, 118, 120, 120, 4, 2, + 11, 11, 34, 34, 2, 800, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, + 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, + 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, + 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, + 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, + 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, + 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, + 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, + 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, + 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, + 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, + 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, + 2, 2, 93, 3, 2, 2, 2, 2, 145, 3, 2, 2, 2, 2, 147, 3, 2, 2, 2, 3, 149, 3, + 2, 2, 2, 5, 151, 3, 2, 2, 2, 7, 153, 3, 2, 2, 2, 9, 155, 3, 2, 2, 2, 11, + 157, 3, 2, 2, 2, 13, 159, 3, 2, 2, 2, 15, 161, 3, 2, 2, 2, 17, 163, 3, + 2, 2, 2, 19, 165, 3, 2, 2, 2, 21, 168, 3, 2, 2, 2, 23, 170, 3, 2, 2, 2, + 25, 173, 3, 2, 2, 2, 27, 176, 3, 2, 2, 2, 29, 187, 3, 2, 2, 2, 31, 201, + 3, 2, 2, 2, 33, 203, 3, 2, 2, 2, 35, 205, 3, 2, 2, 2, 37, 207, 3, 2, 2, + 2, 39, 209, 3, 2, 2, 2, 41, 211, 3, 2, 2, 2, 43, 213, 3, 2, 2, 2, 45, 216, + 3, 2, 2, 2, 47, 219, 3, 2, 2, 2, 49, 222, 3, 2, 2, 2, 51, 224, 3, 2, 2, + 2, 53, 226, 3, 2, 2, 2, 55, 233, 3, 2, 2, 2, 57, 239, 3, 2, 2, 2, 59, 241, + 3, 2, 2, 2, 61, 247, 3, 2, 2, 2, 63, 253, 3, 2, 2, 2, 65, 255, 3, 2, 2, + 2, 67, 291, 3, 2, 2, 2, 69, 327, 3, 2, 2, 2, 71, 363, 3, 2, 2, 2, 73, 393, + 3, 2, 2, 2, 75, 431, 3, 2, 2, 2, 77, 469, 3, 2, 2, 2, 79, 495, 3, 2, 2, + 2, 81, 524, 3, 2, 2, 2, 83, 530, 3, 2, 2, 2, 85, 534, 3, 2, 2, 2, 87, 536, + 3, 2, 2, 2, 89, 544, 3, 2, 2, 2, 91, 551, 3, 2, 2, 2, 93, 567, 3, 2, 2, + 2, 95, 583, 3, 2, 2, 2, 97, 586, 3, 2, 2, 2, 99, 591, 3, 2, 2, 2, 101, + 602, 3, 2, 2, 2, 103, 611, 3, 2, 2, 2, 105, 613, 3, 2, 2, 2, 107, 615, + 3, 2, 2, 2, 109, 617, 3, 2, 2, 2, 111, 632, 3, 2, 2, 2, 113, 634, 3, 2, + 2, 2, 115, 641, 3, 2, 2, 2, 117, 645, 3, 2, 2, 2, 119, 647, 3, 2, 2, 2, + 121, 649, 3, 2, 2, 2, 123, 651, 3, 2, 2, 2, 125, 666, 3, 2, 2, 2, 127, + 675, 3, 2, 2, 2, 129, 677, 3, 2, 2, 2, 131, 693, 3, 2, 2, 2, 133, 695, + 3, 2, 2, 2, 135, 702, 3, 2, 2, 2, 137, 714, 3, 2, 2, 2, 139, 717, 3, 2, + 2, 2, 141, 721, 3, 2, 2, 2, 143, 742, 3, 2, 2, 2, 145, 745, 3, 2, 2, 2, + 147, 756, 3, 2, 2, 2, 149, 150, 7, 42, 2, 2, 150, 4, 3, 2, 2, 2, 151, 152, + 7, 43, 2, 2, 152, 6, 3, 2, 2, 2, 153, 154, 7, 93, 2, 2, 154, 8, 3, 2, 2, + 2, 155, 156, 7, 46, 2, 2, 156, 10, 3, 2, 2, 2, 157, 158, 7, 95, 2, 2, 158, + 12, 3, 2, 2, 2, 159, 160, 7, 125, 2, 2, 160, 14, 3, 2, 2, 2, 161, 162, + 7, 127, 2, 2, 162, 16, 3, 2, 2, 2, 163, 164, 7, 62, 2, 2, 164, 18, 3, 2, + 2, 2, 165, 166, 7, 62, 2, 2, 166, 167, 7, 63, 2, 2, 167, 20, 3, 2, 2, 2, + 168, 169, 7, 64, 2, 2, 169, 22, 3, 2, 2, 2, 170, 171, 7, 64, 2, 2, 171, + 172, 7, 63, 2, 2, 172, 24, 3, 2, 2, 2, 173, 174, 7, 63, 2, 2, 174, 175, + 7, 63, 2, 2, 175, 26, 3, 2, 2, 2, 176, 177, 7, 35, 2, 2, 177, 178, 7, 63, + 2, 2, 178, 28, 3, 2, 2, 2, 179, 180, 7, 110, 2, 2, 180, 181, 7, 107, 2, + 2, 181, 182, 7, 109, 2, 2, 182, 188, 7, 103, 2, 2, 183, 184, 7, 78, 2, + 2, 184, 185, 7, 75, 2, 2, 185, 186, 7, 77, 2, 2, 186, 188, 7, 71, 2, 2, + 187, 179, 3, 2, 2, 2, 187, 183, 3, 2, 2, 2, 188, 30, 3, 2, 2, 2, 189, 190, + 7, 103, 2, 2, 190, 191, 7, 122, 2, 2, 191, 192, 7, 107, 2, 2, 192, 193, + 7, 117, 2, 2, 193, 194, 7, 118, 2, 2, 194, 202, 7, 117, 2, 2, 195, 196, + 7, 71, 2, 2, 196, 197, 7, 90, 2, 2, 197, 198, 7, 75, 2, 2, 198, 199, 7, + 85, 2, 2, 199, 200, 7, 86, 2, 2, 200, 202, 7, 85, 2, 2, 201, 189, 3, 2, + 2, 2, 201, 195, 3, 2, 2, 2, 202, 32, 3, 2, 2, 2, 203, 204, 7, 45, 2, 2, + 204, 34, 3, 2, 2, 2, 205, 206, 7, 47, 2, 2, 206, 36, 3, 2, 2, 2, 207, 208, + 7, 44, 2, 2, 208, 38, 3, 2, 2, 2, 209, 210, 7, 49, 2, 2, 210, 40, 3, 2, + 2, 2, 211, 212, 7, 39, 2, 2, 212, 42, 3, 2, 2, 2, 213, 214, 7, 44, 2, 2, + 214, 215, 7, 44, 2, 2, 215, 44, 3, 2, 2, 2, 216, 217, 7, 62, 2, 2, 217, + 218, 7, 62, 2, 2, 218, 46, 3, 2, 2, 2, 219, 220, 7, 64, 2, 2, 220, 221, + 7, 64, 2, 2, 221, 48, 3, 2, 2, 2, 222, 223, 7, 40, 2, 2, 223, 50, 3, 2, + 2, 2, 224, 225, 7, 126, 2, 2, 225, 52, 3, 2, 2, 2, 226, 227, 7, 96, 2, + 2, 227, 54, 3, 2, 2, 2, 228, 229, 7, 40, 2, 2, 229, 234, 7, 40, 2, 2, 230, + 231, 7, 99, 2, 2, 231, 232, 7, 112, 2, 2, 232, 234, 7, 102, 2, 2, 233, + 228, 3, 2, 2, 2, 233, 230, 3, 2, 2, 2, 234, 56, 3, 2, 2, 2, 235, 236, 7, + 126, 2, 2, 236, 240, 7, 126, 2, 2, 237, 238, 7, 113, 2, 2, 238, 240, 7, + 116, 2, 2, 239, 235, 3, 2, 2, 2, 239, 237, 3, 2, 2, 2, 240, 58, 3, 2, 2, + 2, 241, 242, 7, 128, 2, 2, 242, 60, 3, 2, 2, 2, 243, 248, 7, 35, 2, 2, + 244, 245, 7, 112, 2, 2, 245, 246, 7, 113, 2, 2, 246, 248, 7, 118, 2, 2, + 247, 243, 3, 2, 2, 2, 247, 244, 3, 2, 2, 2, 248, 62, 3, 2, 2, 2, 249, 250, + 7, 107, 2, 2, 250, 254, 7, 112, 2, 2, 251, 252, 7, 75, 2, 2, 252, 254, + 7, 80, 2, 2, 253, 249, 3, 2, 2, 2, 253, 251, 3, 2, 2, 2, 254, 64, 3, 2, + 2, 2, 255, 260, 7, 93, 2, 2, 256, 259, 5, 145, 73, 2, 257, 259, 5, 147, + 74, 2, 258, 256, 3, 2, 2, 2, 258, 257, 3, 2, 2, 2, 259, 262, 3, 2, 2, 2, + 260, 258, 3, 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 263, 3, 2, 2, 2, 262, + 260, 3, 2, 2, 2, 263, 264, 7, 95, 2, 2, 264, 66, 3, 2, 2, 2, 265, 266, + 7, 108, 2, 2, 266, 267, 7, 117, 2, 2, 267, 268, 7, 113, 2, 2, 268, 269, + 7, 112, 2, 2, 269, 270, 7, 97, 2, 2, 270, 271, 7, 101, 2, 2, 271, 272, + 7, 113, 2, 2, 272, 273, 7, 112, 2, 2, 273, 274, 7, 118, 2, 2, 274, 275, + 7, 99, 2, 2, 275, 276, 7, 107, 2, 2, 276, 277, 7, 112, 2, 2, 277, 292, + 7, 117, 2, 2, 278, 279, 7, 76, 2, 2, 279, 280, 7, 85, 2, 2, 280, 281, 7, + 81, 2, 2, 281, 282, 7, 80, 2, 2, 282, 283, 7, 97, 2, 2, 283, 284, 7, 69, + 2, 2, 284, 285, 7, 81, 2, 2, 285, 286, 7, 80, 2, 2, 286, 287, 7, 86, 2, + 2, 287, 288, 7, 67, 2, 2, 288, 289, 7, 75, 2, 2, 289, 290, 7, 80, 2, 2, + 290, 292, 7, 85, 2, 2, 291, 265, 3, 2, 2, 2, 291, 278, 3, 2, 2, 2, 292, + 68, 3, 2, 2, 2, 293, 294, 7, 108, 2, 2, 294, 295, 7, 117, 2, 2, 295, 296, + 7, 113, 2, 2, 296, 297, 7, 112, 2, 2, 297, 298, 7, 97, 2, 2, 298, 299, + 7, 101, 2, 2, 299, 300, 7, 113, 2, 2, 300, 301, 7, 112, 2, 2, 301, 302, + 7, 118, 2, 2, 302, 303, 7, 99, 2, 2, 303, 304, 7, 107, 2, 2, 304, 305, + 7, 112, 2, 2, 305, 306, 7, 117, 2, 2, 306, 307, 7, 97, 2, 2, 307, 308, + 7, 99, 2, 2, 308, 309, 7, 110, 2, 2, 309, 328, 7, 110, 2, 2, 310, 311, + 7, 76, 2, 2, 311, 312, 7, 85, 2, 2, 312, 313, 7, 81, 2, 2, 313, 314, 7, + 80, 2, 2, 314, 315, 7, 97, 2, 2, 315, 316, 7, 69, 2, 2, 316, 317, 7, 81, + 2, 2, 317, 318, 7, 80, 2, 2, 318, 319, 7, 86, 2, 2, 319, 320, 7, 67, 2, + 2, 320, 321, 7, 75, 2, 2, 321, 322, 7, 80, 2, 2, 322, 323, 7, 85, 2, 2, + 323, 324, 7, 97, 2, 2, 324, 325, 7, 67, 2, 2, 325, 326, 7, 78, 2, 2, 326, + 328, 7, 78, 2, 2, 327, 293, 3, 2, 2, 2, 327, 310, 3, 2, 2, 2, 328, 70, + 3, 2, 2, 2, 329, 330, 7, 108, 2, 2, 330, 331, 7, 117, 2, 2, 331, 332, 7, + 113, 2, 2, 332, 333, 7, 112, 2, 2, 333, 334, 7, 97, 2, 2, 334, 335, 7, + 101, 2, 2, 335, 336, 7, 113, 2, 2, 336, 337, 7, 112, 2, 2, 337, 338, 7, + 118, 2, 2, 338, 339, 7, 99, 2, 2, 339, 340, 7, 107, 2, 2, 340, 341, 7, + 112, 2, 2, 341, 342, 7, 117, 2, 2, 342, 343, 7, 97, 2, 2, 343, 344, 7, + 99, 2, 2, 344, 345, 7, 112, 2, 2, 345, 364, 7, 123, 2, 2, 346, 347, 7, + 76, 2, 2, 347, 348, 7, 85, 2, 2, 348, 349, 7, 81, 2, 2, 349, 350, 7, 80, + 2, 2, 350, 351, 7, 97, 2, 2, 351, 352, 7, 69, 2, 2, 352, 353, 7, 81, 2, + 2, 353, 354, 7, 80, 2, 2, 354, 355, 7, 86, 2, 2, 355, 356, 7, 67, 2, 2, + 356, 357, 7, 75, 2, 2, 357, 358, 7, 80, 2, 2, 358, 359, 7, 85, 2, 2, 359, + 360, 7, 97, 2, 2, 360, 361, 7, 67, 2, 2, 361, 362, 7, 80, 2, 2, 362, 364, + 7, 91, 2, 2, 363, 329, 3, 2, 2, 2, 363, 346, 3, 2, 2, 2, 364, 72, 3, 2, + 2, 2, 365, 366, 7, 99, 2, 2, 366, 367, 7, 116, 2, 2, 367, 368, 7, 116, + 2, 2, 368, 369, 7, 99, 2, 2, 369, 370, 7, 123, 2, 2, 370, 371, 7, 97, 2, + 2, 371, 372, 7, 101, 2, 2, 372, 373, 7, 113, 2, 2, 373, 374, 7, 112, 2, + 2, 374, 375, 7, 118, 2, 2, 375, 376, 7, 99, 2, 2, 376, 377, 7, 107, 2, + 2, 377, 378, 7, 112, 2, 2, 378, 394, 7, 117, 2, 2, 379, 380, 7, 67, 2, + 2, 380, 381, 7, 84, 2, 2, 381, 382, 7, 84, 2, 2, 382, 383, 7, 67, 2, 2, + 383, 384, 7, 91, 2, 2, 384, 385, 7, 97, 2, 2, 385, 386, 7, 69, 2, 2, 386, + 387, 7, 81, 2, 2, 387, 388, 7, 80, 2, 2, 388, 389, 7, 86, 2, 2, 389, 390, + 7, 67, 2, 2, 390, 391, 7, 75, 2, 2, 391, 392, 7, 80, 2, 2, 392, 394, 7, + 85, 2, 2, 393, 365, 3, 2, 2, 2, 393, 379, 3, 2, 2, 2, 394, 74, 3, 2, 2, + 2, 395, 396, 7, 99, 2, 2, 396, 397, 7, 116, 2, 2, 397, 398, 7, 116, 2, + 2, 398, 399, 7, 99, 2, 2, 399, 400, 7, 123, 2, 2, 400, 401, 7, 97, 2, 2, + 401, 402, 7, 101, 2, 2, 402, 403, 7, 113, 2, 2, 403, 404, 7, 112, 2, 2, + 404, 405, 7, 118, 2, 2, 405, 406, 7, 99, 2, 2, 406, 407, 7, 107, 2, 2, + 407, 408, 7, 112, 2, 2, 408, 409, 7, 117, 2, 2, 409, 410, 7, 97, 2, 2, + 410, 411, 7, 99, 2, 2, 411, 412, 7, 110, 2, 2, 412, 432, 7, 110, 2, 2, + 413, 414, 7, 67, 2, 2, 414, 415, 7, 84, 2, 2, 415, 416, 7, 84, 2, 2, 416, + 417, 7, 67, 2, 2, 417, 418, 7, 91, 2, 2, 418, 419, 7, 97, 2, 2, 419, 420, + 7, 69, 2, 2, 420, 421, 7, 81, 2, 2, 421, 422, 7, 80, 2, 2, 422, 423, 7, + 86, 2, 2, 423, 424, 7, 67, 2, 2, 424, 425, 7, 75, 2, 2, 425, 426, 7, 80, + 2, 2, 426, 427, 7, 85, 2, 2, 427, 428, 7, 97, 2, 2, 428, 429, 7, 67, 2, + 2, 429, 430, 7, 78, 2, 2, 430, 432, 7, 78, 2, 2, 431, 395, 3, 2, 2, 2, + 431, 413, 3, 2, 2, 2, 432, 76, 3, 2, 2, 2, 433, 434, 7, 99, 2, 2, 434, + 435, 7, 116, 2, 2, 435, 436, 7, 116, 2, 2, 436, 437, 7, 99, 2, 2, 437, + 438, 7, 123, 2, 2, 438, 439, 7, 97, 2, 2, 439, 440, 7, 101, 2, 2, 440, + 441, 7, 113, 2, 2, 441, 442, 7, 112, 2, 2, 442, 443, 7, 118, 2, 2, 443, + 444, 7, 99, 2, 2, 444, 445, 7, 107, 2, 2, 445, 446, 7, 112, 2, 2, 446, + 447, 7, 117, 2, 2, 447, 448, 7, 97, 2, 2, 448, 449, 7, 99, 2, 2, 449, 450, + 7, 112, 2, 2, 450, 470, 7, 123, 2, 2, 451, 452, 7, 67, 2, 2, 452, 453, + 7, 84, 2, 2, 453, 454, 7, 84, 2, 2, 454, 455, 7, 67, 2, 2, 455, 456, 7, + 91, 2, 2, 456, 457, 7, 97, 2, 2, 457, 458, 7, 69, 2, 2, 458, 459, 7, 81, + 2, 2, 459, 460, 7, 80, 2, 2, 460, 461, 7, 86, 2, 2, 461, 462, 7, 67, 2, + 2, 462, 463, 7, 75, 2, 2, 463, 464, 7, 80, 2, 2, 464, 465, 7, 85, 2, 2, + 465, 466, 7, 97, 2, 2, 466, 467, 7, 67, 2, 2, 467, 468, 7, 80, 2, 2, 468, + 470, 7, 91, 2, 2, 469, 433, 3, 2, 2, 2, 469, 451, 3, 2, 2, 2, 470, 78, + 3, 2, 2, 2, 471, 472, 7, 99, 2, 2, 472, 473, 7, 116, 2, 2, 473, 474, 7, + 116, 2, 2, 474, 475, 7, 99, 2, 2, 475, 476, 7, 123, 2, 2, 476, 477, 7, + 97, 2, 2, 477, 478, 7, 110, 2, 2, 478, 479, 7, 103, 2, 2, 479, 480, 7, + 112, 2, 2, 480, 481, 7, 105, 2, 2, 481, 482, 7, 118, 2, 2, 482, 496, 7, + 106, 2, 2, 483, 484, 7, 67, 2, 2, 484, 485, 7, 84, 2, 2, 485, 486, 7, 84, + 2, 2, 486, 487, 7, 67, 2, 2, 487, 488, 7, 91, 2, 2, 488, 489, 7, 97, 2, + 2, 489, 490, 7, 78, 2, 2, 490, 491, 7, 71, 2, 2, 491, 492, 7, 80, 2, 2, + 492, 493, 7, 73, 2, 2, 493, 494, 7, 86, 2, 2, 494, 496, 7, 74, 2, 2, 495, + 471, 3, 2, 2, 2, 495, 483, 3, 2, 2, 2, 496, 80, 3, 2, 2, 2, 497, 498, 7, + 118, 2, 2, 498, 499, 7, 116, 2, 2, 499, 500, 7, 119, 2, 2, 500, 525, 7, + 103, 2, 2, 501, 502, 7, 86, 2, 2, 502, 503, 7, 116, 2, 2, 503, 504, 7, + 119, 2, 2, 504, 525, 7, 103, 2, 2, 505, 506, 7, 86, 2, 2, 506, 507, 7, + 84, 2, 2, 507, 508, 7, 87, 2, 2, 508, 525, 7, 71, 2, 2, 509, 510, 7, 104, + 2, 2, 510, 511, 7, 99, 2, 2, 511, 512, 7, 110, 2, 2, 512, 513, 7, 117, + 2, 2, 513, 525, 7, 103, 2, 2, 514, 515, 7, 72, 2, 2, 515, 516, 7, 99, 2, + 2, 516, 517, 7, 110, 2, 2, 517, 518, 7, 117, 2, 2, 518, 525, 7, 103, 2, + 2, 519, 520, 7, 72, 2, 2, 520, 521, 7, 67, 2, 2, 521, 522, 7, 78, 2, 2, + 522, 523, 7, 85, 2, 2, 523, 525, 7, 71, 2, 2, 524, 497, 3, 2, 2, 2, 524, + 501, 3, 2, 2, 2, 524, 505, 3, 2, 2, 2, 524, 509, 3, 2, 2, 2, 524, 514, + 3, 2, 2, 2, 524, 519, 3, 2, 2, 2, 525, 82, 3, 2, 2, 2, 526, 531, 5, 111, + 56, 2, 527, 531, 5, 113, 57, 2, 528, 531, 5, 115, 58, 2, 529, 531, 5, 109, + 55, 2, 530, 526, 3, 2, 2, 2, 530, 527, 3, 2, 2, 2, 530, 528, 3, 2, 2, 2, + 530, 529, 3, 2, 2, 2, 531, 84, 3, 2, 2, 2, 532, 535, 5, 127, 64, 2, 533, + 535, 5, 129, 65, 2, 534, 532, 3, 2, 2, 2, 534, 533, 3, 2, 2, 2, 535, 86, + 3, 2, 2, 2, 536, 541, 5, 105, 53, 2, 537, 540, 5, 105, 53, 2, 538, 540, + 5, 107, 54, 2, 539, 537, 3, 2, 2, 2, 539, 538, 3, 2, 2, 2, 540, 543, 3, + 2, 2, 2, 541, 539, 3, 2, 2, 2, 541, 542, 3, 2, 2, 2, 542, 88, 3, 2, 2, + 2, 543, 541, 3, 2, 2, 2, 544, 545, 7, 38, 2, 2, 545, 546, 7, 111, 2, 2, + 546, 547, 7, 103, 2, 2, 547, 548, 7, 118, 2, 2, 548, 549, 7, 99, 2, 2, + 549, 90, 3, 2, 2, 2, 550, 552, 5, 95, 48, 2, 551, 550, 3, 2, 2, 2, 551, + 552, 3, 2, 2, 2, 552, 563, 3, 2, 2, 2, 553, 555, 7, 36, 2, 2, 554, 556, + 5, 97, 49, 2, 555, 554, 3, 2, 2, 2, 555, 556, 3, 2, 2, 2, 556, 557, 3, + 2, 2, 2, 557, 564, 7, 36, 2, 2, 558, 560, 7, 41, 2, 2, 559, 561, 5, 99, + 50, 2, 560, 559, 3, 2, 2, 2, 560, 561, 3, 2, 2, 2, 561, 562, 3, 2, 2, 2, + 562, 564, 7, 41, 2, 2, 563, 553, 3, 2, 2, 2, 563, 558, 3, 2, 2, 2, 564, + 92, 3, 2, 2, 2, 565, 568, 5, 87, 44, 2, 566, 568, 5, 89, 45, 2, 567, 565, + 3, 2, 2, 2, 567, 566, 3, 2, 2, 2, 568, 576, 3, 2, 2, 2, 569, 572, 7, 93, + 2, 2, 570, 573, 5, 91, 46, 2, 571, 573, 5, 111, 56, 2, 572, 570, 3, 2, + 2, 2, 572, 571, 3, 2, 2, 2, 573, 574, 3, 2, 2, 2, 574, 575, 7, 95, 2, 2, + 575, 577, 3, 2, 2, 2, 576, 569, 3, 2, 2, 2, 577, 578, 3, 2, 2, 2, 578, + 576, 3, 2, 2, 2, 578, 579, 3, 2, 2, 2, 579, 94, 3, 2, 2, 2, 580, 581, 7, + 119, 2, 2, 581, 584, 7, 58, 2, 2, 582, 584, 9, 2, 2, 2, 583, 580, 3, 2, + 2, 2, 583, 582, 3, 2, 2, 2, 584, 96, 3, 2, 2, 2, 585, 587, 5, 101, 51, + 2, 586, 585, 3, 2, 2, 2, 587, 588, 3, 2, 2, 2, 588, 586, 3, 2, 2, 2, 588, + 589, 3, 2, 2, 2, 589, 98, 3, 2, 2, 2, 590, 592, 5, 103, 52, 2, 591, 590, + 3, 2, 2, 2, 592, 593, 3, 2, 2, 2, 593, 591, 3, 2, 2, 2, 593, 594, 3, 2, + 2, 2, 594, 100, 3, 2, 2, 2, 595, 603, 10, 3, 2, 2, 596, 603, 5, 143, 72, + 2, 597, 598, 7, 94, 2, 2, 598, 603, 7, 12, 2, 2, 599, 600, 7, 94, 2, 2, + 600, 601, 7, 15, 2, 2, 601, 603, 7, 12, 2, 2, 602, 595, 3, 2, 2, 2, 602, + 596, 3, 2, 2, 2, 602, 597, 3, 2, 2, 2, 602, 599, 3, 2, 2, 2, 603, 102, + 3, 2, 2, 2, 604, 612, 10, 4, 2, 2, 605, 612, 5, 143, 72, 2, 606, 607, 7, + 94, 2, 2, 607, 612, 7, 12, 2, 2, 608, 609, 7, 94, 2, 2, 609, 610, 7, 15, + 2, 2, 610, 612, 7, 12, 2, 2, 611, 604, 3, 2, 2, 2, 611, 605, 3, 2, 2, 2, + 611, 606, 3, 2, 2, 2, 611, 608, 3, 2, 2, 2, 612, 104, 3, 2, 2, 2, 613, + 614, 9, 5, 2, 2, 614, 106, 3, 2, 2, 2, 615, 616, 9, 6, 2, 2, 616, 108, + 3, 2, 2, 2, 617, 618, 7, 50, 2, 2, 618, 620, 9, 7, 2, 2, 619, 621, 9, 8, + 2, 2, 620, 619, 3, 2, 2, 2, 621, 622, 3, 2, 2, 2, 622, 620, 3, 2, 2, 2, + 622, 623, 3, 2, 2, 2, 623, 110, 3, 2, 2, 2, 624, 628, 5, 117, 59, 2, 625, + 627, 5, 107, 54, 2, 626, 625, 3, 2, 2, 2, 627, 630, 3, 2, 2, 2, 628, 626, + 3, 2, 2, 2, 628, 629, 3, 2, 2, 2, 629, 633, 3, 2, 2, 2, 630, 628, 3, 2, + 2, 2, 631, 633, 7, 50, 2, 2, 632, 624, 3, 2, 2, 2, 632, 631, 3, 2, 2, 2, + 633, 112, 3, 2, 2, 2, 634, 638, 7, 50, 2, 2, 635, 637, 5, 119, 60, 2, 636, + 635, 3, 2, 2, 2, 637, 640, 3, 2, 2, 2, 638, 636, 3, 2, 2, 2, 638, 639, + 3, 2, 2, 2, 639, 114, 3, 2, 2, 2, 640, 638, 3, 2, 2, 2, 641, 642, 7, 50, + 2, 2, 642, 643, 9, 9, 2, 2, 643, 644, 5, 139, 70, 2, 644, 116, 3, 2, 2, + 2, 645, 646, 9, 10, 2, 2, 646, 118, 3, 2, 2, 2, 647, 648, 9, 11, 2, 2, + 648, 120, 3, 2, 2, 2, 649, 650, 9, 12, 2, 2, 650, 122, 3, 2, 2, 2, 651, + 652, 5, 121, 61, 2, 652, 653, 5, 121, 61, 2, 653, 654, 5, 121, 61, 2, 654, + 655, 5, 121, 61, 2, 655, 124, 3, 2, 2, 2, 656, 657, 7, 94, 2, 2, 657, 658, + 7, 119, 2, 2, 658, 659, 3, 2, 2, 2, 659, 667, 5, 123, 62, 2, 660, 661, + 7, 94, 2, 2, 661, 662, 7, 87, 2, 2, 662, 663, 3, 2, 2, 2, 663, 664, 5, + 123, 62, 2, 664, 665, 5, 123, 62, 2, 665, 667, 3, 2, 2, 2, 666, 656, 3, + 2, 2, 2, 666, 660, 3, 2, 2, 2, 667, 126, 3, 2, 2, 2, 668, 670, 5, 131, + 66, 2, 669, 671, 5, 133, 67, 2, 670, 669, 3, 2, 2, 2, 670, 671, 3, 2, 2, + 2, 671, 676, 3, 2, 2, 2, 672, 673, 5, 135, 68, 2, 673, 674, 5, 133, 67, + 2, 674, 676, 3, 2, 2, 2, 675, 668, 3, 2, 2, 2, 675, 672, 3, 2, 2, 2, 676, + 128, 3, 2, 2, 2, 677, 678, 7, 50, 2, 2, 678, 681, 9, 9, 2, 2, 679, 682, + 5, 137, 69, 2, 680, 682, 5, 139, 70, 2, 681, 679, 3, 2, 2, 2, 681, 680, + 3, 2, 2, 2, 682, 683, 3, 2, 2, 2, 683, 684, 5, 141, 71, 2, 684, 130, 3, + 2, 2, 2, 685, 687, 5, 135, 68, 2, 686, 685, 3, 2, 2, 2, 686, 687, 3, 2, + 2, 2, 687, 688, 3, 2, 2, 2, 688, 689, 7, 48, 2, 2, 689, 694, 5, 135, 68, + 2, 690, 691, 5, 135, 68, 2, 691, 692, 7, 48, 2, 2, 692, 694, 3, 2, 2, 2, + 693, 686, 3, 2, 2, 2, 693, 690, 3, 2, 2, 2, 694, 132, 3, 2, 2, 2, 695, + 697, 9, 13, 2, 2, 696, 698, 9, 14, 2, 2, 697, 696, 3, 2, 2, 2, 697, 698, + 3, 2, 2, 2, 698, 699, 3, 2, 2, 2, 699, 700, 5, 135, 68, 2, 700, 134, 3, + 2, 2, 2, 701, 703, 5, 107, 54, 2, 702, 701, 3, 2, 2, 2, 703, 704, 3, 2, + 2, 2, 704, 702, 3, 2, 2, 2, 704, 705, 3, 2, 2, 2, 705, 136, 3, 2, 2, 2, + 706, 708, 5, 139, 70, 2, 707, 706, 3, 2, 2, 2, 707, 708, 3, 2, 2, 2, 708, + 709, 3, 2, 2, 2, 709, 710, 7, 48, 2, 2, 710, 715, 5, 139, 70, 2, 711, 712, + 5, 139, 70, 2, 712, 713, 7, 48, 2, 2, 713, 715, 3, 2, 2, 2, 714, 707, 3, + 2, 2, 2, 714, 711, 3, 2, 2, 2, 715, 138, 3, 2, 2, 2, 716, 718, 5, 121, + 61, 2, 717, 716, 3, 2, 2, 2, 718, 719, 3, 2, 2, 2, 719, 717, 3, 2, 2, 2, + 719, 720, 3, 2, 2, 2, 720, 140, 3, 2, 2, 2, 721, 723, 9, 15, 2, 2, 722, + 724, 9, 14, 2, 2, 723, 722, 3, 2, 2, 2, 723, 724, 3, 2, 2, 2, 724, 725, + 3, 2, 2, 2, 725, 726, 5, 135, 68, 2, 726, 142, 3, 2, 2, 2, 727, 728, 7, + 94, 2, 2, 728, 743, 9, 16, 2, 2, 729, 730, 7, 94, 2, 2, 730, 732, 5, 119, + 60, 2, 731, 733, 5, 119, 60, 2, 732, 731, 3, 2, 2, 2, 732, 733, 3, 2, 2, + 2, 733, 735, 3, 2, 2, 2, 734, 736, 5, 119, 60, 2, 735, 734, 3, 2, 2, 2, + 735, 736, 3, 2, 2, 2, 736, 743, 3, 2, 2, 2, 737, 738, 7, 94, 2, 2, 738, + 739, 7, 122, 2, 2, 739, 740, 3, 2, 2, 2, 740, 743, 5, 139, 70, 2, 741, + 743, 5, 125, 63, 2, 742, 727, 3, 2, 2, 2, 742, 729, 3, 2, 2, 2, 742, 737, + 3, 2, 2, 2, 742, 741, 3, 2, 2, 2, 743, 144, 3, 2, 2, 2, 744, 746, 9, 17, + 2, 2, 745, 744, 3, 2, 2, 2, 746, 747, 3, 2, 2, 2, 747, 745, 3, 2, 2, 2, + 747, 748, 3, 2, 2, 2, 748, 749, 3, 2, 2, 2, 749, 750, 8, 73, 2, 2, 750, + 146, 3, 2, 2, 2, 751, 753, 7, 15, 2, 2, 752, 754, 7, 12, 2, 2, 753, 752, + 3, 2, 2, 2, 753, 754, 3, 2, 2, 2, 754, 757, 3, 2, 2, 2, 755, 757, 7, 12, + 2, 2, 756, 751, 3, 2, 2, 2, 756, 755, 3, 2, 2, 2, 757, 758, 3, 2, 2, 2, + 758, 759, 8, 74, 2, 2, 759, 148, 3, 2, 2, 2, 57, 2, 187, 201, 233, 239, + 247, 253, 258, 260, 291, 327, 363, 393, 431, 469, 495, 524, 530, 534, 539, + 541, 551, 555, 560, 563, 567, 572, 578, 583, 588, 593, 602, 611, 622, 628, + 632, 638, 666, 670, 675, 681, 686, 693, 697, 704, 707, 714, 719, 723, 732, + 735, 742, 747, 753, 756, 3, 8, 2, 2, } var lexerChannelNames = []string{ @@ -368,35 +371,36 @@ var lexerModeNames = []string{ } var lexerLiteralNames = []string{ - "", "'('", "')'", "'['", "','", "']'", "'<'", "'<='", "'>'", "'>='", "'=='", - "'!='", "", "", "'+'", "'-'", "'*'", "'/'", "'%'", "'**'", "'<<'", "'>>'", - "'&'", "'|'", "'^'", "", "", "'~'", "", "'in'", "'not in'", + "", "'('", "')'", "'['", "','", "']'", "'{'", "'}'", "'<'", "'<='", "'>'", + "'>='", "'=='", "'!='", "", "", "'+'", "'-'", "'*'", "'/'", "'%'", "'**'", + "'<<'", "'>>'", "'&'", "'|'", "'^'", "", "", "'~'", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "'$meta'", } var lexerSymbolicNames = []string{ - "", "", "", "", "", "", "LT", "LE", "GT", "GE", "EQ", "NE", "LIKE", "EXISTS", - "ADD", "SUB", "MUL", "DIV", "MOD", "POW", "SHL", "SHR", "BAND", "BOR", - "BXOR", "AND", "OR", "BNOT", "NOT", "IN", "NIN", "EmptyTerm", "JSONContains", - "JSONContainsAll", "JSONContainsAny", "ArrayContains", "ArrayContainsAll", - "ArrayContainsAny", "ArrayLength", "BooleanConstant", "IntegerConstant", - "FloatingConstant", "Identifier", "StringLiteral", "JSONIdentifier", "Whitespace", - "Newline", + "", "", "", "", "", "", "LBRACE", "RBRACE", "LT", "LE", "GT", "GE", "EQ", + "NE", "LIKE", "EXISTS", "ADD", "SUB", "MUL", "DIV", "MOD", "POW", "SHL", + "SHR", "BAND", "BOR", "BXOR", "AND", "OR", "BNOT", "NOT", "IN", "EmptyArray", + "JSONContains", "JSONContainsAll", "JSONContainsAny", "ArrayContains", + "ArrayContainsAll", "ArrayContainsAny", "ArrayLength", "BooleanConstant", + "IntegerConstant", "FloatingConstant", "Identifier", "Meta", "StringLiteral", + "JSONIdentifier", "Whitespace", "Newline", } var lexerRuleNames = []string{ - "T__0", "T__1", "T__2", "T__3", "T__4", "LT", "LE", "GT", "GE", "EQ", "NE", - "LIKE", "EXISTS", "ADD", "SUB", "MUL", "DIV", "MOD", "POW", "SHL", "SHR", - "BAND", "BOR", "BXOR", "AND", "OR", "BNOT", "NOT", "IN", "NIN", "EmptyTerm", - "JSONContains", "JSONContainsAll", "JSONContainsAny", "ArrayContains", - "ArrayContainsAll", "ArrayContainsAny", "ArrayLength", "BooleanConstant", - "IntegerConstant", "FloatingConstant", "Identifier", "StringLiteral", "JSONIdentifier", - "EncodingPrefix", "DoubleSCharSequence", "SingleSCharSequence", "DoubleSChar", - "SingleSChar", "Nondigit", "Digit", "BinaryConstant", "DecimalConstant", - "OctalConstant", "HexadecimalConstant", "NonzeroDigit", "OctalDigit", "HexadecimalDigit", - "HexQuad", "UniversalCharacterName", "DecimalFloatingConstant", "HexadecimalFloatingConstant", - "FractionalConstant", "ExponentPart", "DigitSequence", "HexadecimalFractionalConstant", - "HexadecimalDigitSequence", "BinaryExponentPart", "EscapeSequence", "Whitespace", - "Newline", + "T__0", "T__1", "T__2", "T__3", "T__4", "LBRACE", "RBRACE", "LT", "LE", + "GT", "GE", "EQ", "NE", "LIKE", "EXISTS", "ADD", "SUB", "MUL", "DIV", "MOD", + "POW", "SHL", "SHR", "BAND", "BOR", "BXOR", "AND", "OR", "BNOT", "NOT", + "IN", "EmptyArray", "JSONContains", "JSONContainsAll", "JSONContainsAny", + "ArrayContains", "ArrayContainsAll", "ArrayContainsAny", "ArrayLength", + "BooleanConstant", "IntegerConstant", "FloatingConstant", "Identifier", + "Meta", "StringLiteral", "JSONIdentifier", "EncodingPrefix", "DoubleSCharSequence", + "SingleSCharSequence", "DoubleSChar", "SingleSChar", "Nondigit", "Digit", + "BinaryConstant", "DecimalConstant", "OctalConstant", "HexadecimalConstant", + "NonzeroDigit", "OctalDigit", "HexadecimalDigit", "HexQuad", "UniversalCharacterName", + "DecimalFloatingConstant", "HexadecimalFloatingConstant", "FractionalConstant", + "ExponentPart", "DigitSequence", "HexadecimalFractionalConstant", "HexadecimalDigitSequence", + "BinaryExponentPart", "EscapeSequence", "Whitespace", "Newline", } type PlanLexer struct { @@ -441,45 +445,47 @@ const ( PlanLexerT__2 = 3 PlanLexerT__3 = 4 PlanLexerT__4 = 5 - PlanLexerLT = 6 - PlanLexerLE = 7 - PlanLexerGT = 8 - PlanLexerGE = 9 - PlanLexerEQ = 10 - PlanLexerNE = 11 - PlanLexerLIKE = 12 - PlanLexerEXISTS = 13 - PlanLexerADD = 14 - PlanLexerSUB = 15 - PlanLexerMUL = 16 - PlanLexerDIV = 17 - PlanLexerMOD = 18 - PlanLexerPOW = 19 - PlanLexerSHL = 20 - PlanLexerSHR = 21 - PlanLexerBAND = 22 - PlanLexerBOR = 23 - PlanLexerBXOR = 24 - PlanLexerAND = 25 - PlanLexerOR = 26 - PlanLexerBNOT = 27 - PlanLexerNOT = 28 - PlanLexerIN = 29 - PlanLexerNIN = 30 - PlanLexerEmptyTerm = 31 - PlanLexerJSONContains = 32 - PlanLexerJSONContainsAll = 33 - PlanLexerJSONContainsAny = 34 - PlanLexerArrayContains = 35 - PlanLexerArrayContainsAll = 36 - PlanLexerArrayContainsAny = 37 - PlanLexerArrayLength = 38 - PlanLexerBooleanConstant = 39 - PlanLexerIntegerConstant = 40 - PlanLexerFloatingConstant = 41 - PlanLexerIdentifier = 42 - PlanLexerStringLiteral = 43 - PlanLexerJSONIdentifier = 44 - PlanLexerWhitespace = 45 - PlanLexerNewline = 46 + PlanLexerLBRACE = 6 + PlanLexerRBRACE = 7 + PlanLexerLT = 8 + PlanLexerLE = 9 + PlanLexerGT = 10 + PlanLexerGE = 11 + PlanLexerEQ = 12 + PlanLexerNE = 13 + PlanLexerLIKE = 14 + PlanLexerEXISTS = 15 + PlanLexerADD = 16 + PlanLexerSUB = 17 + PlanLexerMUL = 18 + PlanLexerDIV = 19 + PlanLexerMOD = 20 + PlanLexerPOW = 21 + PlanLexerSHL = 22 + PlanLexerSHR = 23 + PlanLexerBAND = 24 + PlanLexerBOR = 25 + PlanLexerBXOR = 26 + PlanLexerAND = 27 + PlanLexerOR = 28 + PlanLexerBNOT = 29 + PlanLexerNOT = 30 + PlanLexerIN = 31 + PlanLexerEmptyArray = 32 + PlanLexerJSONContains = 33 + PlanLexerJSONContainsAll = 34 + PlanLexerJSONContainsAny = 35 + PlanLexerArrayContains = 36 + PlanLexerArrayContainsAll = 37 + PlanLexerArrayContainsAny = 38 + PlanLexerArrayLength = 39 + PlanLexerBooleanConstant = 40 + PlanLexerIntegerConstant = 41 + PlanLexerFloatingConstant = 42 + PlanLexerIdentifier = 43 + PlanLexerMeta = 44 + PlanLexerStringLiteral = 45 + PlanLexerJSONIdentifier = 46 + PlanLexerWhitespace = 47 + PlanLexerNewline = 48 ) diff --git a/internal/parser/planparserv2/generated/plan_parser.go b/internal/parser/planparserv2/generated/plan_parser.go index 53ed5f70cfc40..ae70c00983cc1 100644 --- a/internal/parser/planparserv2/generated/plan_parser.go +++ b/internal/parser/planparserv2/generated/plan_parser.go @@ -15,83 +15,80 @@ var _ = reflect.Copy var _ = strconv.Itoa var parserATN = []uint16{ - 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 48, 131, + 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 50, 122, 4, 2, 9, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, - 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 20, 10, 2, 12, 2, 14, 2, 23, 11, 2, - 3, 2, 5, 2, 26, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, + 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 23, 10, 2, 12, 2, + 14, 2, 26, 11, 2, 3, 2, 5, 2, 29, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, - 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, - 59, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, + 3, 2, 3, 2, 3, 2, 5, 2, 63, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, + 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 79, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, - 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 113, 10, 2, 12, 2, 14, 2, 116, - 11, 2, 3, 2, 5, 2, 119, 10, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, 126, - 10, 2, 12, 2, 14, 2, 129, 11, 2, 3, 2, 2, 3, 2, 3, 2, 2, 15, 4, 2, 16, - 17, 29, 30, 4, 2, 34, 34, 37, 37, 4, 2, 35, 35, 38, 38, 4, 2, 36, 36, 39, - 39, 4, 2, 44, 44, 46, 46, 3, 2, 18, 20, 3, 2, 16, 17, 3, 2, 22, 23, 3, - 2, 8, 9, 3, 2, 10, 11, 3, 2, 8, 11, 3, 2, 12, 13, 3, 2, 31, 32, 2, 162, - 2, 58, 3, 2, 2, 2, 4, 5, 8, 2, 1, 2, 5, 59, 7, 42, 2, 2, 6, 59, 7, 43, - 2, 2, 7, 59, 7, 41, 2, 2, 8, 59, 7, 45, 2, 2, 9, 59, 7, 44, 2, 2, 10, 59, - 7, 46, 2, 2, 11, 12, 7, 3, 2, 2, 12, 13, 5, 2, 2, 2, 13, 14, 7, 4, 2, 2, - 14, 59, 3, 2, 2, 2, 15, 16, 7, 5, 2, 2, 16, 21, 5, 2, 2, 2, 17, 18, 7, - 6, 2, 2, 18, 20, 5, 2, 2, 2, 19, 17, 3, 2, 2, 2, 20, 23, 3, 2, 2, 2, 21, - 19, 3, 2, 2, 2, 21, 22, 3, 2, 2, 2, 22, 25, 3, 2, 2, 2, 23, 21, 3, 2, 2, - 2, 24, 26, 7, 6, 2, 2, 25, 24, 3, 2, 2, 2, 25, 26, 3, 2, 2, 2, 26, 27, - 3, 2, 2, 2, 27, 28, 7, 7, 2, 2, 28, 59, 3, 2, 2, 2, 29, 30, 9, 2, 2, 2, - 30, 59, 5, 2, 2, 22, 31, 32, 9, 3, 2, 2, 32, 33, 7, 3, 2, 2, 33, 34, 5, - 2, 2, 2, 34, 35, 7, 6, 2, 2, 35, 36, 5, 2, 2, 2, 36, 37, 7, 4, 2, 2, 37, - 59, 3, 2, 2, 2, 38, 39, 9, 4, 2, 2, 39, 40, 7, 3, 2, 2, 40, 41, 5, 2, 2, - 2, 41, 42, 7, 6, 2, 2, 42, 43, 5, 2, 2, 2, 43, 44, 7, 4, 2, 2, 44, 59, - 3, 2, 2, 2, 45, 46, 9, 5, 2, 2, 46, 47, 7, 3, 2, 2, 47, 48, 5, 2, 2, 2, - 48, 49, 7, 6, 2, 2, 49, 50, 5, 2, 2, 2, 50, 51, 7, 4, 2, 2, 51, 59, 3, - 2, 2, 2, 52, 53, 7, 40, 2, 2, 53, 54, 7, 3, 2, 2, 54, 55, 9, 6, 2, 2, 55, - 59, 7, 4, 2, 2, 56, 57, 7, 15, 2, 2, 57, 59, 5, 2, 2, 3, 58, 4, 3, 2, 2, - 2, 58, 6, 3, 2, 2, 2, 58, 7, 3, 2, 2, 2, 58, 8, 3, 2, 2, 2, 58, 9, 3, 2, - 2, 2, 58, 10, 3, 2, 2, 2, 58, 11, 3, 2, 2, 2, 58, 15, 3, 2, 2, 2, 58, 29, - 3, 2, 2, 2, 58, 31, 3, 2, 2, 2, 58, 38, 3, 2, 2, 2, 58, 45, 3, 2, 2, 2, - 58, 52, 3, 2, 2, 2, 58, 56, 3, 2, 2, 2, 59, 127, 3, 2, 2, 2, 60, 61, 12, - 23, 2, 2, 61, 62, 7, 21, 2, 2, 62, 126, 5, 2, 2, 24, 63, 64, 12, 21, 2, - 2, 64, 65, 9, 7, 2, 2, 65, 126, 5, 2, 2, 22, 66, 67, 12, 20, 2, 2, 67, - 68, 9, 8, 2, 2, 68, 126, 5, 2, 2, 21, 69, 70, 12, 19, 2, 2, 70, 71, 9, - 9, 2, 2, 71, 126, 5, 2, 2, 20, 72, 73, 12, 12, 2, 2, 73, 74, 9, 10, 2, - 2, 74, 75, 9, 6, 2, 2, 75, 76, 9, 10, 2, 2, 76, 126, 5, 2, 2, 13, 77, 78, - 12, 11, 2, 2, 78, 79, 9, 11, 2, 2, 79, 80, 9, 6, 2, 2, 80, 81, 9, 11, 2, - 2, 81, 126, 5, 2, 2, 12, 82, 83, 12, 10, 2, 2, 83, 84, 9, 12, 2, 2, 84, - 126, 5, 2, 2, 11, 85, 86, 12, 9, 2, 2, 86, 87, 9, 13, 2, 2, 87, 126, 5, - 2, 2, 10, 88, 89, 12, 8, 2, 2, 89, 90, 7, 24, 2, 2, 90, 126, 5, 2, 2, 9, - 91, 92, 12, 7, 2, 2, 92, 93, 7, 26, 2, 2, 93, 126, 5, 2, 2, 8, 94, 95, - 12, 6, 2, 2, 95, 96, 7, 25, 2, 2, 96, 126, 5, 2, 2, 7, 97, 98, 12, 5, 2, - 2, 98, 99, 7, 27, 2, 2, 99, 126, 5, 2, 2, 6, 100, 101, 12, 4, 2, 2, 101, - 102, 7, 28, 2, 2, 102, 126, 5, 2, 2, 5, 103, 104, 12, 24, 2, 2, 104, 105, - 7, 14, 2, 2, 105, 126, 7, 45, 2, 2, 106, 107, 12, 18, 2, 2, 107, 108, 9, - 14, 2, 2, 108, 109, 7, 5, 2, 2, 109, 114, 5, 2, 2, 2, 110, 111, 7, 6, 2, - 2, 111, 113, 5, 2, 2, 2, 112, 110, 3, 2, 2, 2, 113, 116, 3, 2, 2, 2, 114, - 112, 3, 2, 2, 2, 114, 115, 3, 2, 2, 2, 115, 118, 3, 2, 2, 2, 116, 114, - 3, 2, 2, 2, 117, 119, 7, 6, 2, 2, 118, 117, 3, 2, 2, 2, 118, 119, 3, 2, - 2, 2, 119, 120, 3, 2, 2, 2, 120, 121, 7, 7, 2, 2, 121, 126, 3, 2, 2, 2, - 122, 123, 12, 17, 2, 2, 123, 124, 9, 14, 2, 2, 124, 126, 7, 33, 2, 2, 125, - 60, 3, 2, 2, 2, 125, 63, 3, 2, 2, 2, 125, 66, 3, 2, 2, 2, 125, 69, 3, 2, - 2, 2, 125, 72, 3, 2, 2, 2, 125, 77, 3, 2, 2, 2, 125, 82, 3, 2, 2, 2, 125, - 85, 3, 2, 2, 2, 125, 88, 3, 2, 2, 2, 125, 91, 3, 2, 2, 2, 125, 94, 3, 2, - 2, 2, 125, 97, 3, 2, 2, 2, 125, 100, 3, 2, 2, 2, 125, 103, 3, 2, 2, 2, - 125, 106, 3, 2, 2, 2, 125, 122, 3, 2, 2, 2, 126, 129, 3, 2, 2, 2, 127, - 125, 3, 2, 2, 2, 127, 128, 3, 2, 2, 2, 128, 3, 3, 2, 2, 2, 129, 127, 3, - 2, 2, 2, 9, 21, 25, 58, 114, 118, 125, 127, + 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 7, 2, + 117, 10, 2, 12, 2, 14, 2, 120, 11, 2, 3, 2, 2, 3, 2, 3, 2, 2, 15, 3, 2, + 45, 46, 4, 2, 18, 19, 31, 32, 4, 2, 35, 35, 38, 38, 4, 2, 36, 36, 39, 39, + 4, 2, 37, 37, 40, 40, 4, 2, 45, 45, 48, 48, 3, 2, 20, 22, 3, 2, 18, 19, + 3, 2, 24, 25, 3, 2, 10, 11, 3, 2, 12, 13, 3, 2, 10, 13, 3, 2, 14, 15, 2, + 153, 2, 62, 3, 2, 2, 2, 4, 5, 8, 2, 1, 2, 5, 63, 7, 43, 2, 2, 6, 63, 7, + 44, 2, 2, 7, 63, 7, 42, 2, 2, 8, 63, 7, 47, 2, 2, 9, 63, 9, 2, 2, 2, 10, + 63, 7, 48, 2, 2, 11, 12, 7, 8, 2, 2, 12, 13, 7, 45, 2, 2, 13, 63, 7, 9, + 2, 2, 14, 15, 7, 3, 2, 2, 15, 16, 5, 2, 2, 2, 16, 17, 7, 4, 2, 2, 17, 63, + 3, 2, 2, 2, 18, 19, 7, 5, 2, 2, 19, 24, 5, 2, 2, 2, 20, 21, 7, 6, 2, 2, + 21, 23, 5, 2, 2, 2, 22, 20, 3, 2, 2, 2, 23, 26, 3, 2, 2, 2, 24, 22, 3, + 2, 2, 2, 24, 25, 3, 2, 2, 2, 25, 28, 3, 2, 2, 2, 26, 24, 3, 2, 2, 2, 27, + 29, 7, 6, 2, 2, 28, 27, 3, 2, 2, 2, 28, 29, 3, 2, 2, 2, 29, 30, 3, 2, 2, + 2, 30, 31, 7, 7, 2, 2, 31, 63, 3, 2, 2, 2, 32, 63, 7, 34, 2, 2, 33, 34, + 9, 3, 2, 2, 34, 63, 5, 2, 2, 21, 35, 36, 9, 4, 2, 2, 36, 37, 7, 3, 2, 2, + 37, 38, 5, 2, 2, 2, 38, 39, 7, 6, 2, 2, 39, 40, 5, 2, 2, 2, 40, 41, 7, + 4, 2, 2, 41, 63, 3, 2, 2, 2, 42, 43, 9, 5, 2, 2, 43, 44, 7, 3, 2, 2, 44, + 45, 5, 2, 2, 2, 45, 46, 7, 6, 2, 2, 46, 47, 5, 2, 2, 2, 47, 48, 7, 4, 2, + 2, 48, 63, 3, 2, 2, 2, 49, 50, 9, 6, 2, 2, 50, 51, 7, 3, 2, 2, 51, 52, + 5, 2, 2, 2, 52, 53, 7, 6, 2, 2, 53, 54, 5, 2, 2, 2, 54, 55, 7, 4, 2, 2, + 55, 63, 3, 2, 2, 2, 56, 57, 7, 41, 2, 2, 57, 58, 7, 3, 2, 2, 58, 59, 9, + 7, 2, 2, 59, 63, 7, 4, 2, 2, 60, 61, 7, 17, 2, 2, 61, 63, 5, 2, 2, 3, 62, + 4, 3, 2, 2, 2, 62, 6, 3, 2, 2, 2, 62, 7, 3, 2, 2, 2, 62, 8, 3, 2, 2, 2, + 62, 9, 3, 2, 2, 2, 62, 10, 3, 2, 2, 2, 62, 11, 3, 2, 2, 2, 62, 14, 3, 2, + 2, 2, 62, 18, 3, 2, 2, 2, 62, 32, 3, 2, 2, 2, 62, 33, 3, 2, 2, 2, 62, 35, + 3, 2, 2, 2, 62, 42, 3, 2, 2, 2, 62, 49, 3, 2, 2, 2, 62, 56, 3, 2, 2, 2, + 62, 60, 3, 2, 2, 2, 63, 118, 3, 2, 2, 2, 64, 65, 12, 22, 2, 2, 65, 66, + 7, 23, 2, 2, 66, 117, 5, 2, 2, 23, 67, 68, 12, 20, 2, 2, 68, 69, 9, 8, + 2, 2, 69, 117, 5, 2, 2, 21, 70, 71, 12, 19, 2, 2, 71, 72, 9, 9, 2, 2, 72, + 117, 5, 2, 2, 20, 73, 74, 12, 18, 2, 2, 74, 75, 9, 10, 2, 2, 75, 117, 5, + 2, 2, 19, 76, 78, 12, 17, 2, 2, 77, 79, 7, 32, 2, 2, 78, 77, 3, 2, 2, 2, + 78, 79, 3, 2, 2, 2, 79, 80, 3, 2, 2, 2, 80, 81, 7, 33, 2, 2, 81, 117, 5, + 2, 2, 18, 82, 83, 12, 12, 2, 2, 83, 84, 9, 11, 2, 2, 84, 85, 9, 7, 2, 2, + 85, 86, 9, 11, 2, 2, 86, 117, 5, 2, 2, 13, 87, 88, 12, 11, 2, 2, 88, 89, + 9, 12, 2, 2, 89, 90, 9, 7, 2, 2, 90, 91, 9, 12, 2, 2, 91, 117, 5, 2, 2, + 12, 92, 93, 12, 10, 2, 2, 93, 94, 9, 13, 2, 2, 94, 117, 5, 2, 2, 11, 95, + 96, 12, 9, 2, 2, 96, 97, 9, 14, 2, 2, 97, 117, 5, 2, 2, 10, 98, 99, 12, + 8, 2, 2, 99, 100, 7, 26, 2, 2, 100, 117, 5, 2, 2, 9, 101, 102, 12, 7, 2, + 2, 102, 103, 7, 28, 2, 2, 103, 117, 5, 2, 2, 8, 104, 105, 12, 6, 2, 2, + 105, 106, 7, 27, 2, 2, 106, 117, 5, 2, 2, 7, 107, 108, 12, 5, 2, 2, 108, + 109, 7, 29, 2, 2, 109, 117, 5, 2, 2, 6, 110, 111, 12, 4, 2, 2, 111, 112, + 7, 30, 2, 2, 112, 117, 5, 2, 2, 5, 113, 114, 12, 23, 2, 2, 114, 115, 7, + 16, 2, 2, 115, 117, 7, 47, 2, 2, 116, 64, 3, 2, 2, 2, 116, 67, 3, 2, 2, + 2, 116, 70, 3, 2, 2, 2, 116, 73, 3, 2, 2, 2, 116, 76, 3, 2, 2, 2, 116, + 82, 3, 2, 2, 2, 116, 87, 3, 2, 2, 2, 116, 92, 3, 2, 2, 2, 116, 95, 3, 2, + 2, 2, 116, 98, 3, 2, 2, 2, 116, 101, 3, 2, 2, 2, 116, 104, 3, 2, 2, 2, + 116, 107, 3, 2, 2, 2, 116, 110, 3, 2, 2, 2, 116, 113, 3, 2, 2, 2, 117, + 120, 3, 2, 2, 2, 118, 116, 3, 2, 2, 2, 118, 119, 3, 2, 2, 2, 119, 3, 3, + 2, 2, 2, 120, 118, 3, 2, 2, 2, 8, 24, 28, 62, 78, 116, 118, } var literalNames = []string{ - "", "'('", "')'", "'['", "','", "']'", "'<'", "'<='", "'>'", "'>='", "'=='", - "'!='", "", "", "'+'", "'-'", "'*'", "'/'", "'%'", "'**'", "'<<'", "'>>'", - "'&'", "'|'", "'^'", "", "", "'~'", "", "'in'", "'not in'", + "", "'('", "')'", "'['", "','", "']'", "'{'", "'}'", "'<'", "'<='", "'>'", + "'>='", "'=='", "'!='", "", "", "'+'", "'-'", "'*'", "'/'", "'%'", "'**'", + "'<<'", "'>>'", "'&'", "'|'", "'^'", "", "", "'~'", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "'$meta'", } var symbolicNames = []string{ - "", "", "", "", "", "", "LT", "LE", "GT", "GE", "EQ", "NE", "LIKE", "EXISTS", - "ADD", "SUB", "MUL", "DIV", "MOD", "POW", "SHL", "SHR", "BAND", "BOR", - "BXOR", "AND", "OR", "BNOT", "NOT", "IN", "NIN", "EmptyTerm", "JSONContains", - "JSONContainsAll", "JSONContainsAny", "ArrayContains", "ArrayContainsAll", - "ArrayContainsAny", "ArrayLength", "BooleanConstant", "IntegerConstant", - "FloatingConstant", "Identifier", "StringLiteral", "JSONIdentifier", "Whitespace", - "Newline", + "", "", "", "", "", "", "LBRACE", "RBRACE", "LT", "LE", "GT", "GE", "EQ", + "NE", "LIKE", "EXISTS", "ADD", "SUB", "MUL", "DIV", "MOD", "POW", "SHL", + "SHR", "BAND", "BOR", "BXOR", "AND", "OR", "BNOT", "NOT", "IN", "EmptyArray", + "JSONContains", "JSONContainsAll", "JSONContainsAny", "ArrayContains", + "ArrayContainsAll", "ArrayContainsAny", "ArrayLength", "BooleanConstant", + "IntegerConstant", "FloatingConstant", "Identifier", "Meta", "StringLiteral", + "JSONIdentifier", "Whitespace", "Newline", } var ruleNames = []string{ @@ -135,47 +132,49 @@ const ( PlanParserT__2 = 3 PlanParserT__3 = 4 PlanParserT__4 = 5 - PlanParserLT = 6 - PlanParserLE = 7 - PlanParserGT = 8 - PlanParserGE = 9 - PlanParserEQ = 10 - PlanParserNE = 11 - PlanParserLIKE = 12 - PlanParserEXISTS = 13 - PlanParserADD = 14 - PlanParserSUB = 15 - PlanParserMUL = 16 - PlanParserDIV = 17 - PlanParserMOD = 18 - PlanParserPOW = 19 - PlanParserSHL = 20 - PlanParserSHR = 21 - PlanParserBAND = 22 - PlanParserBOR = 23 - PlanParserBXOR = 24 - PlanParserAND = 25 - PlanParserOR = 26 - PlanParserBNOT = 27 - PlanParserNOT = 28 - PlanParserIN = 29 - PlanParserNIN = 30 - PlanParserEmptyTerm = 31 - PlanParserJSONContains = 32 - PlanParserJSONContainsAll = 33 - PlanParserJSONContainsAny = 34 - PlanParserArrayContains = 35 - PlanParserArrayContainsAll = 36 - PlanParserArrayContainsAny = 37 - PlanParserArrayLength = 38 - PlanParserBooleanConstant = 39 - PlanParserIntegerConstant = 40 - PlanParserFloatingConstant = 41 - PlanParserIdentifier = 42 - PlanParserStringLiteral = 43 - PlanParserJSONIdentifier = 44 - PlanParserWhitespace = 45 - PlanParserNewline = 46 + PlanParserLBRACE = 6 + PlanParserRBRACE = 7 + PlanParserLT = 8 + PlanParserLE = 9 + PlanParserGT = 10 + PlanParserGE = 11 + PlanParserEQ = 12 + PlanParserNE = 13 + PlanParserLIKE = 14 + PlanParserEXISTS = 15 + PlanParserADD = 16 + PlanParserSUB = 17 + PlanParserMUL = 18 + PlanParserDIV = 19 + PlanParserMOD = 20 + PlanParserPOW = 21 + PlanParserSHL = 22 + PlanParserSHR = 23 + PlanParserBAND = 24 + PlanParserBOR = 25 + PlanParserBXOR = 26 + PlanParserAND = 27 + PlanParserOR = 28 + PlanParserBNOT = 29 + PlanParserNOT = 30 + PlanParserIN = 31 + PlanParserEmptyArray = 32 + PlanParserJSONContains = 33 + PlanParserJSONContainsAll = 34 + PlanParserJSONContainsAny = 35 + PlanParserArrayContains = 36 + PlanParserArrayContainsAll = 37 + PlanParserArrayContainsAny = 38 + PlanParserArrayLength = 39 + PlanParserBooleanConstant = 40 + PlanParserIntegerConstant = 41 + PlanParserFloatingConstant = 42 + PlanParserIdentifier = 43 + PlanParserMeta = 44 + PlanParserStringLiteral = 45 + PlanParserJSONIdentifier = 46 + PlanParserWhitespace = 47 + PlanParserNewline = 48 ) // PlanParserRULE_expr is the PlanParser rule. @@ -569,6 +568,10 @@ func (s *IdentifierContext) Identifier() antlr.TerminalNode { return s.GetToken(PlanParserIdentifier, 0) } +func (s *IdentifierContext) Meta() antlr.TerminalNode { + return s.GetToken(PlanParserMeta, 0) +} + func (s *IdentifierContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case PlanVisitor: @@ -680,6 +683,46 @@ func (s *LogicalAndContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } +type TemplateVariableContext struct { + *ExprContext +} + +func NewTemplateVariableContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *TemplateVariableContext { + var p = new(TemplateVariableContext) + + p.ExprContext = NewEmptyExprContext() + p.parser = parser + p.CopyFrom(ctx.(*ExprContext)) + + return p +} + +func (s *TemplateVariableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TemplateVariableContext) LBRACE() antlr.TerminalNode { + return s.GetToken(PlanParserLBRACE, 0) +} + +func (s *TemplateVariableContext) Identifier() antlr.TerminalNode { + return s.GetToken(PlanParserIdentifier, 0) +} + +func (s *TemplateVariableContext) RBRACE() antlr.TerminalNode { + return s.GetToken(PlanParserRBRACE, 0) +} + +func (s *TemplateVariableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PlanVisitor: + return t.VisitTemplateVariable(s) + + default: + return t.VisitChildren(s) + } +} + type EqualityContext struct { *ExprContext op antlr.Token @@ -980,6 +1023,38 @@ func (s *BitOrContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } +type EmptyArrayContext struct { + *ExprContext +} + +func NewEmptyArrayContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *EmptyArrayContext { + var p = new(EmptyArrayContext) + + p.ExprContext = NewEmptyExprContext() + p.parser = parser + p.CopyFrom(ctx.(*ExprContext)) + + return p +} + +func (s *EmptyArrayContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *EmptyArrayContext) EmptyArray() antlr.TerminalNode { + return s.GetToken(PlanParserEmptyArray, 0) +} + +func (s *EmptyArrayContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PlanVisitor: + return t.VisitEmptyArray(s) + + default: + return t.VisitChildren(s) + } +} + type AddSubContext struct { *ExprContext op antlr.Token @@ -1206,8 +1281,8 @@ func (s *TermContext) IN() antlr.TerminalNode { return s.GetToken(PlanParserIN, 0) } -func (s *TermContext) NIN() antlr.TerminalNode { - return s.GetToken(PlanParserNIN, 0) +func (s *TermContext) NOT() antlr.TerminalNode { + return s.GetToken(PlanParserNOT, 0) } func (s *TermContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { @@ -1717,61 +1792,6 @@ func (s *BitAndContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { } } -type EmptyTermContext struct { - *ExprContext - op antlr.Token -} - -func NewEmptyTermContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *EmptyTermContext { - var p = new(EmptyTermContext) - - p.ExprContext = NewEmptyExprContext() - p.parser = parser - p.CopyFrom(ctx.(*ExprContext)) - - return p -} - -func (s *EmptyTermContext) GetOp() antlr.Token { return s.op } - -func (s *EmptyTermContext) SetOp(v antlr.Token) { s.op = v } - -func (s *EmptyTermContext) GetRuleContext() antlr.RuleContext { - return s -} - -func (s *EmptyTermContext) Expr() IExprContext { - var t = s.GetTypedRuleContext(reflect.TypeOf((*IExprContext)(nil)).Elem(), 0) - - if t == nil { - return nil - } - - return t.(IExprContext) -} - -func (s *EmptyTermContext) EmptyTerm() antlr.TerminalNode { - return s.GetToken(PlanParserEmptyTerm, 0) -} - -func (s *EmptyTermContext) IN() antlr.TerminalNode { - return s.GetToken(PlanParserIN, 0) -} - -func (s *EmptyTermContext) NIN() antlr.TerminalNode { - return s.GetToken(PlanParserNIN, 0) -} - -func (s *EmptyTermContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { - switch t := visitor.(type) { - case PlanVisitor: - return t.VisitEmptyTerm(s) - - default: - return t.VisitChildren(s) - } -} - type PowerContext struct { *ExprContext } @@ -1860,7 +1880,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(56) + p.SetState(60) p.GetErrorHandler().Sync(p) switch p.GetTokenStream().LA(1) { @@ -1901,13 +1921,20 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { p.Match(PlanParserStringLiteral) } - case PlanParserIdentifier: + case PlanParserIdentifier, PlanParserMeta: localctx = NewIdentifierContext(p, localctx) p.SetParserRuleContext(localctx) _prevctx = localctx { p.SetState(7) - p.Match(PlanParserIdentifier) + _la = p.GetTokenStream().LA(1) + + if !(_la == PlanParserIdentifier || _la == PlanParserMeta) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } } case PlanParserJSONIdentifier: @@ -1919,20 +1946,37 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { p.Match(PlanParserJSONIdentifier) } + case PlanParserLBRACE: + localctx = NewTemplateVariableContext(p, localctx) + p.SetParserRuleContext(localctx) + _prevctx = localctx + { + p.SetState(9) + p.Match(PlanParserLBRACE) + } + { + p.SetState(10) + p.Match(PlanParserIdentifier) + } + { + p.SetState(11) + p.Match(PlanParserRBRACE) + } + case PlanParserT__0: localctx = NewParensContext(p, localctx) p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(9) + p.SetState(12) p.Match(PlanParserT__0) } { - p.SetState(10) + p.SetState(13) p.expr(0) } { - p.SetState(11) + p.SetState(14) p.Match(PlanParserT__1) } @@ -1941,55 +1985,64 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(13) + p.SetState(16) p.Match(PlanParserT__2) } { - p.SetState(14) + p.SetState(17) p.expr(0) } - p.SetState(19) + p.SetState(22) p.GetErrorHandler().Sync(p) _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 0, p.GetParserRuleContext()) for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(15) + p.SetState(18) p.Match(PlanParserT__3) } { - p.SetState(16) + p.SetState(19) p.expr(0) } } - p.SetState(21) + p.SetState(24) p.GetErrorHandler().Sync(p) _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 0, p.GetParserRuleContext()) } - p.SetState(23) + p.SetState(26) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) if _la == PlanParserT__3 { { - p.SetState(22) + p.SetState(25) p.Match(PlanParserT__3) } } { - p.SetState(25) + p.SetState(28) p.Match(PlanParserT__4) } + case PlanParserEmptyArray: + localctx = NewEmptyArrayContext(p, localctx) + p.SetParserRuleContext(localctx) + _prevctx = localctx + { + p.SetState(30) + p.Match(PlanParserEmptyArray) + } + case PlanParserADD, PlanParserSUB, PlanParserBNOT, PlanParserNOT: localctx = NewUnaryContext(p, localctx) p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(27) + p.SetState(31) var _lt = p.GetTokenStream().LT(1) @@ -2007,8 +2060,8 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(28) - p.expr(20) + p.SetState(32) + p.expr(19) } case PlanParserJSONContains, PlanParserArrayContains: @@ -2016,7 +2069,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(29) + p.SetState(33) _la = p.GetTokenStream().LA(1) if !(_la == PlanParserJSONContains || _la == PlanParserArrayContains) { @@ -2027,23 +2080,23 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(30) + p.SetState(34) p.Match(PlanParserT__0) } { - p.SetState(31) + p.SetState(35) p.expr(0) } { - p.SetState(32) + p.SetState(36) p.Match(PlanParserT__3) } { - p.SetState(33) + p.SetState(37) p.expr(0) } { - p.SetState(34) + p.SetState(38) p.Match(PlanParserT__1) } @@ -2052,7 +2105,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(36) + p.SetState(40) _la = p.GetTokenStream().LA(1) if !(_la == PlanParserJSONContainsAll || _la == PlanParserArrayContainsAll) { @@ -2063,23 +2116,23 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(37) + p.SetState(41) p.Match(PlanParserT__0) } { - p.SetState(38) + p.SetState(42) p.expr(0) } { - p.SetState(39) + p.SetState(43) p.Match(PlanParserT__3) } { - p.SetState(40) + p.SetState(44) p.expr(0) } { - p.SetState(41) + p.SetState(45) p.Match(PlanParserT__1) } @@ -2088,7 +2141,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(43) + p.SetState(47) _la = p.GetTokenStream().LA(1) if !(_la == PlanParserJSONContainsAny || _la == PlanParserArrayContainsAny) { @@ -2099,23 +2152,23 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(44) + p.SetState(48) p.Match(PlanParserT__0) } { - p.SetState(45) + p.SetState(49) p.expr(0) } { - p.SetState(46) + p.SetState(50) p.Match(PlanParserT__3) } { - p.SetState(47) + p.SetState(51) p.expr(0) } { - p.SetState(48) + p.SetState(52) p.Match(PlanParserT__1) } @@ -2124,15 +2177,15 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(50) + p.SetState(54) p.Match(PlanParserArrayLength) } { - p.SetState(51) + p.SetState(55) p.Match(PlanParserT__0) } { - p.SetState(52) + p.SetState(56) _la = p.GetTokenStream().LA(1) if !(_la == PlanParserIdentifier || _la == PlanParserJSONIdentifier) { @@ -2143,7 +2196,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(53) + p.SetState(57) p.Match(PlanParserT__1) } @@ -2152,11 +2205,11 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { p.SetParserRuleContext(localctx) _prevctx = localctx { - p.SetState(54) + p.SetState(58) p.Match(PlanParserEXISTS) } { - p.SetState(55) + p.SetState(59) p.expr(1) } @@ -2164,9 +2217,9 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) } p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) - p.SetState(125) + p.SetState(116) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 6, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 5, p.GetParserRuleContext()) for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { @@ -2174,36 +2227,36 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { p.TriggerExitRuleEvent() } _prevctx = localctx - p.SetState(123) + p.SetState(114) p.GetErrorHandler().Sync(p) - switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 5, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 4, p.GetParserRuleContext()) { case 1: localctx = NewPowerContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(58) + p.SetState(62) - if !(p.Precpred(p.GetParserRuleContext(), 21)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 21)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 20)) { + panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 20)", "")) } { - p.SetState(59) + p.SetState(63) p.Match(PlanParserPOW) } { - p.SetState(60) - p.expr(22) + p.SetState(64) + p.expr(21) } case 2: localctx = NewMulDivModContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(61) + p.SetState(65) - if !(p.Precpred(p.GetParserRuleContext(), 19)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 19)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 18)) { + panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 18)", "")) } { - p.SetState(62) + p.SetState(66) var _lt = p.GetTokenStream().LT(1) @@ -2221,20 +2274,20 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(63) - p.expr(20) + p.SetState(67) + p.expr(19) } case 3: localctx = NewAddSubContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(64) + p.SetState(68) - if !(p.Precpred(p.GetParserRuleContext(), 18)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 18)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 17)) { + panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 17)", "")) } { - p.SetState(65) + p.SetState(69) var _lt = p.GetTokenStream().LT(1) @@ -2252,20 +2305,20 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(66) - p.expr(19) + p.SetState(70) + p.expr(18) } case 4: localctx = NewShiftContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(67) + p.SetState(71) - if !(p.Precpred(p.GetParserRuleContext(), 17)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 17)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 16)) { + panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 16)", "")) } { - p.SetState(68) + p.SetState(72) var _lt = p.GetTokenStream().LT(1) @@ -2283,20 +2336,51 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(69) - p.expr(18) + p.SetState(73) + p.expr(17) } case 5: + localctx = NewTermContext(p, NewExprContext(p, _parentctx, _parentState)) + p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) + p.SetState(74) + + if !(p.Precpred(p.GetParserRuleContext(), 15)) { + panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 15)", "")) + } + p.SetState(76) + p.GetErrorHandler().Sync(p) + _la = p.GetTokenStream().LA(1) + + if _la == PlanParserNOT { + { + p.SetState(75) + + var _m = p.Match(PlanParserNOT) + + localctx.(*TermContext).op = _m + } + + } + { + p.SetState(78) + p.Match(PlanParserIN) + } + { + p.SetState(79) + p.expr(16) + } + + case 6: localctx = NewRangeContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(70) + p.SetState(80) if !(p.Precpred(p.GetParserRuleContext(), 10)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 10)", "")) } { - p.SetState(71) + p.SetState(81) var _lt = p.GetTokenStream().LT(1) @@ -2314,7 +2398,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(72) + p.SetState(82) _la = p.GetTokenStream().LA(1) if !(_la == PlanParserIdentifier || _la == PlanParserJSONIdentifier) { @@ -2325,7 +2409,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(73) + p.SetState(83) var _lt = p.GetTokenStream().LT(1) @@ -2343,20 +2427,20 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(74) + p.SetState(84) p.expr(11) } - case 6: + case 7: localctx = NewReverseRangeContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(75) + p.SetState(85) if !(p.Precpred(p.GetParserRuleContext(), 9)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 9)", "")) } { - p.SetState(76) + p.SetState(86) var _lt = p.GetTokenStream().LT(1) @@ -2374,7 +2458,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(77) + p.SetState(87) _la = p.GetTokenStream().LA(1) if !(_la == PlanParserIdentifier || _la == PlanParserJSONIdentifier) { @@ -2385,7 +2469,7 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(78) + p.SetState(88) var _lt = p.GetTokenStream().LT(1) @@ -2403,20 +2487,20 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(79) + p.SetState(89) p.expr(10) } - case 7: + case 8: localctx = NewRelationalContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(80) + p.SetState(90) if !(p.Precpred(p.GetParserRuleContext(), 8)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 8)", "")) } { - p.SetState(81) + p.SetState(91) var _lt = p.GetTokenStream().LT(1) @@ -2434,20 +2518,20 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(82) + p.SetState(92) p.expr(9) } - case 8: + case 9: localctx = NewEqualityContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(83) + p.SetState(93) if !(p.Precpred(p.GetParserRuleContext(), 7)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", "")) } { - p.SetState(84) + p.SetState(94) var _lt = p.GetTokenStream().LT(1) @@ -2465,220 +2549,118 @@ func (p *PlanParser) expr(_p int) (localctx IExprContext) { } } { - p.SetState(85) + p.SetState(95) p.expr(8) } - case 9: + case 10: localctx = NewBitAndContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(86) + p.SetState(96) if !(p.Precpred(p.GetParserRuleContext(), 6)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", "")) } { - p.SetState(87) + p.SetState(97) p.Match(PlanParserBAND) } { - p.SetState(88) + p.SetState(98) p.expr(7) } - case 10: + case 11: localctx = NewBitXorContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(89) + p.SetState(99) if !(p.Precpred(p.GetParserRuleContext(), 5)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", "")) } { - p.SetState(90) + p.SetState(100) p.Match(PlanParserBXOR) } { - p.SetState(91) + p.SetState(101) p.expr(6) } - case 11: + case 12: localctx = NewBitOrContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(92) + p.SetState(102) if !(p.Precpred(p.GetParserRuleContext(), 4)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) } { - p.SetState(93) + p.SetState(103) p.Match(PlanParserBOR) } { - p.SetState(94) + p.SetState(104) p.expr(5) } - case 12: + case 13: localctx = NewLogicalAndContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(95) + p.SetState(105) if !(p.Precpred(p.GetParserRuleContext(), 3)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) } { - p.SetState(96) + p.SetState(106) p.Match(PlanParserAND) } { - p.SetState(97) + p.SetState(107) p.expr(4) } - case 13: + case 14: localctx = NewLogicalOrContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(98) + p.SetState(108) if !(p.Precpred(p.GetParserRuleContext(), 2)) { panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", "")) } { - p.SetState(99) + p.SetState(109) p.Match(PlanParserOR) } { - p.SetState(100) + p.SetState(110) p.expr(3) } - case 14: + case 15: localctx = NewLikeContext(p, NewExprContext(p, _parentctx, _parentState)) p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(101) + p.SetState(111) - if !(p.Precpred(p.GetParserRuleContext(), 22)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 22)", "")) + if !(p.Precpred(p.GetParserRuleContext(), 21)) { + panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 21)", "")) } { - p.SetState(102) + p.SetState(112) p.Match(PlanParserLIKE) } { - p.SetState(103) + p.SetState(113) p.Match(PlanParserStringLiteral) } - case 15: - localctx = NewTermContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(104) - - if !(p.Precpred(p.GetParserRuleContext(), 16)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 16)", "")) - } - { - p.SetState(105) - - var _lt = p.GetTokenStream().LT(1) - - localctx.(*TermContext).op = _lt - - _la = p.GetTokenStream().LA(1) - - if !(_la == PlanParserIN || _la == PlanParserNIN) { - var _ri = p.GetErrorHandler().RecoverInline(p) - - localctx.(*TermContext).op = _ri - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - - { - p.SetState(106) - p.Match(PlanParserT__2) - } - { - p.SetState(107) - p.expr(0) - } - p.SetState(112) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext()) - - for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { - if _alt == 1 { - { - p.SetState(108) - p.Match(PlanParserT__3) - } - { - p.SetState(109) - p.expr(0) - } - - } - p.SetState(114) - p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 3, p.GetParserRuleContext()) - } - p.SetState(116) - p.GetErrorHandler().Sync(p) - _la = p.GetTokenStream().LA(1) - - if _la == PlanParserT__3 { - { - p.SetState(115) - p.Match(PlanParserT__3) - } - - } - { - p.SetState(118) - p.Match(PlanParserT__4) - } - - case 16: - localctx = NewEmptyTermContext(p, NewExprContext(p, _parentctx, _parentState)) - p.PushNewRecursionContext(localctx, _startState, PlanParserRULE_expr) - p.SetState(120) - - if !(p.Precpred(p.GetParserRuleContext(), 15)) { - panic(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 15)", "")) - } - { - p.SetState(121) - - var _lt = p.GetTokenStream().LT(1) - - localctx.(*EmptyTermContext).op = _lt - - _la = p.GetTokenStream().LA(1) - - if !(_la == PlanParserIN || _la == PlanParserNIN) { - var _ri = p.GetErrorHandler().RecoverInline(p) - - localctx.(*EmptyTermContext).op = _ri - } else { - p.GetErrorHandler().ReportMatch(p) - p.Consume() - } - } - { - p.SetState(122) - p.Match(PlanParserEmptyTerm) - } - } } - p.SetState(127) + p.SetState(118) p.GetErrorHandler().Sync(p) - _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 6, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 5, p.GetParserRuleContext()) } return localctx @@ -2701,52 +2683,49 @@ func (p *PlanParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex in func (p *PlanParser) Expr_Sempred(localctx antlr.RuleContext, predIndex int) bool { switch predIndex { case 0: - return p.Precpred(p.GetParserRuleContext(), 21) + return p.Precpred(p.GetParserRuleContext(), 20) case 1: - return p.Precpred(p.GetParserRuleContext(), 19) + return p.Precpred(p.GetParserRuleContext(), 18) case 2: - return p.Precpred(p.GetParserRuleContext(), 18) + return p.Precpred(p.GetParserRuleContext(), 17) case 3: - return p.Precpred(p.GetParserRuleContext(), 17) + return p.Precpred(p.GetParserRuleContext(), 16) case 4: - return p.Precpred(p.GetParserRuleContext(), 10) + return p.Precpred(p.GetParserRuleContext(), 15) case 5: - return p.Precpred(p.GetParserRuleContext(), 9) + return p.Precpred(p.GetParserRuleContext(), 10) case 6: - return p.Precpred(p.GetParserRuleContext(), 8) + return p.Precpred(p.GetParserRuleContext(), 9) case 7: - return p.Precpred(p.GetParserRuleContext(), 7) + return p.Precpred(p.GetParserRuleContext(), 8) case 8: - return p.Precpred(p.GetParserRuleContext(), 6) + return p.Precpred(p.GetParserRuleContext(), 7) case 9: - return p.Precpred(p.GetParserRuleContext(), 5) + return p.Precpred(p.GetParserRuleContext(), 6) case 10: - return p.Precpred(p.GetParserRuleContext(), 4) + return p.Precpred(p.GetParserRuleContext(), 5) case 11: - return p.Precpred(p.GetParserRuleContext(), 3) + return p.Precpred(p.GetParserRuleContext(), 4) case 12: - return p.Precpred(p.GetParserRuleContext(), 2) + return p.Precpred(p.GetParserRuleContext(), 3) case 13: - return p.Precpred(p.GetParserRuleContext(), 22) + return p.Precpred(p.GetParserRuleContext(), 2) case 14: - return p.Precpred(p.GetParserRuleContext(), 16) - - case 15: - return p.Precpred(p.GetParserRuleContext(), 15) + return p.Precpred(p.GetParserRuleContext(), 21) default: panic("No predicate with index: " + fmt.Sprint(predIndex)) diff --git a/internal/parser/planparserv2/generated/plan_visitor.go b/internal/parser/planparserv2/generated/plan_visitor.go index ebe1bb63c0c80..edb11bc193c75 100644 --- a/internal/parser/planparserv2/generated/plan_visitor.go +++ b/internal/parser/planparserv2/generated/plan_visitor.go @@ -37,6 +37,9 @@ type PlanVisitor interface { // Visit a parse tree produced by PlanParser#LogicalAnd. VisitLogicalAnd(ctx *LogicalAndContext) interface{} + // Visit a parse tree produced by PlanParser#TemplateVariable. + VisitTemplateVariable(ctx *TemplateVariableContext) interface{} + // Visit a parse tree produced by PlanParser#Equality. VisitEquality(ctx *EqualityContext) interface{} @@ -52,6 +55,9 @@ type PlanVisitor interface { // Visit a parse tree produced by PlanParser#BitOr. VisitBitOr(ctx *BitOrContext) interface{} + // Visit a parse tree produced by PlanParser#EmptyArray. + VisitEmptyArray(ctx *EmptyArrayContext) interface{} + // Visit a parse tree produced by PlanParser#AddSub. VisitAddSub(ctx *AddSubContext) interface{} @@ -91,9 +97,6 @@ type PlanVisitor interface { // Visit a parse tree produced by PlanParser#BitAnd. VisitBitAnd(ctx *BitAndContext) interface{} - // Visit a parse tree produced by PlanParser#EmptyTerm. - VisitEmptyTerm(ctx *EmptyTermContext) interface{} - // Visit a parse tree produced by PlanParser#Power. VisitPower(ctx *PowerContext) interface{} } diff --git a/internal/parser/planparserv2/node_ret.go b/internal/parser/planparserv2/node_ret.go index a8d32b40e262c..456b190311ff1 100644 --- a/internal/parser/planparserv2/node_ret.go +++ b/internal/parser/planparserv2/node_ret.go @@ -39,3 +39,15 @@ func getGenericValue(obj interface{}) *planpb.GenericValue { } return expr.expr.GetValueExpr().GetValue() } + +func getValueExpr(obj interface{}) *planpb.ValueExpr { + expr := getExpr(obj) + if expr == nil { + return nil + } + return expr.expr.GetValueExpr() +} + +func isTemplateExpr(expr *planpb.ValueExpr) bool { + return expr != nil && expr.GetTemplateVariableName() != "" +} diff --git a/internal/parser/planparserv2/parser_visitor.go b/internal/parser/planparserv2/parser_visitor.go index 408410059468f..bd0f36dba169a 100644 --- a/internal/parser/planparserv2/parser_visitor.go +++ b/internal/parser/planparserv2/parser_visitor.go @@ -61,7 +61,7 @@ func (v *ParserVisitor) translateIdentifier(identifier string) (*ExprWithType, e // VisitIdentifier translates expr to column plan. func (v *ParserVisitor) VisitIdentifier(ctx *parser.IdentifierContext) interface{} { - identifier := ctx.Identifier().GetText() + identifier := ctx.GetText() expr, err := v.translateIdentifier(identifier) if err != nil { return err @@ -157,18 +157,23 @@ func checkDirectComparisonBinaryField(columnInfo *planpb.ColumnInfo) error { // VisitAddSub translates expr to arithmetic plan. func (v *ParserVisitor) VisitAddSub(ctx *parser.AddSubContext) interface{} { + var err error left := ctx.Expr(0).Accept(v) - if err := getError(left); err != nil { + if err = getError(left); err != nil { return err } right := ctx.Expr(1).Accept(v) - if err := getError(right); err != nil { + if err = getError(right); err != nil { return err } - leftValue, rightValue := getGenericValue(left), getGenericValue(right) - if leftValue != nil && rightValue != nil { + leftValueExpr, rightValueExpr := getValueExpr(left), getValueExpr(right) + if leftValueExpr != nil && rightValueExpr != nil { + if isTemplateExpr(leftValueExpr) || isTemplateExpr(rightValueExpr) { + return fmt.Errorf("placeholder was not supported between two constants with operator: %s", ctx.GetOp().GetText()) + } + leftValue, rightValue := leftValueExpr.GetValue(), rightValueExpr.GetValue() switch ctx.GetOp().GetTokenType() { case parser.PlanParserADD: return Add(leftValue, rightValue) @@ -179,34 +184,37 @@ func (v *ParserVisitor) VisitAddSub(ctx *parser.AddSubContext) interface{} { } } - var leftExpr *ExprWithType - var rightExpr *ExprWithType + leftExpr, rightExpr := getExpr(left), getExpr(right) reverse := true - if leftValue != nil { - leftExpr = toValueExpr(leftValue) - } else { + if leftValueExpr == nil { reverse = false - leftExpr = getExpr(left) - } - if rightValue != nil { - rightExpr = toValueExpr(rightValue) - } else { - rightExpr = getExpr(right) } if leftExpr == nil || rightExpr == nil { return fmt.Errorf("invalid arithmetic expression, left: %s, op: %s, right: %s", ctx.Expr(0).GetText(), ctx.GetOp(), ctx.Expr(1).GetText()) } - if err := checkDirectComparisonBinaryField(toColumnInfo(leftExpr)); err != nil { + if err = checkDirectComparisonBinaryField(toColumnInfo(leftExpr)); err != nil { return err } - if err := checkDirectComparisonBinaryField(toColumnInfo(rightExpr)); err != nil { + if err = checkDirectComparisonBinaryField(toColumnInfo(rightExpr)); err != nil { return err } - if !canArithmetic(leftExpr, rightExpr) { - return fmt.Errorf("'%s' can only be used between integer or floating or json field expressions", arithNameMap[ctx.GetOp().GetTokenType()]) + var dataType schemapb.DataType + if leftExpr.expr.GetIsTemplate() { + dataType = rightExpr.dataType + } else if rightExpr.expr.GetIsTemplate() { + dataType = leftExpr.dataType + } else { + if !canArithmetic(leftExpr.dataType, getArrayElementType(leftExpr), rightExpr.dataType, getArrayElementType(rightExpr)) { + return fmt.Errorf("'%s' can only be used between integer or floating or json field expressions", arithNameMap[ctx.GetOp().GetTokenType()]) + } + + dataType, err = calcDataType(leftExpr, rightExpr, reverse) + if err != nil { + return err + } } expr := &planpb.Expr{ @@ -217,10 +225,7 @@ func (v *ParserVisitor) VisitAddSub(ctx *parser.AddSubContext) interface{} { Op: arithExprMap[ctx.GetOp().GetTokenType()], }, }, - } - dataType, err := calcDataType(leftExpr, rightExpr, reverse) - if err != nil { - return err + IsTemplate: leftExpr.expr.GetIsTemplate() || rightExpr.expr.GetIsTemplate(), } return &ExprWithType{ expr: expr, @@ -231,6 +236,7 @@ func (v *ParserVisitor) VisitAddSub(ctx *parser.AddSubContext) interface{} { // VisitMulDivMod translates expr to arithmetic plan. func (v *ParserVisitor) VisitMulDivMod(ctx *parser.MulDivModContext) interface{} { + var err error left := ctx.Expr(0).Accept(v) if err := getError(left); err != nil { return err @@ -241,8 +247,12 @@ func (v *ParserVisitor) VisitMulDivMod(ctx *parser.MulDivModContext) interface{} return err } - leftValue, rightValue := getGenericValue(left), getGenericValue(right) - if leftValue != nil && rightValue != nil { + leftValueExpr, rightValueExpr := getValueExpr(left), getValueExpr(right) + if leftValueExpr != nil && rightValueExpr != nil { + if isTemplateExpr(leftValueExpr) || isTemplateExpr(rightValueExpr) { + return fmt.Errorf("placeholder was not supported between two constants with operator: %s", ctx.GetOp().GetText()) + } + leftValue, rightValue := getGenericValue(left), getGenericValue(right) switch ctx.GetOp().GetTokenType() { case parser.PlanParserMUL: return Multiply(leftValue, rightValue) @@ -263,21 +273,12 @@ func (v *ParserVisitor) VisitMulDivMod(ctx *parser.MulDivModContext) interface{} } } - var leftExpr *ExprWithType - var rightExpr *ExprWithType + leftExpr, rightExpr := getExpr(left), getExpr(right) reverse := true - if leftValue != nil { - leftExpr = toValueExpr(leftValue) - } else { - leftExpr = getExpr(left) + if leftValueExpr == nil { reverse = false } - if rightValue != nil { - rightExpr = toValueExpr(rightValue) - } else { - rightExpr = getExpr(right) - } if leftExpr == nil || rightExpr == nil { return fmt.Errorf("invalid arithmetic expression, left: %s, op: %s, right: %s", ctx.Expr(0).GetText(), ctx.GetOp(), ctx.Expr(1).GetText()) @@ -289,18 +290,27 @@ func (v *ParserVisitor) VisitMulDivMod(ctx *parser.MulDivModContext) interface{} if err := checkDirectComparisonBinaryField(toColumnInfo(rightExpr)); err != nil { return err } - if !canArithmetic(leftExpr, rightExpr) { - return fmt.Errorf("'%s' can only be used between integer or floating or json field expressions", arithNameMap[ctx.GetOp().GetTokenType()]) - } - switch ctx.GetOp().GetTokenType() { - case parser.PlanParserMOD: - if !isIntegerColumn(toColumnInfo(leftExpr)) && !isIntegerColumn(toColumnInfo(rightExpr)) { - return fmt.Errorf("modulo can only apply on integer types") + var dataType schemapb.DataType + if leftExpr.expr.GetIsTemplate() { + dataType = rightExpr.dataType + } else if rightExpr.expr.GetIsTemplate() { + dataType = leftExpr.dataType + } else { + if !canArithmetic(leftExpr.dataType, getArrayElementType(leftExpr), rightExpr.dataType, getArrayElementType(rightExpr)) { + return fmt.Errorf("'%s' can only be used between integer or floating or json field expressions", arithNameMap[ctx.GetOp().GetTokenType()]) + } + + if err = checkValidModArith(arithExprMap[ctx.GetOp().GetTokenType()], leftExpr.dataType, getArrayElementType(leftExpr), rightExpr.dataType, getArrayElementType(rightExpr)); err != nil { + return err + } + + dataType, err = calcDataType(leftExpr, rightExpr, reverse) + if err != nil { + return err } - default: - break } + expr := &planpb.Expr{ Expr: &planpb.Expr_BinaryArithExpr{ BinaryArithExpr: &planpb.BinaryArithExpr{ @@ -309,11 +319,9 @@ func (v *ParserVisitor) VisitMulDivMod(ctx *parser.MulDivModContext) interface{} Op: arithExprMap[ctx.GetOp().GetTokenType()], }, }, + IsTemplate: leftExpr.expr.GetIsTemplate() || rightExpr.expr.GetIsTemplate(), } - dataType, err := calcDataType(leftExpr, rightExpr, reverse) - if err != nil { - return err - } + return &ExprWithType{ expr: expr, dataType: dataType, @@ -333,8 +341,12 @@ func (v *ParserVisitor) VisitEquality(ctx *parser.EqualityContext) interface{} { return err } - leftValue, rightValue := getGenericValue(left), getGenericValue(right) - if leftValue != nil && rightValue != nil { + leftValueExpr, rightValueExpr := getValueExpr(left), getValueExpr(right) + if leftValueExpr != nil && rightValueExpr != nil { + if isTemplateExpr(leftValueExpr) || isTemplateExpr(rightValueExpr) { + return fmt.Errorf("placeholder was not supported between two constants with operator: %s", ctx.GetOp().GetText()) + } + leftValue, rightValue := leftValueExpr.GetValue(), rightValueExpr.GetValue() var ret *ExprWithType switch ctx.GetOp().GetTokenType() { case parser.PlanParserEQ: @@ -350,18 +362,7 @@ func (v *ParserVisitor) VisitEquality(ctx *parser.EqualityContext) interface{} { return ret } - var leftExpr *ExprWithType - var rightExpr *ExprWithType - if leftValue != nil { - leftExpr = toValueExpr(leftValue) - } else { - leftExpr = getExpr(left) - } - if rightValue != nil { - rightExpr = toValueExpr(rightValue) - } else { - rightExpr = getExpr(right) - } + leftExpr, rightExpr := getExpr(left), getExpr(right) expr, err := HandleCompare(ctx.GetOp().GetTokenType(), leftExpr, rightExpr) if err != nil { @@ -385,10 +386,12 @@ func (v *ParserVisitor) VisitRelational(ctx *parser.RelationalContext) interface if err := getError(right); err != nil { return err } - - leftValue, rightValue := getGenericValue(left), getGenericValue(right) - - if leftValue != nil && rightValue != nil { + leftValueExpr, rightValueExpr := getValueExpr(left), getValueExpr(right) + if leftValueExpr != nil && rightValueExpr != nil { + if isTemplateExpr(leftValueExpr) || isTemplateExpr(rightValueExpr) { + return fmt.Errorf("placeholder was not supported between two constants with operator: %s", ctx.GetOp().GetText()) + } + leftValue, rightValue := getGenericValue(left), getGenericValue(right) var ret *ExprWithType switch ctx.GetOp().GetTokenType() { case parser.PlanParserLT: @@ -408,18 +411,7 @@ func (v *ParserVisitor) VisitRelational(ctx *parser.RelationalContext) interface return ret } - var leftExpr *ExprWithType - var rightExpr *ExprWithType - if leftValue != nil { - leftExpr = toValueExpr(leftValue) - } else { - leftExpr = getExpr(left) - } - if rightValue != nil { - rightExpr = toValueExpr(rightValue) - } else { - rightExpr = getExpr(right) - } + leftExpr, rightExpr := getExpr(left), getExpr(right) if err := checkDirectComparisonBinaryField(toColumnInfo(leftExpr)); err != nil { return err } @@ -508,80 +500,50 @@ func (v *ParserVisitor) VisitTerm(ctx *parser.TermContext) interface{} { if typeutil.IsArrayType(dataType) && len(columnInfo.GetNestedPath()) != 0 { dataType = columnInfo.GetElementType() } - allExpr := ctx.AllExpr() - lenOfAllExpr := len(allExpr) - values := make([]*planpb.GenericValue, 0, lenOfAllExpr) - for i := 1; i < lenOfAllExpr; i++ { - term := allExpr[i].Accept(v) - if getError(term) != nil { - return term - } - n := getGenericValue(term) - if n == nil { - return fmt.Errorf("value '%s' in list cannot be a non-const expression", ctx.Expr(i).GetText()) - } - castedValue, err := castValue(dataType, n) - if err != nil { - return fmt.Errorf("value '%s' in list cannot be casted to %s", ctx.Expr(i).GetText(), dataType.String()) - } - values = append(values, castedValue) - } - if len(values) <= 0 { - return fmt.Errorf("'term' has empty value list") - } - expr := &planpb.Expr{ - Expr: &planpb.Expr_TermExpr{ - TermExpr: &planpb.TermExpr{ - ColumnInfo: columnInfo, - Values: values, - }, - }, - } - if ctx.GetOp().GetTokenType() == parser.PlanParserNIN { - expr = &planpb.Expr{ - Expr: &planpb.Expr_UnaryExpr{ - UnaryExpr: &planpb.UnaryExpr{ - Op: planpb.UnaryExpr_Not, - Child: expr, - }, - }, - } - } - return &ExprWithType{ - expr: expr, - dataType: schemapb.DataType_Bool, - } -} -// VisitEmptyTerm translates expr to term plan. -func (v *ParserVisitor) VisitEmptyTerm(ctx *parser.EmptyTermContext) interface{} { - child := ctx.Expr().Accept(v) - if err := getError(child); err != nil { - return err - } - - if childValue := getGenericValue(child); childValue != nil { - return fmt.Errorf("'term' can only be used on non-const expression, but got: %s", ctx.Expr().GetText()) + term := ctx.Expr(1).Accept(v) + if getError(term) != nil { + return term } + valueExpr := getValueExpr(term) + var placeholder string + var neddFillPlaceholder bool + var values []*planpb.GenericValue + if valueExpr.GetValue() == nil && valueExpr.GetTemplateVariableName() != "" { + placeholder = valueExpr.GetTemplateVariableName() + values = nil + neddFillPlaceholder = true + } else { + elementValue := valueExpr.GetValue() + if elementValue == nil { + return fmt.Errorf( + "contains_any operation are only supported explicitly specified element, got: %s", ctx.Expr(1).GetText()) + } - childExpr := getExpr(child) - columnInfo := toColumnInfo(childExpr) - if columnInfo == nil { - return fmt.Errorf("'term' can only be used on single field, but got: %s", ctx.Expr().GetText()) - } - if err := checkDirectComparisonBinaryField(columnInfo); err != nil { - return err + if !IsArray(elementValue) { + return fmt.Errorf("the right-hand side of 'in' must be a list, but got: %s", ctx.Expr(1).GetText()) + } + array := elementValue.GetArrayVal().GetArray() + values = make([]*planpb.GenericValue, len(array)) + for i, e := range array { + castedValue, err := castValue(dataType, e) + if err != nil { + return fmt.Errorf("value '%s' in list cannot be casted to %s", e.String(), dataType.String()) + } + values[i] = castedValue + } } - expr := &planpb.Expr{ Expr: &planpb.Expr_TermExpr{ TermExpr: &planpb.TermExpr{ - ColumnInfo: columnInfo, - Values: nil, + ColumnInfo: columnInfo, + Values: values, + TemplateVariableName: placeholder, }, }, + IsTemplate: neddFillPlaceholder, } - if ctx.GetOp().GetTokenType() == parser.PlanParserNIN { + if ctx.GetOp() != nil { expr = &planpb.Expr{ Expr: &planpb.Expr_UnaryExpr{ UnaryExpr: &planpb.UnaryExpr{ @@ -589,6 +551,7 @@ func (v *ParserVisitor) VisitEmptyTerm(ctx *parser.EmptyTermContext) interface{} Child: expr, }, }, + IsTemplate: neddFillPlaceholder, } } return &ExprWithType{ @@ -631,12 +594,11 @@ func (v *ParserVisitor) VisitRange(ctx *parser.RangeContext) interface{} { return err } - lowerValue := getGenericValue(lower) - upperValue := getGenericValue(upper) - if lowerValue == nil { + lowerValueExpr, upperValueExpr := getValueExpr(lower), getValueExpr(upper) + if lowerValueExpr == nil { return fmt.Errorf("lowerbound cannot be a non-const expression: %s", ctx.Expr(0).GetText()) } - if upperValue == nil { + if upperValueExpr == nil { return fmt.Errorf("upperbound cannot be a non-const expression: %s", ctx.Expr(1).GetText()) } @@ -645,52 +607,45 @@ func (v *ParserVisitor) VisitRange(ctx *parser.RangeContext) interface{} { fieldDataType = columnInfo.GetElementType() } - switch fieldDataType { - case schemapb.DataType_String, schemapb.DataType_VarChar: - if !IsString(lowerValue) || !IsString(upperValue) { - return fmt.Errorf("invalid range operations") - } - case schemapb.DataType_Bool: - return fmt.Errorf("invalid range operations on boolean expr") - case schemapb.DataType_Int8, schemapb.DataType_Int16, schemapb.DataType_Int32, schemapb.DataType_Int64: - if !IsInteger(lowerValue) || !IsInteger(upperValue) { - return fmt.Errorf("invalid range operations") - } - case schemapb.DataType_Float, schemapb.DataType_Double: - if !IsNumber(lowerValue) || !IsNumber(upperValue) { - return fmt.Errorf("invalid range operations") - } - if IsInteger(lowerValue) { - lowerValue = NewFloat(float64(lowerValue.GetInt64Val())) + lowerValue := lowerValueExpr.GetValue() + upperValue := upperValueExpr.GetValue() + if !isTemplateExpr(lowerValueExpr) { + if err = checkRangeCompared(fieldDataType, lowerValue); err != nil { + return err } - if IsInteger(upperValue) { - upperValue = NewFloat(float64(upperValue.GetInt64Val())) + } + if !isTemplateExpr(upperValueExpr) { + if err = checkRangeCompared(fieldDataType, upperValue); err != nil { + return err } } - lowerInclusive := ctx.GetOp1().GetTokenType() == parser.PlanParserLE upperInclusive := ctx.GetOp2().GetTokenType() == parser.PlanParserLE - - // if !(lowerInclusive && upperInclusive) { - // if getGenericValue(GreaterEqual(lowerValue, upperValue)).GetBoolVal() { - // return fmt.Errorf("invalid range: lowerbound is greater than upperbound") - // } - // } else { - // if getGenericValue(Greater(lowerValue, upperValue)).GetBoolVal() { - // return fmt.Errorf("invalid range: lowerbound is greater than upperbound") - // } - // } + if !isTemplateExpr(lowerValueExpr) && !isTemplateExpr(upperValueExpr) { + if !(lowerInclusive && upperInclusive) { + if getGenericValue(GreaterEqual(lowerValue, upperValue)).GetBoolVal() { + return fmt.Errorf("invalid range: lowerbound is greater than upperbound") + } + } else { + if getGenericValue(Greater(lowerValue, upperValue)).GetBoolVal() { + return fmt.Errorf("invalid range: lowerbound is greater than upperbound") + } + } + } expr := &planpb.Expr{ Expr: &planpb.Expr_BinaryRangeExpr{ BinaryRangeExpr: &planpb.BinaryRangeExpr{ - ColumnInfo: columnInfo, - LowerInclusive: lowerInclusive, - UpperInclusive: upperInclusive, - LowerValue: lowerValue, - UpperValue: upperValue, + ColumnInfo: columnInfo, + LowerInclusive: lowerInclusive, + UpperInclusive: upperInclusive, + LowerValue: lowerValue, + UpperValue: upperValue, + LowerTemplateVariableName: lowerValueExpr.GetTemplateVariableName(), + UpperTemplateVariableName: upperValueExpr.GetTemplateVariableName(), }, }, + IsTemplate: isTemplateExpr(lowerValueExpr) || isTemplateExpr(upperValueExpr), } return &ExprWithType{ expr: expr, @@ -721,61 +676,58 @@ func (v *ParserVisitor) VisitReverseRange(ctx *parser.ReverseRangeContext) inter return err } - lowerValue := getGenericValue(lower) - upperValue := getGenericValue(upper) - if lowerValue == nil { + lowerValueExpr, upperValueExpr := getValueExpr(lower), getValueExpr(upper) + if lowerValueExpr == nil { return fmt.Errorf("lowerbound cannot be a non-const expression: %s", ctx.Expr(0).GetText()) } - if upperValue == nil { + if upperValueExpr == nil { return fmt.Errorf("upperbound cannot be a non-const expression: %s", ctx.Expr(1).GetText()) } - switch columnInfo.GetDataType() { - case schemapb.DataType_String, schemapb.DataType_VarChar: - if !IsString(lowerValue) || !IsString(upperValue) { - return fmt.Errorf("invalid range operations") - } - case schemapb.DataType_Bool: - return fmt.Errorf("invalid range operations on boolean expr") - case schemapb.DataType_Int8, schemapb.DataType_Int16, schemapb.DataType_Int32, schemapb.DataType_Int64: - if !IsInteger(lowerValue) || !IsInteger(upperValue) { - return fmt.Errorf("invalid range operations") - } - case schemapb.DataType_Float, schemapb.DataType_Double: - if !IsNumber(lowerValue) || !IsNumber(upperValue) { - return fmt.Errorf("invalid range operations") - } - if IsInteger(lowerValue) { - lowerValue = NewFloat(float64(lowerValue.GetInt64Val())) + fieldDataType := columnInfo.GetDataType() + if typeutil.IsArrayType(columnInfo.GetDataType()) { + fieldDataType = columnInfo.GetElementType() + } + + lowerValue := lowerValueExpr.GetValue() + upperValue := upperValueExpr.GetValue() + if !isTemplateExpr(lowerValueExpr) { + if err = checkRangeCompared(fieldDataType, lowerValue); err != nil { + return err } - if IsInteger(upperValue) { - upperValue = NewFloat(float64(upperValue.GetInt64Val())) + } + if !isTemplateExpr(upperValueExpr) { + if err = checkRangeCompared(fieldDataType, upperValue); err != nil { + return err } } - lowerInclusive := ctx.GetOp2().GetTokenType() == parser.PlanParserGE upperInclusive := ctx.GetOp1().GetTokenType() == parser.PlanParserGE - - // if !(lowerInclusive && upperInclusive) { - // if getGenericValue(GreaterEqual(lowerValue, upperValue)).GetBoolVal() { - // return fmt.Errorf("invalid range: lowerbound is greater than upperbound") - // } - // } else { - // if getGenericValue(Greater(lowerValue, upperValue)).GetBoolVal() { - // return fmt.Errorf("invalid range: lowerbound is greater than upperbound") - // } - // } + if !isTemplateExpr(lowerValueExpr) && !isTemplateExpr(upperValueExpr) { + if !(lowerInclusive && upperInclusive) { + if getGenericValue(GreaterEqual(lowerValue, upperValue)).GetBoolVal() { + return fmt.Errorf("invalid range: lowerbound is greater than upperbound") + } + } else { + if getGenericValue(Greater(lowerValue, upperValue)).GetBoolVal() { + return fmt.Errorf("invalid range: lowerbound is greater than upperbound") + } + } + } expr := &planpb.Expr{ Expr: &planpb.Expr_BinaryRangeExpr{ BinaryRangeExpr: &planpb.BinaryRangeExpr{ - ColumnInfo: columnInfo, - LowerInclusive: lowerInclusive, - UpperInclusive: upperInclusive, - LowerValue: lowerValue, - UpperValue: upperValue, + ColumnInfo: columnInfo, + LowerInclusive: lowerInclusive, + UpperInclusive: upperInclusive, + LowerValue: lowerValue, + UpperValue: upperValue, + LowerTemplateVariableName: lowerValueExpr.GetTemplateVariableName(), + UpperTemplateVariableName: upperValueExpr.GetTemplateVariableName(), }, }, + IsTemplate: isTemplateExpr(lowerValueExpr) || isTemplateExpr(upperValueExpr), } return &ExprWithType{ expr: expr, @@ -1106,7 +1058,7 @@ func (v *ParserVisitor) VisitExists(ctx *parser.ExistsContext) interface{} { func (v *ParserVisitor) VisitArray(ctx *parser.ArrayContext) interface{} { allExpr := ctx.AllExpr() - array := make([]*planpb.GenericValue, 0, len(allExpr)) + array := make([]*planpb.GenericValue, len(allExpr)) dType := schemapb.DataType_None sameType := true for i := 0; i < len(allExpr); i++ { @@ -1118,7 +1070,7 @@ func (v *ParserVisitor) VisitArray(ctx *parser.ArrayContext) interface{} { if elementValue == nil { return fmt.Errorf("array element type must be generic value, but got: %s", allExpr[i].GetText()) } - array = append(array, elementValue) + array[i] = elementValue if dType == schemapb.DataType_None { dType = element.(*ExprWithType).dataType @@ -1151,6 +1103,28 @@ func (v *ParserVisitor) VisitArray(ctx *parser.ArrayContext) interface{} { } } +func (v *ParserVisitor) VisitEmptyArray(ctx *parser.EmptyArrayContext) interface{} { + return &ExprWithType{ + dataType: schemapb.DataType_Array, + expr: &planpb.Expr{ + Expr: &planpb.Expr_ValueExpr{ + ValueExpr: &planpb.ValueExpr{ + Value: &planpb.GenericValue{ + Val: &planpb.GenericValue_ArrayVal{ + ArrayVal: &planpb.Array{ + Array: nil, + SameType: true, + ElementType: schemapb.DataType_None, + }, + }, + }, + }, + }, + }, + nodeDependent: true, + } +} + func (v *ParserVisitor) VisitJSONContains(ctx *parser.JSONContainsContext) interface{} { field := ctx.Expr(0).Accept(v) if err := getError(field); err != nil { @@ -1168,32 +1142,33 @@ func (v *ParserVisitor) VisitJSONContains(ctx *parser.JSONContainsContext) inter if err := getError(element); err != nil { return err } - elementValue := getGenericValue(element) - if elementValue == nil { + elementExpr := getValueExpr(element) + if elementExpr == nil { return fmt.Errorf( "contains operation are only supported explicitly specified element, got: %s", ctx.Expr(1).GetText()) } - if typeutil.IsArrayType(columnInfo.GetDataType()) { - valExpr := toValueExpr(elementValue) - if !canBeCompared(field.(*ExprWithType), valExpr) { - return fmt.Errorf("contains operation can't compare between array element type: %s and %s", - columnInfo.GetElementType(), - valExpr.dataType) + var elements []*planpb.GenericValue + + if !isTemplateExpr(elementExpr) { + elements = make([]*planpb.GenericValue, 1) + elementValue := elementExpr.GetValue() + if err := checkContainsElement(field.(*ExprWithType), planpb.JSONContainsExpr_Contains, elementValue); err != nil { + return err } + elements[0] = elementValue } - elements := make([]*planpb.GenericValue, 1) - elements[0] = elementValue - expr := &planpb.Expr{ Expr: &planpb.Expr_JsonContainsExpr{ JsonContainsExpr: &planpb.JSONContainsExpr{ - ColumnInfo: columnInfo, - Elements: elements, - Op: planpb.JSONContainsExpr_Contains, - ElementsSameType: true, + ColumnInfo: columnInfo, + Elements: elements, + Op: planpb.JSONContainsExpr_Contains, + ElementsSameType: true, + TemplateVariableName: elementExpr.GetTemplateVariableName(), }, }, + IsTemplate: isTemplateExpr(elementExpr), } return &ExprWithType{ expr: expr, @@ -1218,36 +1193,35 @@ func (v *ParserVisitor) VisitJSONContainsAll(ctx *parser.JSONContainsAllContext) if err := getError(element); err != nil { return err } - elementValue := getGenericValue(element) - if elementValue == nil { + + elementExpr := getValueExpr(element) + if elementExpr == nil { return fmt.Errorf( "contains_all operation are only supported explicitly specified element, got: %s", ctx.Expr(1).GetText()) } - if elementValue.GetArrayVal() == nil { - return fmt.Errorf("contains_all operation element must be an array") - } - - if typeutil.IsArrayType(columnInfo.GetDataType()) { - for _, value := range elementValue.GetArrayVal().GetArray() { - valExpr := toValueExpr(value) - if !canBeCompared(field.(*ExprWithType), valExpr) { - return fmt.Errorf("contains_all operation can't compare between array element type: %s and %s", - columnInfo.GetElementType(), - valExpr.dataType) - } + var elements []*planpb.GenericValue + var sameType bool + if !isTemplateExpr(elementExpr) { + elementValue := elementExpr.GetValue() + if err := checkContainsElement(field.(*ExprWithType), planpb.JSONContainsExpr_ContainsAll, elementValue); err != nil { + return err } + elements = elementValue.GetArrayVal().GetArray() + sameType = elementValue.GetArrayVal().GetSameType() } expr := &planpb.Expr{ Expr: &planpb.Expr_JsonContainsExpr{ JsonContainsExpr: &planpb.JSONContainsExpr{ - ColumnInfo: columnInfo, - Elements: elementValue.GetArrayVal().GetArray(), - Op: planpb.JSONContainsExpr_ContainsAll, - ElementsSameType: elementValue.GetArrayVal().GetSameType(), + ColumnInfo: columnInfo, + Elements: elements, + Op: planpb.JSONContainsExpr_ContainsAll, + ElementsSameType: sameType, + TemplateVariableName: elementExpr.GetTemplateVariableName(), }, }, + IsTemplate: isTemplateExpr(elementExpr), } return &ExprWithType{ expr: expr, @@ -1272,36 +1246,35 @@ func (v *ParserVisitor) VisitJSONContainsAny(ctx *parser.JSONContainsAnyContext) if err := getError(element); err != nil { return err } - elementValue := getGenericValue(element) - if elementValue == nil { + valueExpr := getValueExpr(element) + + if valueExpr == nil { return fmt.Errorf( "contains_any operation are only supported explicitly specified element, got: %s", ctx.Expr(1).GetText()) } - if elementValue.GetArrayVal() == nil { - return fmt.Errorf("contains_any operation element must be an array") - } - - if typeutil.IsArrayType(columnInfo.GetDataType()) { - for _, value := range elementValue.GetArrayVal().GetArray() { - valExpr := toValueExpr(value) - if !canBeCompared(field.(*ExprWithType), valExpr) { - return fmt.Errorf("contains_any operation can't compare between array element type: %s and %s", - columnInfo.GetElementType(), - valExpr.dataType) - } + var elements []*planpb.GenericValue + var sameType bool + if !isTemplateExpr(valueExpr) { + elementValue := valueExpr.GetValue() + if err := checkContainsElement(field.(*ExprWithType), planpb.JSONContainsExpr_ContainsAny, elementValue); err != nil { + return err } + elements = elementValue.GetArrayVal().GetArray() + sameType = elementValue.GetArrayVal().GetSameType() } expr := &planpb.Expr{ Expr: &planpb.Expr_JsonContainsExpr{ JsonContainsExpr: &planpb.JSONContainsExpr{ - ColumnInfo: columnInfo, - Elements: elementValue.GetArrayVal().GetArray(), - Op: planpb.JSONContainsExpr_ContainsAny, - ElementsSameType: elementValue.GetArrayVal().GetSameType(), + ColumnInfo: columnInfo, + Elements: elements, + Op: planpb.JSONContainsExpr_ContainsAny, + ElementsSameType: sameType, + TemplateVariableName: valueExpr.GetTemplateVariableName(), }, }, + IsTemplate: isTemplateExpr(valueExpr), } return &ExprWithType{ expr: expr, @@ -1341,3 +1314,17 @@ func (v *ParserVisitor) VisitArrayLength(ctx *parser.ArrayLengthContext) interfa nodeDependent: true, } } + +func (v *ParserVisitor) VisitTemplateVariable(ctx *parser.TemplateVariableContext) interface{} { + return &ExprWithType{ + expr: &planpb.Expr{ + Expr: &planpb.Expr_ValueExpr{ + ValueExpr: &planpb.ValueExpr{ + Value: nil, + TemplateVariableName: ctx.Identifier().GetText(), + }, + }, + IsTemplate: true, + }, + } +} diff --git a/internal/parser/planparserv2/plan_parser_v2.go b/internal/parser/planparserv2/plan_parser_v2.go index e0d6c84094560..da701dcc26620 100644 --- a/internal/parser/planparserv2/plan_parser_v2.go +++ b/internal/parser/planparserv2/plan_parser_v2.go @@ -17,6 +17,7 @@ import ( ) func handleExpr(schema *typeutil.SchemaHelper, exprStr string) interface{} { + exprStr = convertHanToASCII(exprStr) return handleExprWithErrorListener(schema, exprStr, &errorListenerImpl{}) } @@ -57,7 +58,7 @@ func handleExprWithErrorListener(schema *typeutil.SchemaHelper, exprStr string, return ast.Accept(visitor) } -func ParseExpr(schema *typeutil.SchemaHelper, exprStr string) (*planpb.Expr, error) { +func ParseExpr(schema *typeutil.SchemaHelper, exprStr string, exprTemplateValues map[string]*schemapb.TemplateValue) (*planpb.Expr, error) { ret := handleExpr(schema, exprStr) if err := getError(ret); err != nil { @@ -72,6 +73,15 @@ func ParseExpr(schema *typeutil.SchemaHelper, exprStr string) (*planpb.Expr, err return nil, fmt.Errorf("predicate is not a boolean expression: %s, data type: %s", exprStr, predicate.dataType) } + valueMap, err := UnmarshalExpressionValues(exprTemplateValues) + if err != nil { + return nil, err + } + + if err := FillExpressionValue(predicate.expr, valueMap); err != nil { + return nil, err + } + return predicate.expr, nil } @@ -93,8 +103,8 @@ func ParseIdentifier(schema *typeutil.SchemaHelper, identifier string, checkFunc return checkFunc(predicate.expr) } -func CreateRetrievePlan(schema *typeutil.SchemaHelper, exprStr string) (*planpb.PlanNode, error) { - expr, err := ParseExpr(schema, exprStr) +func CreateRetrievePlan(schema *typeutil.SchemaHelper, exprStr string, exprTemplateValues map[string]*schemapb.TemplateValue) (*planpb.PlanNode, error) { + expr, err := ParseExpr(schema, exprStr, exprTemplateValues) if err != nil { return nil, err } @@ -139,14 +149,12 @@ func convertHanToASCII(s string) string { return builder.String() } -func CreateSearchPlan(schema *typeutil.SchemaHelper, exprStr string, vectorFieldName string, queryInfo *planpb.QueryInfo) (*planpb.PlanNode, error) { - exprStr = convertHanToASCII(exprStr) - +func CreateSearchPlan(schema *typeutil.SchemaHelper, exprStr string, vectorFieldName string, queryInfo *planpb.QueryInfo, exprTemplateValues map[string]*schemapb.TemplateValue) (*planpb.PlanNode, error) { parse := func() (*planpb.Expr, error) { if len(exprStr) <= 0 { return nil, nil } - return ParseExpr(schema, exprStr) + return ParseExpr(schema, exprStr, exprTemplateValues) } expr, err := parse() diff --git a/internal/parser/planparserv2/plan_parser_v2_test.go b/internal/parser/planparserv2/plan_parser_v2_test.go index ec1faccdf0442..b492f62e1d7fe 100644 --- a/internal/parser/planparserv2/plan_parser_v2_test.go +++ b/internal/parser/planparserv2/plan_parser_v2_test.go @@ -58,7 +58,7 @@ func newTestSchemaHelper(t *testing.T) *typeutil.SchemaHelper { } func assertValidExpr(t *testing.T, helper *typeutil.SchemaHelper, exprStr string) { - _, err := ParseExpr(helper, exprStr) + _, err := ParseExpr(helper, exprStr, nil) assert.NoError(t, err, exprStr) // expr, err := ParseExpr(helper, exprStr) @@ -68,7 +68,7 @@ func assertValidExpr(t *testing.T, helper *typeutil.SchemaHelper, exprStr string } func assertInvalidExpr(t *testing.T, helper *typeutil.SchemaHelper, exprStr string) { - _, err := ParseExpr(helper, exprStr) + _, err := ParseExpr(helper, exprStr, nil) assert.Error(t, err, exprStr) } @@ -393,7 +393,7 @@ func TestExpr_Combinations(t *testing.T) { func TestCreateRetrievePlan(t *testing.T) { schema := newTestSchemaHelper(t) - _, err := CreateRetrievePlan(schema, "Int64Field > 0") + _, err := CreateRetrievePlan(schema, "Int64Field > 0", nil) assert.NoError(t, err) } @@ -404,7 +404,7 @@ func TestCreateSearchPlan(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) } @@ -415,7 +415,7 @@ func TestCreateFloat16SearchPlan(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) } @@ -426,7 +426,7 @@ func TestCreateBFloat16earchPlan(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) } @@ -437,7 +437,7 @@ func TestCreateSparseFloatVectorSearchPlan(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) } @@ -582,7 +582,7 @@ func TestExpr_Invalid(t *testing.T) { `[1,2,3] == 1`, } for _, exprStr := range exprStrs { - _, err := ParseExpr(helper, exprStr) + _, err := ParseExpr(helper, exprStr, nil) assert.Error(t, err, exprStr) } } @@ -590,7 +590,7 @@ func TestExpr_Invalid(t *testing.T) { func TestCreateRetrievePlan_Invalid(t *testing.T) { t.Run("invalid expr", func(t *testing.T) { schema := newTestSchemaHelper(t) - _, err := CreateRetrievePlan(schema, "invalid expression") + _, err := CreateRetrievePlan(schema, "invalid expression", nil) assert.Error(t, err) }) } @@ -598,19 +598,19 @@ func TestCreateRetrievePlan_Invalid(t *testing.T) { func TestCreateSearchPlan_Invalid(t *testing.T) { t.Run("invalid expr", func(t *testing.T) { schema := newTestSchemaHelper(t) - _, err := CreateSearchPlan(schema, "invalid expression", "", nil) + _, err := CreateSearchPlan(schema, "invalid expression", "", nil, nil) assert.Error(t, err) }) t.Run("invalid vector field", func(t *testing.T) { schema := newTestSchemaHelper(t) - _, err := CreateSearchPlan(schema, "Int64Field > 0", "not_exist", nil) + _, err := CreateSearchPlan(schema, "Int64Field > 0", "not_exist", nil, nil) assert.Error(t, err) }) t.Run("not vector type", func(t *testing.T) { schema := newTestSchemaHelper(t) - _, err := CreateSearchPlan(schema, "Int64Field > 0", "VarCharField", nil) + _, err := CreateSearchPlan(schema, "Int64Field > 0", "VarCharField", nil, nil) assert.Error(t, err) }) } @@ -754,7 +754,7 @@ func Test_JSONExpr(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) } } @@ -783,7 +783,7 @@ func Test_InvalidExprOnJSONField(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err, expr) } } @@ -820,7 +820,7 @@ func Test_InvalidExprWithoutJSONField(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err) } } @@ -857,7 +857,7 @@ func Test_InvalidExprWithMultipleJSONField(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err) } } @@ -878,7 +878,7 @@ func Test_exprWithSingleQuotes(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) } @@ -893,7 +893,7 @@ func Test_exprWithSingleQuotes(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err) } } @@ -927,7 +927,7 @@ func Test_JSONContains(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) } } @@ -958,7 +958,7 @@ func Test_InvalidJSONContains(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err) } } @@ -1021,7 +1021,7 @@ func Test_EscapeString(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) } @@ -1038,7 +1038,7 @@ c'`, MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err) fmt.Println(plan) } @@ -1064,7 +1064,7 @@ func Test_JSONContainsAll(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) assert.NotNil(t, plan.GetVectorAnns().GetPredicates().GetJsonContainsExpr()) assert.Equal(t, planpb.JSONContainsExpr_ContainsAll, plan.GetVectorAnns().GetPredicates().GetJsonContainsExpr().GetOp()) @@ -1085,7 +1085,7 @@ func Test_JSONContainsAll(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err) } } @@ -1110,7 +1110,7 @@ func Test_JSONContainsAny(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err) assert.NotNil(t, plan.GetVectorAnns().GetPredicates().GetJsonContainsExpr()) assert.Equal(t, planpb.JSONContainsExpr_ContainsAny, plan.GetVectorAnns().GetPredicates().GetJsonContainsExpr().GetOp()) @@ -1131,7 +1131,7 @@ func Test_JSONContainsAny(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err) } } @@ -1171,6 +1171,7 @@ func Test_ArrayExpr(t *testing.T) { `100 > ArrayField[0] > 0`, `ArrayField[0] > 1`, `ArrayField[0] == 1`, + `ArrayField in []`, } for _, expr = range exprs { _, err = CreateSearchPlan(schema, expr, "FloatVectorField", &planpb.QueryInfo{ @@ -1178,7 +1179,7 @@ func Test_ArrayExpr(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err, expr) } @@ -1197,7 +1198,6 @@ func Test_ArrayExpr(t *testing.T) { `ArrayField + 3 == 1`, `ArrayField in [1,2,3]`, `ArrayField[0] in [1, "abc",3.3]`, - `ArrayField in []`, `0 < ArrayField < 100`, `100 > ArrayField > 0`, `ArrayField > 1`, @@ -1213,7 +1213,7 @@ func Test_ArrayExpr(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err, expr) } } @@ -1241,7 +1241,7 @@ func Test_ArrayLength(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(t, err, expr) } @@ -1267,7 +1267,7 @@ func Test_ArrayLength(t *testing.T) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.Error(t, err, expr) } } @@ -1303,7 +1303,7 @@ func BenchmarkWithString(b *testing.B) { MetricType: "", SearchParams: "", RoundDecimal: 0, - }) + }, nil) assert.NoError(b, err) assert.NotNil(b, plan) } @@ -1324,3 +1324,30 @@ func Test_convertHanToASCII(t *testing.T) { assert.Equal(t, c.target, convertHanToASCII(c.source)) } } + +func BenchmarkTemplateWithString(b *testing.B) { + schema := newTestSchema() + schemaHelper, err := typeutil.CreateSchemaHelper(schema) + require.NoError(b, err) + + elements := make([]interface{}, 100) + for i := 0; i < 100; i++ { + elements[i] = generateExpressionFieldData(schemapb.DataType_String, fmt.Sprintf(`"%s",`, randomChineseString(rand.Intn(100)))) + } + expr := "StringField in {list}" + + mv := map[string]*schemapb.TemplateValue{ + "list": generateExpressionFieldData(schemapb.DataType_Array, elements), + } + + for i := 0; i < b.N; i++ { + plan, err := CreateSearchPlan(schemaHelper, expr, "FloatVectorField", &planpb.QueryInfo{ + Topk: 0, + MetricType: "", + SearchParams: "", + RoundDecimal: 0, + }, mv) + assert.NoError(b, err) + assert.NotNil(b, plan) + } +} diff --git a/internal/parser/planparserv2/utils.go b/internal/parser/planparserv2/utils.go index db87dcfa2b9fe..b358cc38f44fb 100644 --- a/internal/parser/planparserv2/utils.go +++ b/internal/parser/planparserv2/utils.go @@ -1,6 +1,7 @@ package planparserv2 import ( + "encoding/json" "fmt" "strconv" "strings" @@ -86,6 +87,19 @@ func NewString(value string) *planpb.GenericValue { } } +func toColumnExpr(info *planpb.ColumnInfo) *ExprWithType { + return &ExprWithType{ + expr: &planpb.Expr{ + Expr: &planpb.Expr_ColumnExpr{ + ColumnExpr: &planpb.ColumnExpr{ + Info: info, + }, + }, + }, + dataType: info.GetDataType(), + } +} + func toValueExpr(n *planpb.GenericValue) *ExprWithType { expr := &planpb.Expr{ Expr: &planpb.Expr_ValueExpr{ @@ -126,14 +140,7 @@ func toValueExpr(n *planpb.GenericValue) *ExprWithType { } } -func getSameType(left, right *ExprWithType) (schemapb.DataType, error) { - lDataType, rDataType := left.dataType, right.dataType - if typeutil.IsArrayType(lDataType) { - lDataType = toColumnInfo(left).GetElementType() - } - if typeutil.IsArrayType(rDataType) { - rDataType = toColumnInfo(right).GetElementType() - } +func getTargetType(lDataType, rDataType schemapb.DataType) (schemapb.DataType, error) { if typeutil.IsJSONType(lDataType) { if typeutil.IsJSONType(rDataType) { return schemapb.DataType_JSON, nil @@ -162,6 +169,17 @@ func getSameType(left, right *ExprWithType) (schemapb.DataType, error) { return schemapb.DataType_None, fmt.Errorf("incompatible data type, %s, %s", lDataType.String(), rDataType.String()) } +func getSameType(left, right *ExprWithType) (schemapb.DataType, error) { + lDataType, rDataType := left.dataType, right.dataType + if typeutil.IsArrayType(lDataType) { + lDataType = toColumnInfo(left).GetElementType() + } + if typeutil.IsArrayType(rDataType) { + rDataType = toColumnInfo(right).GetElementType() + } + return getTargetType(lDataType, rDataType) +} + func calcDataType(left, right *ExprWithType, reverse bool) (schemapb.DataType, error) { if reverse { return getSameType(right, left) @@ -223,47 +241,43 @@ func castValue(dataType schemapb.DataType, value *planpb.GenericValue) (*planpb. return nil, fmt.Errorf("cannot cast value to %s, value: %s", dataType.String(), value) } -func combineBinaryArithExpr(op planpb.OpType, arithOp planpb.ArithOpType, columnInfo *planpb.ColumnInfo, operand *planpb.GenericValue, value *planpb.GenericValue) *planpb.Expr { - dataType := columnInfo.GetDataType() - if typeutil.IsArrayType(dataType) && len(columnInfo.GetNestedPath()) != 0 { - dataType = columnInfo.GetElementType() - } - castedValue, err := castValue(dataType, operand) - if err != nil { - return nil - } +func combineBinaryArithExpr(op planpb.OpType, arithOp planpb.ArithOpType, columnInfo *planpb.ColumnInfo, arithExprDataType schemapb.DataType, operandExpr, valueExpr *planpb.ValueExpr) *planpb.Expr { return &planpb.Expr{ Expr: &planpb.Expr_BinaryArithOpEvalRangeExpr{ BinaryArithOpEvalRangeExpr: &planpb.BinaryArithOpEvalRangeExpr{ - ColumnInfo: columnInfo, - ArithOp: arithOp, - RightOperand: castedValue, - Op: op, - Value: value, + ColumnInfo: columnInfo, + ArithOp: arithOp, + RightOperand: operandExpr.GetValue(), + Op: op, + Value: valueExpr.GetValue(), + OperandTemplateVariableName: operandExpr.GetTemplateVariableName(), + ValueTemplateVariableName: valueExpr.GetTemplateVariableName(), }, }, + IsTemplate: isTemplateExpr(operandExpr) || isTemplateExpr(valueExpr), } } -func combineArrayLengthExpr(op planpb.OpType, arithOp planpb.ArithOpType, columnInfo *planpb.ColumnInfo, value *planpb.GenericValue) (*planpb.Expr, error) { +func combineArrayLengthExpr(op planpb.OpType, arithOp planpb.ArithOpType, columnInfo *planpb.ColumnInfo, valueExpr *planpb.ValueExpr) (*planpb.Expr, error) { return &planpb.Expr{ Expr: &planpb.Expr_BinaryArithOpEvalRangeExpr{ BinaryArithOpEvalRangeExpr: &planpb.BinaryArithOpEvalRangeExpr{ - ColumnInfo: columnInfo, - ArithOp: arithOp, - Op: op, - Value: value, + ColumnInfo: columnInfo, + ArithOp: arithOp, + Op: op, + Value: valueExpr.GetValue(), + ValueTemplateVariableName: valueExpr.GetTemplateVariableName(), }, }, }, nil } -func handleBinaryArithExpr(op planpb.OpType, arithExpr *planpb.BinaryArithExpr, valueExpr *planpb.ValueExpr) (*planpb.Expr, error) { +func handleBinaryArithExpr(op planpb.OpType, arithExpr *planpb.BinaryArithExpr, arithExprDataType schemapb.DataType, valueExpr *planpb.ValueExpr) (*planpb.Expr, error) { leftExpr, leftValue := arithExpr.Left.GetColumnExpr(), arithExpr.Left.GetValueExpr() rightExpr, rightValue := arithExpr.Right.GetColumnExpr(), arithExpr.Right.GetValueExpr() arithOp := arithExpr.GetOp() if arithOp == planpb.ArithOpType_ArrayLength { - return combineArrayLengthExpr(op, arithOp, leftExpr.GetInfo(), valueExpr.GetValue()) + return combineArrayLengthExpr(op, arithOp, leftExpr.GetInfo(), valueExpr) } if leftExpr != nil && rightExpr != nil { @@ -282,7 +296,7 @@ func handleBinaryArithExpr(op planpb.OpType, arithExpr *planpb.BinaryArithExpr, // a * 2 == 3 // a / 2 == 3 // a % 2 == 3 - return combineBinaryArithExpr(op, arithOp, leftExpr.GetInfo(), rightValue.GetValue(), valueExpr.GetValue()), nil + return combineBinaryArithExpr(op, arithOp, leftExpr.GetInfo(), arithExprDataType, rightValue, valueExpr), nil } else if rightExpr != nil && leftValue != nil { // 2 + a == 3 // 2 - a == 3 @@ -292,7 +306,7 @@ func handleBinaryArithExpr(op planpb.OpType, arithExpr *planpb.BinaryArithExpr, switch arithExpr.GetOp() { case planpb.ArithOpType_Add, planpb.ArithOpType_Mul: - return combineBinaryArithExpr(op, arithOp, rightExpr.GetInfo(), leftValue.GetValue(), valueExpr.GetValue()), nil + return combineBinaryArithExpr(op, arithOp, rightExpr.GetInfo(), arithExprDataType, leftValue, valueExpr), nil default: return nil, fmt.Errorf("module field is not yet supported") } @@ -307,13 +321,17 @@ func handleCompareRightValue(op planpb.OpType, left *ExprWithType, right *planpb if typeutil.IsArrayType(dataType) && len(toColumnInfo(left).GetNestedPath()) != 0 { dataType = toColumnInfo(left).GetElementType() } - castedValue, err := castValue(dataType, right.GetValue()) - if err != nil { - return nil, err + + if !left.expr.GetIsTemplate() && !isTemplateExpr(right) { + castedValue, err := castValue(dataType, right.GetValue()) + if err != nil { + return nil, err + } + right = &planpb.ValueExpr{Value: castedValue} } if leftArithExpr := left.expr.GetBinaryArithExpr(); leftArithExpr != nil { - return handleBinaryArithExpr(op, leftArithExpr, &planpb.ValueExpr{Value: castedValue}) + return handleBinaryArithExpr(op, leftArithExpr, left.dataType, right) } columnInfo := toColumnInfo(left) @@ -323,11 +341,13 @@ func handleCompareRightValue(op planpb.OpType, left *ExprWithType, right *planpb expr := &planpb.Expr{ Expr: &planpb.Expr_UnaryRangeExpr{ UnaryRangeExpr: &planpb.UnaryRangeExpr{ - ColumnInfo: columnInfo, - Op: op, - Value: castedValue, + ColumnInfo: columnInfo, + Op: op, + Value: right.GetValue(), + TemplateVariableName: right.GetTemplateVariableName(), }, }, + IsTemplate: isTemplateExpr(right), } switch op { @@ -342,6 +362,19 @@ func handleCompare(op planpb.OpType, left *ExprWithType, right *ExprWithType) (* leftColumnInfo := toColumnInfo(left) rightColumnInfo := toColumnInfo(right) + if left.expr.GetIsTemplate() { + return &planpb.Expr{ + Expr: &planpb.Expr_UnaryRangeExpr{ + UnaryRangeExpr: &planpb.UnaryRangeExpr{ + ColumnInfo: rightColumnInfo, + Op: op, + Value: left.expr.GetValueExpr().GetValue(), + TemplateVariableName: left.expr.GetValueExpr().GetTemplateVariableName(), + }, + }, + }, nil + } + if leftColumnInfo == nil || rightColumnInfo == nil { return nil, fmt.Errorf("only comparison between two fields is supported") } @@ -417,9 +450,11 @@ func getDataType(expr *ExprWithType) string { } func HandleCompare(op int, left, right *ExprWithType) (*planpb.Expr, error) { - if !canBeCompared(left, right) { - return nil, fmt.Errorf("comparisons between %s and %s are not supported", - getDataType(left), getDataType(right)) + if !left.expr.GetIsTemplate() && !right.expr.GetIsTemplate() { + if !canBeCompared(left, right) { + return nil, fmt.Errorf("comparisons between %s and %s are not supported", + getDataType(left), getDataType(right)) + } } cmpOp := cmpOpMap[op] @@ -521,23 +556,39 @@ func canArithmeticDataType(left, right schemapb.DataType) bool { } } -func canArithmetic(left *ExprWithType, right *ExprWithType) bool { - if !typeutil.IsArrayType(left.dataType) && !typeutil.IsArrayType(right.dataType) { - return canArithmeticDataType(left.dataType, right.dataType) +//func canArithmetic(left *ExprWithType, right *ExprWithType) bool { +// if !typeutil.IsArrayType(left.dataType) && !typeutil.IsArrayType(right.dataType) { +// return canArithmeticDataType(left.dataType, right.dataType) +// } +// if typeutil.IsArrayType(left.dataType) && typeutil.IsArrayType(right.dataType) { +// return canArithmeticDataType(getArrayElementType(left), getArrayElementType(right)) +// } +// if typeutil.IsArrayType(left.dataType) { +// return canArithmeticDataType(getArrayElementType(left), right.dataType) +// } +// return canArithmeticDataType(left.dataType, getArrayElementType(right)) +//} + +func canArithmetic(left, leftElement, right, rightElement schemapb.DataType) bool { + if !typeutil.IsArrayType(left) && !typeutil.IsArrayType(right) { + return canArithmeticDataType(left, right) } - if typeutil.IsArrayType(left.dataType) && typeutil.IsArrayType(right.dataType) { - return canArithmeticDataType(getArrayElementType(left), getArrayElementType(right)) + if typeutil.IsArrayType(left) && typeutil.IsArrayType(right) { + return canArithmeticDataType(leftElement, rightElement) } - if typeutil.IsArrayType(left.dataType) { - return canArithmeticDataType(getArrayElementType(left), right.dataType) + if typeutil.IsArrayType(left) { + return canArithmeticDataType(leftElement, right) } - return canArithmeticDataType(left.dataType, getArrayElementType(right)) + return canArithmeticDataType(left, rightElement) +} + +func canConvertToIntegerType(dataType, elementType schemapb.DataType) bool { + return typeutil.IsIntegerType(dataType) || typeutil.IsJSONType(dataType) || + (typeutil.IsArrayType(dataType) && typeutil.IsIntegerType(elementType)) } func isIntegerColumn(col *planpb.ColumnInfo) bool { - return typeutil.IsIntegerType(col.GetDataType()) || - (typeutil.IsArrayType(col.GetDataType()) && typeutil.IsIntegerType(col.GetElementType())) || - typeutil.IsJSONType(col.GetDataType()) + return canConvertToIntegerType(col.GetDataType(), col.GetElementType()) } func isEscapeCh(ch uint8) bool { @@ -561,3 +612,103 @@ func hexDigit(n uint32) byte { } return byte(n-10) + 'a' } + +func checkValidModArith(tokenType planpb.ArithOpType, leftType, leftElementType, rightType, rightElementType schemapb.DataType) error { + switch tokenType { + case planpb.ArithOpType_Mod: + if !canConvertToIntegerType(leftType, leftElementType) || !canConvertToIntegerType(rightType, rightElementType) { + return fmt.Errorf("modulo can only apply on integer types") + } + default: + } + return nil +} + +func checkRangeCompared(dataType schemapb.DataType, value *planpb.GenericValue) error { + switch dataType { + case schemapb.DataType_String, schemapb.DataType_VarChar: + if !IsString(value) { + return fmt.Errorf("invalid range operations") + } + case schemapb.DataType_Bool: + return fmt.Errorf("invalid range operations on boolean expr") + case schemapb.DataType_Int8, schemapb.DataType_Int16, schemapb.DataType_Int32, schemapb.DataType_Int64: + if !IsInteger(value) { + return fmt.Errorf("invalid range operations") + } + case schemapb.DataType_Float, schemapb.DataType_Double: + if !IsNumber(value) { + return fmt.Errorf("invalid range operations") + } + } + return nil +} + +func checkContainsElement(columnExpr *ExprWithType, op planpb.JSONContainsExpr_JSONOp, elementValue *planpb.GenericValue) error { + if op != planpb.JSONContainsExpr_Contains && elementValue.GetArrayVal() == nil { + return fmt.Errorf("%s operation element must be an array", op.String()) + } + + if typeutil.IsArrayType(columnExpr.expr.GetColumnExpr().GetInfo().GetDataType()) { + var elements []*planpb.GenericValue + if op == planpb.JSONContainsExpr_Contains { + elements = []*planpb.GenericValue{elementValue} + } else { + elements = elementValue.GetArrayVal().GetArray() + } + for _, value := range elements { + valExpr := toValueExpr(value) + if !canBeCompared(columnExpr, valExpr) { + return fmt.Errorf("%s operation can't compare between array element type: %s and %s", + op.String(), + columnExpr.expr.GetColumnExpr().GetInfo().GetElementType(), + valExpr.dataType) + } + } + } + return nil +} + +func parseJSONValue(value interface{}) (*planpb.GenericValue, schemapb.DataType, error) { + switch v := value.(type) { + case json.Number: + if intValue, err := v.Int64(); err == nil { + return NewInt(intValue), schemapb.DataType_Int64, nil + } else if floatValue, err := v.Float64(); err == nil { + return NewFloat(floatValue), schemapb.DataType_Double, nil + } else { + return nil, schemapb.DataType_None, fmt.Errorf("%v is a number, but couldn't convert it", value) + } + case string: + return NewString(v), schemapb.DataType_String, nil + case bool: + return NewBool(v), schemapb.DataType_Bool, nil + case []interface{}: + arrayElements := make([]*planpb.GenericValue, len(v)) + dataType := schemapb.DataType_None + sameType := true + for i, elem := range v { + ev, dt, err := parseJSONValue(elem) + if err != nil { + return nil, schemapb.DataType_None, err + } + if dataType == schemapb.DataType_None { + dataType = dt + } else if dataType != dt { + sameType = false + } + arrayElements[i] = ev + } + return &planpb.GenericValue{ + Val: &planpb.GenericValue_ArrayVal{ + ArrayVal: &planpb.Array{ + Array: arrayElements, + SameType: sameType, + ElementType: dataType, + }, + }, + }, schemapb.DataType_Array, nil + default: + return nil, schemapb.DataType_None, fmt.Errorf("%v is of unknown type: %T\n", value, v) + } +} diff --git a/internal/proto/plan.proto b/internal/proto/plan.proto index 294626f400c06..c74c5b8510b00 100644 --- a/internal/proto/plan.proto +++ b/internal/proto/plan.proto @@ -84,12 +84,14 @@ message ExistsExpr { message ValueExpr { GenericValue value = 1; + string template_variable_name = 2; } message UnaryRangeExpr { ColumnInfo column_info = 1; OpType op = 2; GenericValue value = 3; + string template_variable_name = 4; } message BinaryRangeExpr { @@ -98,6 +100,8 @@ message BinaryRangeExpr { bool upper_inclusive = 3; GenericValue lower_value = 4; GenericValue upper_value = 5; + string lower_template_variable_name = 6; + string upper_template_variable_name = 7; } message CompareExpr { @@ -110,6 +114,7 @@ message TermExpr { ColumnInfo column_info = 1; repeated GenericValue values = 2; bool is_in_field = 3; + string template_variable_name = 4; } message JSONContainsExpr { @@ -127,6 +132,7 @@ message JSONContainsExpr { } JSONOp op = 3; bool elements_same_type = 4; + string template_variable_name = 5; } message UnaryExpr { @@ -167,6 +173,8 @@ message BinaryArithOpEvalRangeExpr { GenericValue right_operand = 3; OpType op = 4; GenericValue value = 5; + string operand_template_variable_name = 6; + string value_template_variable_name = 7; } message AlwaysTrueExpr {} @@ -187,6 +195,7 @@ message Expr { AlwaysTrueExpr always_true_expr = 12; JSONContainsExpr json_contains_expr = 13; }; + bool is_template = 20; } message VectorANNS { diff --git a/internal/proxy/task.go b/internal/proxy/task.go index c1310052be50c..67cb6556d4e1b 100644 --- a/internal/proxy/task.go +++ b/internal/proxy/task.go @@ -54,6 +54,7 @@ const ( NQKey = "nq" MetricTypeKey = common.MetricTypeKey SearchParamsKey = "params" + ExprParamsKey = "expr_params" RoundDecimalKey = "round_decimal" OffsetKey = "offset" LimitKey = "limit" diff --git a/internal/proxy/task_delete.go b/internal/proxy/task_delete.go index 6c5a8e1297a49..451d9375c3442 100644 --- a/internal/proxy/task_delete.go +++ b/internal/proxy/task_delete.go @@ -367,7 +367,7 @@ func (dr *deleteRunner) Init(ctx context.Context) error { } func (dr *deleteRunner) Run(ctx context.Context) error { - plan, err := planparserv2.CreateRetrievePlan(dr.schema.schemaHelper, dr.req.GetExpr()) + plan, err := planparserv2.CreateRetrievePlan(dr.schema.schemaHelper, dr.req.GetExpr(), dr.req.GetExprTemplateValues()) if err != nil { return merr.WrapErrAsInputError(merr.WrapErrParameterInvalidMsg("failed to create delete plan: %v", err)) } diff --git a/internal/proxy/task_delete_test.go b/internal/proxy/task_delete_test.go index 657029001952f..99cd2e03e6c8c 100644 --- a/internal/proxy/task_delete_test.go +++ b/internal/proxy/task_delete_test.go @@ -53,7 +53,7 @@ func Test_getPrimaryKeysFromPlan(t *testing.T) { t.Run("delete with complex pk expr", func(t *testing.T) { expr := "pk < 4" - plan, err := planparserv2.CreateRetrievePlan(schema, expr) + plan, err := planparserv2.CreateRetrievePlan(schema, expr, nil) assert.NoError(t, err) isSimple, _, _ := getPrimaryKeysFromPlan(collSchema, plan) assert.False(t, isSimple) @@ -61,7 +61,7 @@ func Test_getPrimaryKeysFromPlan(t *testing.T) { t.Run("delete with no-pk field expr", func(t *testing.T) { expr := "non_pk == 1" - plan, err := planparserv2.CreateRetrievePlan(schema, expr) + plan, err := planparserv2.CreateRetrievePlan(schema, expr, nil) assert.NoError(t, err) isSimple, _, _ := getPrimaryKeysFromPlan(collSchema, plan) assert.False(t, isSimple) @@ -69,7 +69,7 @@ func Test_getPrimaryKeysFromPlan(t *testing.T) { t.Run("delete with simple term expr", func(t *testing.T) { expr := "pk in [1, 2, 3]" - plan, err := planparserv2.CreateRetrievePlan(schema, expr) + plan, err := planparserv2.CreateRetrievePlan(schema, expr, nil) assert.NoError(t, err) isSimple, _, rowNum := getPrimaryKeysFromPlan(collSchema, plan) assert.True(t, isSimple) @@ -78,7 +78,7 @@ func Test_getPrimaryKeysFromPlan(t *testing.T) { t.Run("delete failed with simple term expr", func(t *testing.T) { expr := "pk in [1, 2, 3]" - plan, err := planparserv2.CreateRetrievePlan(schema, expr) + plan, err := planparserv2.CreateRetrievePlan(schema, expr, nil) assert.NoError(t, err) termExpr := plan.Node.(*planpb.PlanNode_Query).Query.Predicates.Expr.(*planpb.Expr_TermExpr) termExpr.TermExpr.ColumnInfo.DataType = -1 @@ -89,7 +89,7 @@ func Test_getPrimaryKeysFromPlan(t *testing.T) { t.Run("delete with simple equal expr", func(t *testing.T) { expr := "pk == 1" - plan, err := planparserv2.CreateRetrievePlan(schema, expr) + plan, err := planparserv2.CreateRetrievePlan(schema, expr, nil) assert.NoError(t, err) isSimple, _, rowNum := getPrimaryKeysFromPlan(collSchema, plan) assert.True(t, isSimple) @@ -98,7 +98,7 @@ func Test_getPrimaryKeysFromPlan(t *testing.T) { t.Run("delete failed with simple equal expr", func(t *testing.T) { expr := "pk == 1" - plan, err := planparserv2.CreateRetrievePlan(schema, expr) + plan, err := planparserv2.CreateRetrievePlan(schema, expr, nil) assert.NoError(t, err) unaryRangeExpr := plan.Node.(*planpb.PlanNode_Query).Query.Predicates.Expr.(*planpb.Expr_UnaryRangeExpr) unaryRangeExpr.UnaryRangeExpr.ColumnInfo.DataType = -1 @@ -1054,7 +1054,7 @@ func TestDeleteRunner_StreamingQueryAndDelteFunc(t *testing.T) { schemaHelper, err := typeutil.CreateSchemaHelper(dr.schema.CollectionSchema) require.NoError(t, err) - plan, err := planparserv2.CreateRetrievePlan(schemaHelper, dr.req.Expr) + plan, err := planparserv2.CreateRetrievePlan(schemaHelper, dr.req.Expr, nil) assert.NoError(t, err) queryFunc := dr.getStreamingQueryAndDelteFunc(plan) assert.Error(t, queryFunc(ctx, 1, qn, "")) @@ -1099,7 +1099,7 @@ func TestDeleteRunner_StreamingQueryAndDelteFunc(t *testing.T) { schemaHelper, err := typeutil.CreateSchemaHelper(dr.schema.CollectionSchema) require.NoError(t, err) - plan, err := planparserv2.CreateRetrievePlan(schemaHelper, dr.req.Expr) + plan, err := planparserv2.CreateRetrievePlan(schemaHelper, dr.req.Expr, nil) assert.NoError(t, err) queryFunc := dr.getStreamingQueryAndDelteFunc(plan) assert.Error(t, queryFunc(ctx, 1, qn, "")) diff --git a/internal/proxy/task_query.go b/internal/proxy/task_query.go index dc2e2064a1347..56ceeb36cd3c7 100644 --- a/internal/proxy/task_query.go +++ b/internal/proxy/task_query.go @@ -189,7 +189,7 @@ func matchCountRule(outputs []string) bool { return len(outputs) == 1 && strings.ToLower(strings.TrimSpace(outputs[0])) == "count(*)" } -func createCntPlan(expr string, schemaHelper *typeutil.SchemaHelper) (*planpb.PlanNode, error) { +func createCntPlan(expr string, schemaHelper *typeutil.SchemaHelper, exprTemplateValues map[string]*schemapb.TemplateValue) (*planpb.PlanNode, error) { if expr == "" { return &planpb.PlanNode{ Node: &planpb.PlanNode_Query{ @@ -200,8 +200,7 @@ func createCntPlan(expr string, schemaHelper *typeutil.SchemaHelper) (*planpb.Pl }, }, nil } - - plan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr) + plan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr, exprTemplateValues) if err != nil { return nil, merr.WrapErrAsInputError(merr.WrapErrParameterInvalidMsg("failed to create query plan: %v", err)) } @@ -217,14 +216,14 @@ func (t *queryTask) createPlan(ctx context.Context) error { cntMatch := matchCountRule(t.request.GetOutputFields()) if cntMatch { var err error - t.plan, err = createCntPlan(t.request.GetExpr(), schema.schemaHelper) + t.plan, err = createCntPlan(t.request.GetExpr(), schema.schemaHelper, t.request.GetExprTemplateValues()) t.userOutputFields = []string{"count(*)"} return err } var err error if t.plan == nil { - t.plan, err = planparserv2.CreateRetrievePlan(schema.schemaHelper, t.request.Expr) + t.plan, err = planparserv2.CreateRetrievePlan(schema.schemaHelper, t.request.Expr, t.request.GetExprTemplateValues()) if err != nil { return merr.WrapErrAsInputError(merr.WrapErrParameterInvalidMsg("failed to create query plan: %v", err)) } diff --git a/internal/proxy/task_query_test.go b/internal/proxy/task_query_test.go index 592a90e0f32b5..32512706ff20d 100644 --- a/internal/proxy/task_query_test.go +++ b/internal/proxy/task_query_test.go @@ -867,7 +867,7 @@ func Test_matchCountRule(t *testing.T) { func Test_createCntPlan(t *testing.T) { t.Run("plan without filter", func(t *testing.T) { - plan, err := createCntPlan("", nil) + plan, err := createCntPlan("", nil, nil) assert.NoError(t, err) assert.True(t, plan.GetQuery().GetIsCount()) assert.Nil(t, plan.GetQuery().GetPredicates()) @@ -886,7 +886,7 @@ func Test_createCntPlan(t *testing.T) { } schemaHelper, err := typeutil.CreateSchemaHelper(schema) require.NoError(t, err) - plan, err := createCntPlan("a > 4", schemaHelper) + plan, err := createCntPlan("a > 4", schemaHelper, nil) assert.NoError(t, err) assert.True(t, plan.GetQuery().GetIsCount()) assert.NotNil(t, plan.GetQuery().GetPredicates()) diff --git a/internal/proxy/task_search.go b/internal/proxy/task_search.go index b93640e8d1f21..a6746f388f2ed 100644 --- a/internal/proxy/task_search.go +++ b/internal/proxy/task_search.go @@ -351,7 +351,7 @@ func (t *searchTask) initAdvancedSearchRequest(ctx context.Context) error { t.SearchRequest.SubReqs = make([]*internalpb.SubSearchRequest, len(t.request.GetSubReqs())) t.queryInfos = make([]*planpb.QueryInfo, len(t.request.GetSubReqs())) for index, subReq := range t.request.GetSubReqs() { - plan, queryInfo, offset, err := t.tryGeneratePlan(subReq.GetSearchParams(), subReq.GetDsl()) + plan, queryInfo, offset, err := t.tryGeneratePlan(subReq.GetSearchParams(), subReq.GetDsl(), subReq.GetExprTemplateValues()) if err != nil { return err } @@ -427,7 +427,7 @@ func (t *searchTask) initSearchRequest(ctx context.Context) error { log := log.Ctx(ctx).With(zap.Int64("collID", t.GetCollectionID()), zap.String("collName", t.collectionName)) // fetch search_growing from search param - plan, queryInfo, offset, err := t.tryGeneratePlan(t.request.GetSearchParams(), t.request.GetDsl()) + plan, queryInfo, offset, err := t.tryGeneratePlan(t.request.GetSearchParams(), t.request.GetDsl(), t.request.GetExprTemplateValues()) if err != nil { return err } @@ -473,7 +473,7 @@ func (t *searchTask) initSearchRequest(ctx context.Context) error { return nil } -func (t *searchTask) tryGeneratePlan(params []*commonpb.KeyValuePair, dsl string) (*planpb.PlanNode, *planpb.QueryInfo, int64, error) { +func (t *searchTask) tryGeneratePlan(params []*commonpb.KeyValuePair, dsl string, exprTemplateValues map[string]*schemapb.TemplateValue) (*planpb.PlanNode, *planpb.QueryInfo, int64, error) { annsFieldName, err := funcutil.GetAttrByKeyFromRepeatedKV(AnnsFieldKey, params) if err != nil || len(annsFieldName) == 0 { vecFields := typeutil.GetVectorFieldSchemas(t.schema.CollectionSchema) @@ -494,7 +494,8 @@ func (t *searchTask) tryGeneratePlan(params []*commonpb.KeyValuePair, dsl string if queryInfo.GetGroupByFieldId() != -1 && annField.GetDataType() == schemapb.DataType_BinaryVector { return nil, nil, 0, errors.New("not support search_group_by operation based on binary vector column") } - plan, planErr := planparserv2.CreateSearchPlan(t.schema.schemaHelper, dsl, annsFieldName, queryInfo) + + plan, planErr := planparserv2.CreateSearchPlan(t.schema.schemaHelper, dsl, annsFieldName, queryInfo, exprTemplateValues) if planErr != nil { log.Warn("failed to create query plan", zap.Error(planErr), zap.String("dsl", dsl), // may be very large if large term passed. diff --git a/internal/querynodev2/delegator/segment_pruner_test.go b/internal/querynodev2/delegator/segment_pruner_test.go index 220db6f026617..87698af76e36b 100644 --- a/internal/querynodev2/delegator/segment_pruner_test.go +++ b/internal/querynodev2/delegator/segment_pruner_test.go @@ -232,7 +232,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "age==156" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -249,7 +249,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "age!=156" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -266,7 +266,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "age in [100,200,300]" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -284,7 +284,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "age not in [100,200,300]" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -301,7 +301,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "age>=700" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -317,7 +317,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "age>=500 and age<=550" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -333,7 +333,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "500<=age<=550" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -350,7 +350,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "(age>=500 and age<=550) or (age>800 and age<950) or (age>300 and age<330)" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -368,7 +368,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "(age>=500 and age<=550) or (age>800 and age<950) or (age>300 and age<330) or age < 150" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -386,7 +386,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "age > 600 or age < 300" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -404,7 +404,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarIntField() { copy(testSegments, sps.sealedSegments) exprStr := "age > 600 or age < 30" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -429,7 +429,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithUnrelatedField() { exprStr := "age>=500 and age<=550 and info != 'xxx'" // as info is not cluster key field, so 'and' one more info condition will not influence the pruned result schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -447,7 +447,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithUnrelatedField() { exprStr := "age>=500 and info != 'xxx' and age<=550" // as info is not cluster key field, so 'and' one more info condition will not influence the pruned result schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -465,7 +465,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithUnrelatedField() { exprStr := "age>=500 and age<=550 or info != 'xxx'" // as info is not cluster key field, so 'or' one more will make it impossible to prune any segments schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -484,7 +484,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithUnrelatedField() { copy(testSegments, sps.sealedSegments) exprStr := "(age>=500 and age<=550) or info != 'xxx' or (age>800 and age<950) or (age>300 and age<330) or age < 50" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -503,7 +503,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithUnrelatedField() { copy(testSegments, sps.sealedSegments) exprStr := "(age>=500 and age<=550) and info != 'xxx' or (age>800 and age<950) or (age>300 and age<330) or age < 50" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -520,7 +520,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithUnrelatedField() { copy(testSegments, sps.sealedSegments) exprStr := "info in ['aa','bb','cc']" schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -544,7 +544,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarStrField() { copy(testSegments, sps.sealedSegments) exprStr := `info=="rag"` schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -562,7 +562,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarStrField() { copy(testSegments, sps.sealedSegments) exprStr := `info=="kpl"` schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -580,7 +580,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsByScalarStrField() { copy(testSegments, sps.sealedSegments) exprStr := `info<="less"` schemaHelper, _ := typeutil.CreateSchemaHelper(sps.schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -765,7 +765,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsVariousIntTypes() { copy(testSegments, sealedSegments) exprStr := "int8 > 128" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -781,7 +781,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsVariousIntTypes() { copy(testSegments, sealedSegments) exprStr := "int8 < -129" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -797,7 +797,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsVariousIntTypes() { copy(testSegments, sealedSegments) exprStr := "int8 > 50" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -914,7 +914,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsVariousIntTypes() { copy(testSegments, sealedSegments) exprStr := "int16 > 32768" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -930,7 +930,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsVariousIntTypes() { copy(testSegments, sealedSegments) exprStr := "int16 < -32769" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -945,7 +945,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsVariousIntTypes() { copy(testSegments, sealedSegments) exprStr := "int16 > 2550" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -1063,7 +1063,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsVariousIntTypes() { copy(testSegments, sealedSegments) exprStr := "int32 > 2147483648" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -1079,7 +1079,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsVariousIntTypes() { copy(testSegments, sealedSegments) exprStr := "int32 < -2147483649" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -1095,7 +1095,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsVariousIntTypes() { copy(testSegments, sealedSegments) exprStr := "int32 > 12550" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -1230,7 +1230,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsFloatTypes() { copy(testSegments, sealedSegments) exprStr := "float > 3.5" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -1347,7 +1347,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsFloatTypes() { copy(testSegments, sealedSegments) exprStr := "double < -1.5" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -1421,7 +1421,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithoutPartitionStats() { copy(testSegments, sealedSegments) exprStr := "double < -1.5" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -1441,7 +1441,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithoutPartitionStats() { copy(testSegments, sealedSegments) exprStr := "double < -1.5" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -1459,7 +1459,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithoutPartitionStats() { copy(testSegments, sealedSegments) exprStr := "double < -1.5" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ @@ -1537,7 +1537,7 @@ func (sps *SegmentPrunerSuite) TestPruneSegmentsWithoutPartitionStats() { copy(testSegments, sealedSegments) exprStr := "double < -1.5" schemaHelper, _ := typeutil.CreateSchemaHelper(schema) - planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr) + planNode, err := planparserv2.CreateRetrievePlan(schemaHelper, exprStr, nil) sps.NoError(err) serializedPlan, _ := proto.Marshal(planNode) queryReq := &internalpb.RetrieveRequest{ diff --git a/internal/util/exprutil/expr_checker_test.go b/internal/util/exprutil/expr_checker_test.go index c45be7ae548f8..4f500de954e0c 100644 --- a/internal/util/exprutil/expr_checker_test.go +++ b/internal/util/exprutil/expr_checker_test.go @@ -117,7 +117,7 @@ func TestParsePartitionKeys(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { // test search plan - searchPlan, err := planparserv2.CreateSearchPlan(schemaHelper, tc.expr, "fvec_field", queryInfo) + searchPlan, err := planparserv2.CreateSearchPlan(schemaHelper, tc.expr, "fvec_field", queryInfo, nil) assert.NoError(t, err) expr, err := ParseExprFromPlan(searchPlan) assert.NoError(t, err) @@ -130,7 +130,7 @@ func TestParsePartitionKeys(t *testing.T) { } // test query plan - queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, tc.expr) + queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, tc.expr, nil) assert.NoError(t, err) expr, err = ParseExprFromPlan(queryPlan) assert.NoError(t, err) @@ -173,7 +173,7 @@ func TestParseIntRanges(t *testing.T) { // test query plan { expr := "cluster_key_field > 50" - queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr) + queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr, nil) assert.NoError(t, err) planExpr, err := ParseExprFromPlan(queryPlan) assert.NoError(t, err) @@ -190,7 +190,7 @@ func TestParseIntRanges(t *testing.T) { // test binary query plan { expr := "cluster_key_field > 50 and cluster_key_field <= 100" - queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr) + queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr, nil) assert.NoError(t, err) planExpr, err := ParseExprFromPlan(queryPlan) assert.NoError(t, err) @@ -206,7 +206,7 @@ func TestParseIntRanges(t *testing.T) { // test binary query plan { expr := "cluster_key_field >= 50 and cluster_key_field < 100" - queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr) + queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr, nil) assert.NoError(t, err) planExpr, err := ParseExprFromPlan(queryPlan) assert.NoError(t, err) @@ -222,7 +222,7 @@ func TestParseIntRanges(t *testing.T) { // test binary query plan { expr := "cluster_key_field in [100]" - queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr) + queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr, nil) assert.NoError(t, err) planExpr, err := ParseExprFromPlan(queryPlan) assert.NoError(t, err) @@ -264,7 +264,7 @@ func TestParseStrRanges(t *testing.T) { // test query plan { expr := "cluster_key_field >= \"aaa\"" - queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr) + queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, expr, nil) assert.NoError(t, err) planExpr, err := ParseExprFromPlan(queryPlan) assert.NoError(t, err) @@ -477,7 +477,7 @@ func TestValidatePartitionKeyIsolation(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, tc.expr) + queryPlan, err := planparserv2.CreateRetrievePlan(schemaHelper, tc.expr, nil) assert.NoError(t, err) planExpr, err := ParseExprFromPlan(queryPlan) assert.NoError(t, err)