Skip to content

ORC-1460: Update ORC spec to clarify how dictionary entries are sorted - #1561

Closed
progval wants to merge 1 commit into
apache:mainfrom
progval:spec-sort
Closed

progval wants to merge 1 commit into
apache:mainfrom
progval:spec-sort

Conversation

@progval

@progval progval commented Jul 5, 2023 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

The spec is updated to clarify that dictionary entries are sorted based on the UTF-8 encoding, not on any of the Unicode Collation algorithms.

Why are the changes needed?

Not strictly needed, but I had a moment of doubt when reading the spec, and had to check the implementation.

How was this patch tested

This matches the C++ implementation:

orc/c++/src/ColumnWriter.cc

Lines 913 to 923 in 294a5e2

struct LessThan {
bool operator()(const DictEntry& left, const DictEntry& right) const {
int ret = memcmp(left.data, right.data, std::min(left.length, right.length));
if (ret != 0) {
return ret < 0;
}
return left.length < right.length;
}
};
std::map<DictEntry, size_t, LessThan> dict;

ie. that they are sorted based on the UTF-8 encoding, not on any of the
Unicode Collation algorithms.
@github-actions github-actions Bot added the DOCS label Jul 5, 2023
@dongjoon-hyun

Copy link
Copy Markdown
Member

Could you make an Apache ORC JIRA and use it for this PR? Or, we can use MINOR instead of JIRA ID like the following.

MINOR: Clarify how dictionary entries are sorted in ORC specs

@progval progval changed the title specification: Clarify how dictionary entries are sorted ORC-1460: specification: Clarify how dictionary entries are sorted Jul 6, 2023
@progval

progval commented Jul 6, 2023

Copy link
Copy Markdown
Contributor Author

Done

@dongjoon-hyun dongjoon-hyun changed the title ORC-1460: specification: Clarify how dictionary entries are sorted ORC-1460: Update ORC spec to clarify how dictionary entries are sorted Jul 6, 2023

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM.

@wgtmac wgtmac closed this in fb93ed9 Jul 7, 2023
cxzl25 pushed a commit to cxzl25/orc that referenced this pull request Jan 11, 2024
### What changes were proposed in this pull request?

The spec is updated to clarify that dictionary entries are sorted based on the UTF-8 encoding, not on any of the Unicode Collation algorithms.

### Why are the changes needed?

Not strictly needed, but I had a moment of doubt when reading the spec, and had to check the implementation.

### How was this patch tested

This matches the C++ implementation:

https://github.com/apache/orc/blob/294a5e28f7f0420eb1fdc76dffc33608692c1b20/c%2B%2B/src/ColumnWriter.cc#L913-L923

Closes apache#1561 from progval/spec-sort.

Authored-by: Valentin Lorentz <vlorentz@softwareheritage.org>
Signed-off-by: Gang Wu <ustcwg@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants