Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0dfe2a1
update IsNullable
angelamayxie Dec 5, 2025
e9012e5
add TODO for absval
angelamayxie Dec 16, 2025
c380f14
update IsNullable for round
angelamayxie Dec 16, 2025
300e0b6
implement IsNullable for Collation, updated comments
angelamayxie Dec 16, 2025
e4e9c52
implement IsNullable for Coercibility and Charset, updated comments
angelamayxie Dec 16, 2025
ace8cd0
update IsNullable for concat_ws
angelamayxie Dec 16, 2025
65caf44
update IsNullable for conv
angelamayxie Dec 16, 2025
7e02537
update IsNullable for FromUnixtime
angelamayxie Dec 16, 2025
1d62334
implement IsNullable for ToDays
angelamayxie Dec 16, 2025
34a6652
updated comments
angelamayxie Dec 16, 2025
493d9fb
implement IsNullable for LastDay
angelamayxie Dec 16, 2025
a04fef9
refactor Round.IsNullable
angelamayxie Dec 16, 2025
5dbabc5
implement GetFormat.IsNullable
angelamayxie Dec 16, 2025
564a557
update hash functions
angelamayxie Dec 16, 2025
41964a2
update If.IsNullable
angelamayxie Dec 16, 2025
4e1b2b3
update IfNull.IsNullable
angelamayxie Dec 16, 2025
c9fd421
update IfNull.IsNullable
angelamayxie Dec 16, 2025
af9975b
fix typos in IP function comments
angelamayxie Dec 16, 2025
6dbf6f8
implement IsNullable for IsNull and IsBinary
angelamayxie Dec 16, 2025
0ea2992
update IsNullable for locks functions
angelamayxie Dec 16, 2025
d8e83e0
update Oct.IsNullable
angelamayxie Dec 16, 2025
ef31674
add TODOs for IsNullable in regex functions
angelamayxie Dec 16, 2025
15a8b52
update Sleep.IsNullable
angelamayxie Dec 16, 2025
7716f23
update IsNullable for sqrt and power functions
angelamayxie Dec 16, 2025
e1e3060
remove extraneous code in StrCmp.Eval
angelamayxie Dec 16, 2025
88e6d9d
update TimeFormat.IsNullable
angelamayxie Dec 17, 2025
e212dd2
check for null pattern in Trim.Eval
angelamayxie Dec 17, 2025
32790f6
update IsNullable for uuid functions
angelamayxie Dec 17, 2025
922a5af
update IsNullable in window functions
angelamayxie Dec 17, 2025
34c782a
update IsNullable for aggregation functions
angelamayxie Dec 17, 2025
39a2c77
cache type in arithmetic.IsNullable, fix typo in CollatedExpression
angelamayxie Dec 17, 2025
5862081
implement NullSafeEquals.IsNullable
angelamayxie Dec 17, 2025
b0e17f4
update Convert.IsNullable
angelamayxie Dec 17, 2025
b677173
update DistinctExpression.IsNullable
angelamayxie Dec 17, 2025
8ce117f
update IsNullable for div expressions
angelamayxie Dec 17, 2025
b185f3c
delete completely commented out file
angelamayxie Dec 17, 2025
bf7b803
update IsNullable for in expressions
angelamayxie Dec 17, 2025
28ef1cf
update HashInTuple.IsNullable
angelamayxie Dec 17, 2025
d28a17e
fix typo in comment
angelamayxie Dec 17, 2025
5d6a1c4
update logic operators
angelamayxie Dec 17, 2025
50f055a
undo changes made to And.Eval
angelamayxie Dec 17, 2025
4eefd12
merge
angelamayxie Dec 17, 2025
0f53048
update Mod.IsNullable
angelamayxie Dec 17, 2025
d582444
implement SetField.IsNullable
angelamayxie Dec 17, 2025
a162ead
update SystemVar.IsNullable
angelamayxie Dec 17, 2025
41b3066
update test query plans
angelamayxie Dec 17, 2025
a8fdc39
revert and update Convert.IsNullable based on conversion type
angelamayxie Dec 17, 2025
09b72ae
update uuid tests
angelamayxie Dec 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions enginetest/queries/script_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -9642,9 +9642,9 @@ where
{
Query: "describe t;",
Expected: []sql.Row{
{"port1", "bigint", "NO", "", nil, ""},
{"port2", "bigint", "NO", "", nil, ""},
{"port3", "bigint", "NO", "", nil, ""},
{"port1", "bigint", "YES", "", nil, ""},
{"port2", "bigint", "YES", "", nil, ""},
{"port3", "bigint", "YES", "", nil, ""},
},
},
},
Expand Down
3 changes: 2 additions & 1 deletion sql/expression/arithmetic.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ func (a *Arithmetic) DebugString() string {

// IsNullable implements the sql.Expression interface.
func (a *Arithmetic) IsNullable() bool {
if types.IsDatetimeType(a.Type()) || types.IsTimestampType(a.Type()) {
typ := a.Type()
if types.IsDatetimeType(typ) || types.IsTimestampType(typ) {
return true
}

Expand Down
2 changes: 1 addition & 1 deletion sql/expression/collatedexpr.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ sql.CollationCoercible = (*CollatedExpression)(nil)
var _ sql.DebugStringer = (*CollatedExpression)(nil)

// NewCollatedExpression creates a new CollatedExpression expression. If the given expression is already a
// CollatedExpression, then the previous collation is overriden with the given one.
// CollatedExpression, then the previous collation is overridden with the given one.
func NewCollatedExpression(expr sql.Expression, collation sql.CollationID) *CollatedExpression {
if collatedExpr, ok := expr.(*CollatedExpression); ok {
return &CollatedExpression{
Expand Down
5 changes: 5 additions & 0 deletions sql/expression/comparison.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ func (e *NullSafeEquals) Eval(ctx *sql.Context, row sql.Row) (interface{}, error
return result == 0, nil
}

// IsNullable implements sql.Expression
func (e *NullSafeEquals) IsNullable() bool {
return false
}

// WithChildren implements the Expression interface.
func (e *NullSafeEquals) WithChildren(children ...sql.Expression) (sql.Expression, error) {
if len(children) != 2 {
Expand Down
2 changes: 1 addition & 1 deletion sql/expression/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func GetConvertToType(l, r sql.Type) string {
// IsNullable implements the Expression interface.
func (c *Convert) IsNullable() bool {
switch c.castToType {
case ConvertToDate, ConvertToDatetime:
case ConvertToDate, ConvertToDatetime, ConvertToBinary, ConvertToChar, ConvertToNChar:
return true
default:
return c.Child.IsNullable()
Expand Down
2 changes: 1 addition & 1 deletion sql/expression/distinct.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (de *DistinctExpression) CollationCoercibility(ctx *sql.Context) (collation
}

func (de *DistinctExpression) IsNullable() bool {
return false
return true
}

// Returns the child value if the cache hasn't seen the value before otherwise returns nil.
Expand Down
4 changes: 2 additions & 2 deletions sql/expression/div.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (d *Div) DebugString() string {

// IsNullable implements the sql.Expression interface.
func (d *Div) IsNullable() bool {
return d.BinaryExpressionStub.IsNullable()
return true
}

// Type returns the result type for this division expression. For nested division expressions, we prefer sending
Expand Down Expand Up @@ -656,7 +656,7 @@ func (i *IntDiv) DebugString() string {

// IsNullable implements the sql.Expression interface.
func (i *IntDiv) IsNullable() bool {
return i.BinaryExpressionStub.IsNullable()
return true
}

// Type returns the greatest type for given operation.
Expand Down
117 changes: 0 additions & 117 deletions sql/expression/format.go

This file was deleted.

4 changes: 4 additions & 0 deletions sql/expression/function/absval.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func (t *AbsVal) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
return x.Abs(), nil
}

// TODO: Strings should truncate to float prefix. We should also check what other types return. But abs should not
// return null for non-null values
// https://github.com/dolthub/dolt/issues/10171
// https://dev.mysql.com/doc/refman/8.4/en/mathematical-functions.html#function_abs
return nil, nil
}

Expand Down
7 changes: 6 additions & 1 deletion sql/expression/function/aggregation/group_concat.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,12 @@ func (g *GroupConcat) Type() sql.Type {

// IsNullable implements the Expression interface.
func (g *GroupConcat) IsNullable() bool {
return false
for _, se := range g.selectExprs {
if !se.IsNullable() {
return false
}
}
return true
}

// Children implements the Expression interface.
Expand Down
2 changes: 1 addition & 1 deletion sql/expression/function/aggregation/json_agg.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (*JSONObjectAgg) CollationCoercibility(ctx *sql.Context) (collation sql.Col

// IsNullable implements the Expression interface.
func (j *JSONObjectAgg) IsNullable() bool {
return false
return true
}

// Children implements the Expression interface.
Expand Down
2 changes: 1 addition & 1 deletion sql/expression/function/aggregation/window/first_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (f *FirstValue) CollationCoercibility(ctx *sql.Context) (collation sql.Coll

// IsNullable implements sql.Expression
func (f *FirstValue) IsNullable() bool {
return false
return f.Child.IsNullable()
}

// Eval implements sql.Expression
Expand Down
2 changes: 1 addition & 1 deletion sql/expression/function/aggregation/window/last_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (f *LastValue) CollationCoercibility(ctx *sql.Context) (collation sql.Colla

// IsNullable implements sql.Expression
func (f *LastValue) IsNullable() bool {
return false
return f.Child.IsNullable()
}

// Eval implements sql.Expression
Expand Down
2 changes: 1 addition & 1 deletion sql/expression/function/ceil_round_floor.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func (r *Round) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {

// IsNullable implements the Expression interface.
func (r *Round) IsNullable() bool {
return r.Num.IsNullable() && (r == nil || r.Dec.IsNullable())
return r.Num.IsNullable() || (r.Dec != nil && r.Dec.IsNullable())
}

func (r *Round) String() string {
Expand Down
Loading
Loading