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 list_sum and list_sort functions #1529

Merged
merged 1 commit into from
May 12, 2023

Conversation

gaurav8297
Copy link
Collaborator

@gaurav8297 gaurav8297 commented May 11, 2023

Added functions:

  1. list_sort(list)

Sorts the elements of the list.

Examples:

-- default sort order and default NULL sort order
Return list_sort([1, 3, NULL, 5, NULL, -5])
----
[NULL, NULL, -5, 1, 3, 5]

-- only providing the sort order
Return list_sort([1, 3, NULL, 2], 'ASC')
----
[NULL, 1, 2, 3]

-- providing the sort order and the NULL sort order
Return list_sort([1, 3, NULL, 2], 'DESC', 'NULLS FIRST')
----
[NULL, 3, 2, 1]
  1. list_sum(list)

Returns the sum of all elements in the list

@codecov
Copy link

codecov bot commented May 11, 2023

Codecov Report

Patch coverage: 92.30% and no project coverage change.

Comparison is base (4f02b2d) 91.95% compared to head (31d9516) 91.96%.

❗ Current head 31d9516 differs from pull request most recent head f987264. Consider uploading reports for the commit f987264 to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1529    +/-   ##
========================================
  Coverage   91.95%   91.96%            
========================================
  Files         687      689     +2     
  Lines       24502    24665   +163     
========================================
+ Hits        22532    22683   +151     
- Misses       1970     1982    +12     
Impacted Files Coverage Δ
src/function/vector_list_operation.cpp 90.32% <88.52%> (-0.59%) ⬇️
...ude/function/list/operations/list_sort_operation.h 95.45% <95.45%> (ø)
src/function/built_in_vector_operations.cpp 96.02% <100.00%> (+0.02%) ⬆️
...lude/function/list/operations/list_sum_operation.h 100.00% <100.00%> (ø)
src/include/function/list/vector_list_operations.h 97.36% <100.00%> (+0.14%) ⬆️
src/include/function/unary_operation_executor.h 72.22% <100.00%> (+1.63%) ⬆️

... and 13 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@gaurav8297 gaurav8297 changed the title [WIP] Add list_sum and list_sort functions Add list_sum and list_sort functions May 11, 2023
@gaurav8297 gaurav8297 marked this pull request as ready for review May 11, 2023 17:36
Copy link
Collaborator

@acquamarin acquamarin left a comment

Choose a reason for hiding this comment

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

  1. See my comment about refactoring the list_sort operation.
  2. Add more tests to improve test coverages.
  3. We already have an orderBy operator which implements our own sorting algorithm. We should reuse the orderBy operator inside list_sort. Can you open an issue about this?

@gaurav8297 gaurav8297 merged commit be74276 into kuzudb:master May 12, 2023
7 checks passed
@gaurav8297 gaurav8297 deleted the list_sort_functions branch May 12, 2023 14:37
@andyfengHKU andyfengHKU mentioned this pull request May 29, 2023
14 tasks
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

2 participants