Taepper commented on code in PR #46926:
URL: https://github.com/apache/arrow/pull/46926#discussion_r2726555077
##########
ruby/red-arrow/lib/arrow/sort-key.rb:
##########
@@ -156,32 +157,49 @@ def initialize(target, order=nil)
#
# @since 4.0.0
def to_s
- if order == SortOrder::ASCENDING
+ result = if order == SortOrder::ASCENDING
"+#{target}"
else
"-#{target}"
end
+ if null_placement == NullPlacement::AT_START
+ result += "_at_start"
+ else
+ result += "_at_end"
+ end
+ return result
end
# For backward compatibility
alias_method :name, :target
private
- def normalize_target(target, order)
+ def normalize_target(target, order, null_placement)
+ # for recreatable, we should remove suffix
+ if target.end_with?("_at_start")
+ suffix_length = "_at_start".length
+ target = target[0..-(suffix_length + 1)]
+ elsif target.end_with?("_at_end")
+ suffix_length = "_at_end".length
+ target = target[0..-(suffix_length + 1)]
+ end
Review Comment:
In this example, the `^` is part of the target name. (sort order and
null-placement are only parsed from the beginning of the target if not
explicitly given)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]