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 natural sorting (aka version sort) #6256

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lapo-luchini
Copy link
Contributor

@lapo-luchini lapo-luchini commented May 11, 2024

Describe Your Changes

Add natural sorting, closes #6192.

PR currently complete:

Checklist

The following checks are mandatory:

TODO: add docs.
TODO: "vendor" change should be done upstream.

Signed-off-by: Lapo Luchini <lapo@lapo.it>
Copy link

codecov bot commented May 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.16%. Comparing base (8aaa828) to head (d58ef50).
Report is 662 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6256      +/-   ##
==========================================
- Coverage   60.37%   57.16%   -3.21%     
==========================================
  Files         411      536     +125     
  Lines       76609    73114    -3495     
==========================================
- Hits        46253    41799    -4454     
- Misses      27794    28388     +594     
- Partials     2562     2927     +365     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Add disambiguation example to numeric sort (1.10 < 1.2).

Signed-off-by: Lapo Luchini <lapo@lapo.it>
lapo-luchini added a commit to lapo-luchini/metricsql that referenced this pull request May 12, 2024
Linked to [VM PR #6256](VictoriaMetrics/VictoriaMetrics#6256)

Signed-off-by: Lapo Luchini <lapo@lapo.it>
@lapo-luchini
Copy link
Contributor Author

These files seems to be duplicate:

  • app/vmui/packages/vmui/src/assets/MetricsQL.md
  • docs/MetricsQL.md
    I originally modified only the first, but now I'm duplicating the patch to the latter too.

Signed-off-by: Lapo Luchini <lapo@lapo.it>
@lapo-luchini lapo-luchini changed the title Add natural sorting Add natural sorting (aka version sort) May 12, 2024
valyala added a commit that referenced this pull request May 13, 2024
Natural sorting is needed for sort_by_label_natural() and sort_by_label_natural_desc()
functions in MetricsQL - see #6192
and #6256

Natural sorting will be also used by `| sort ...` pipe in VictoriaLogs -
see https://docs.victoriametrics.com/victorialogs/logsql/#sort-pipe
hagen1778 pushed a commit that referenced this pull request May 13, 2024
Natural sorting is needed for sort_by_label_natural() and sort_by_label_natural_desc()
functions in MetricsQL - see #6192
and #6256

Natural sorting will be also used by `| sort ...` pipe in VictoriaLogs -
see https://docs.victoriametrics.com/victorialogs/logsql/#sort-pipe

(cherry picked from commit 707f3a6)
@valyala
Copy link
Collaborator

valyala commented May 13, 2024

@lapo-luchini , please use stringsutil.LessNatural for natural sorting.

These files seems to be duplicate:

app/vmui/packages/vmui/src/assets/MetricsQL.md
docs/MetricsQL.md
I originally modified only the first, but now I'm duplicating the patch to the latter too.

The first one is automatically copied from the second one when running make vmui-update. This command updates js bundle for vmui. This js bundle includes the the app/vmui/packages/vmui/src/assets/MetricsQL.md for displaying suggestions for MetricsQL functions when the user types function names in the query input field.

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.

Strange bug in numeric sorting (natural sorting)
2 participants