Skip to content

Propagation of ordered SortProperties should consider nulls_first #11596

Description

@jonahgao

Describe the bug

For binary expressions or multi-input functions , if their args are ordered but the nulls_first option in SortOptions differs, they are still very likely to be unordered.

For example, as pointed out by @2010YOUY01 in #11571 (comment)

Looks like the following logic is not completely correct 🤔 e.g. base is DESC NULLS FIRST num is ASC NULLS LAST This implementation will return log(base, num) is ASC NULLS LAST But the actual output might look like

NULL
NULL
1
2
NULL

Which is unordered.

To Reproduce

Need to examine the code.

  • The methods of SortProperties, such as add, sub, seem to not consider nulls_first.
  • Similar to log.rs (should be fixed in PR 11571), the implementation of ScalarUDFImpl::output_ordering also needs to be reviewed.

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions