Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C++ aggregator for sort #349

Draft
wants to merge 6 commits into
base: future
Choose a base branch
from
Draft

Add C++ aggregator for sort #349

wants to merge 6 commits into from

Conversation

janekb04
Copy link
Collaborator

@janekb04 janekb04 commented Oct 5, 2021

I started implementing the C++ aggregator for FreeBSD that corresponds to sort. It doesn't support any flags and doesn't pass the unit test yet. It passes the basic unit test now (the version with no flags). The flags that are yet to be implemented:

  • u. Sort in unique mode
  • n. Sort treating lines as numbers (remember about leading minus, decimal point or comma and thousands separator)
  • r. Reverse sort direction
  • k[...]. Sort by columns
  • f. toupper before sorting
  • b. Ignore whitespace at the beginning of a line
  • d. "consider only blanks and alphanumeric characters"

There are also some other options, but they don't seem as easy to implement at first glance. All of the options above are also supported in FreeBSD and are the same. One thing that could be tricky is dealing with locales.

@janekb04
Copy link
Collaborator Author

janekb04 commented Oct 5, 2021

I also realized that for some reason libdash updated by itself. I'm not sure if this is wanted or not.

@janekb04 janekb04 changed the base branch from main to future October 5, 2021 14:47
Signed-off-by: Jan Bielak <[email protected]>
@janekb04
Copy link
Collaborator Author

janekb04 commented Oct 5, 2021

@nvasilakis Now the simple sort aggregator works. It passes the unit test. It is basically the merge step from mergesort. Implementing support for sort flags should be straightforward, but will take some time due to their amount. I plan to do this using either higher-order functions or polymorphism. I will see what will be easier and more performant.

@janekb04
Copy link
Collaborator Author

janekb04 commented Oct 5, 2021

I updated the main comment with some notes and an option to-do list for better organization.

@nvasilakis
Copy link
Collaborator

Hi @janekb04 are you planning on completing this so that we merge it into mainline?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants