Skip to content

Commit 0157795

Browse files
committed
refactor(expression): remove unnecessary UnknownCoercion
Refs: #1648
1 parent 93d0f7c commit 0157795

1 file changed

Lines changed: 0 additions & 57 deletions

File tree

server/expression/implicit_cast.go

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -32,63 +32,6 @@ type ImplicitCast struct {
3232

3333
var _ sql.Expression = (*ImplicitCast)(nil)
3434

35-
// UnknownCoercion wraps an expression with unknown type to coerce it to a target type.
36-
// Unlike ImplicitCast, this doesn't perform any actual conversion - it just changes the
37-
// reported type since unknown type literals can coerce to any type in PostgreSQL.
38-
type UnknownCoercion struct {
39-
expr sql.Expression
40-
toType *pgtypes.DoltgresType
41-
}
42-
43-
var _ sql.Expression = (*UnknownCoercion)(nil)
44-
45-
// NewUnknownCoercion returns a new *UnknownCoercion expression.
46-
func NewUnknownCoercion(expr sql.Expression, toType *pgtypes.DoltgresType) *UnknownCoercion {
47-
return &UnknownCoercion{
48-
expr: expr,
49-
toType: toType,
50-
}
51-
}
52-
53-
// Children implements the sql.Expression interface.
54-
func (uc *UnknownCoercion) Children() []sql.Expression {
55-
return []sql.Expression{uc.expr}
56-
}
57-
58-
// Eval implements the sql.Expression interface.
59-
func (uc *UnknownCoercion) Eval(ctx *sql.Context, row sql.Row) (any, error) {
60-
// Just pass through - unknown type values can coerce to any type
61-
return uc.expr.Eval(ctx, row)
62-
}
63-
64-
// IsNullable implements the sql.Expression interface.
65-
func (uc *UnknownCoercion) IsNullable() bool {
66-
return uc.expr.IsNullable()
67-
}
68-
69-
// Resolved implements the sql.Expression interface.
70-
func (uc *UnknownCoercion) Resolved() bool {
71-
return uc.expr.Resolved()
72-
}
73-
74-
// String implements the sql.Expression interface.
75-
func (uc *UnknownCoercion) String() string {
76-
return uc.expr.String()
77-
}
78-
79-
// Type implements the sql.Expression interface.
80-
func (uc *UnknownCoercion) Type() sql.Type {
81-
return uc.toType
82-
}
83-
84-
// WithChildren implements the sql.Expression interface.
85-
func (uc *UnknownCoercion) WithChildren(children ...sql.Expression) (sql.Expression, error) {
86-
if len(children) != 1 {
87-
return nil, sql.ErrInvalidChildrenNumber.New(uc, len(children), 1)
88-
}
89-
return NewUnknownCoercion(children[0], uc.toType), nil
90-
}
91-
9235
// NewImplicitCast returns a new *ImplicitCast expression.
9336
func NewImplicitCast(expr sql.Expression, fromType *pgtypes.DoltgresType, toType *pgtypes.DoltgresType) *ImplicitCast {
9437
toType = checkForDomainType(toType)

0 commit comments

Comments
 (0)