//
//Equal - Return true if the two values are equivalent, in the RDL sense.
//
165153
func Equal(val1 interface{}, val2 interface{}) bool {
	if val1 == nil || val2 == nil {
		return false
	}
	switch v1 := val1.(type) {
	case UUID:
		if v2, ok := val2.(UUID); ok {
			return v1.Equal(v2)
		}
		return false
	case Timestamp:
		if v2, ok := val2.(Timestamp); ok {
			return v1.Equal(v2)
		}
		return false
	case Array:
		if v2, ok := val2.(Array); ok {
			return v1.Equal(v2)
		}
		return false
	case Struct:
		if v2, ok := val2.(Struct); ok {
			return v1.Equal(v2)
		}
		return false
	case Symbol:
		if v2, ok := val2.(Symbol); ok {
			return v1 == v2
		}
		return false
	case int, int32, int8, int16, int64, float32, float64, uint, uint8, uint16, uint32, uint64:
		return val1 == val2
	case bool:
		return val1 == val2
	case string:
		if v2, ok := val2.(string); ok {
			return v1 == v2
		}
		return false
	case []byte:
		if v2, ok := val2.([]byte); ok {
			return bytes.Compare(v1, v2) == 0
		}
		return false
	default:
		fmt.Println(val1)
		fmt.Println(val2)
		fmt.Println("fix Equal of these two types")
		panic("fix Equal of these two types")
	}
}
781968
func (l *Statement) Equal(r *Statement) bool {
	if l.Effect != r.Effect {
		return false
	}
	if !l.Action.Equal(r.Action) {
		return false
	}
	if !l.Resource.Equal(r.Resource) {
		return false
	}
	return true
}
488907
func (o *SortFacetValuesByOption) Equal(o2 *SortFacetValuesByOption) bool {
	if o2 == nil {
		return o.value == "count"
	}
	return o.value == o2.value
}
494811
func (o *MinWordSizefor2TyposOption) Equal(o2 *MinWordSizefor2TyposOption) bool {
	if o2 == nil {
		return o.value == 8
	}
	return o.value == o2.value
}
31507
func (o *QueryTypeOption) Equal(o2 *QueryTypeOption) bool {
	if o2 == nil {
		return o.value == "prefixLast"
	}
	return o.value == o2.value
}
604508
func (o *UserTokenOption) Equal(o2 *UserTokenOption) bool {
	if o2 == nil {
		return o.value == ""
	}
	return o.value == o2.value
}
1163065
func (o *AnchoringOption) Equal(o2 *AnchoringOption) bool {
	if o2 == nil {
		return o.value == ""
	}
	return o.value == o2.value
}
977983
func (h *PortRuleL7) Equal(o PortRuleL7) bool {
	if len(*h) != len(o) {
		return false
	}
	for k, v := range *h {
		if v2, ok := o[k]; !ok || v2 != v {
			return false
		}
	}
	return true
}
135309
func (o *PageOption) Equal(o2 *PageOption) bool {
	if o2 == nil {
		return o.value == 0
	}
	return o.value == o2.value
}
409015
func (s1 Int64) Equal(s2 Int64) bool {
	return len(s1) == len(s2) && s1.IsSuperset(s2)
}
1072146
func (v *Oid) Equal(o *Oid) bool {
	if o == nil {
		return false
	}
	return v.Value.Equal(o.Value)
}
1128336
func Equal(l, r interface{}) bool {
	if l == nil || r == nil {
		return false
	}
	switch val := l.(type) {
	case *Error:
		return val.Equal(r)
	case error:
		return newError(val, 2).(*Error).Equal(r)
	default:
		panic("invalid type, must be *Error")
	}
}
232028
func (self StringEqualer) Equal(e Equaler) bool {
	return self.S == e.(StringEqualer).S
}
461380
func (o *KeepDiacriticsOnCharactersOption) Equal(o2 *KeepDiacriticsOnCharactersOption) bool {
	if o2 == nil {
		return o.value == ""
	}
	return o.value == o2.value
}
1310540
func (s1 Int) Equal(s2 Int) bool {
	return len(s1) == len(s2) && s1.IsSuperset(s2)
}
370880
func (c *Constant) Equal(b Expression, ctx context.Context) bool {
	y, ok := b.(*Constant)
	if !ok {
		return false
	}
	con, err := c.Value.CompareDatum(ctx.GetSessionVars().StmtCtx, y.Value)
	if err != nil || con != 0 {
		return false
	}
	return true
}
758733
func (o *ExactOnSingleWordQueryOption) Equal(o2 *ExactOnSingleWordQueryOption) bool {
	if o2 == nil {
		return o.value == "attribute"
	}
	return o.value == o2.value
}