Skip to content

Conversation

@carlvinhust2012
Copy link
Contributor

@carlvinhust2012 carlvinhust2012 commented Jul 28, 2022

Proposed changes

  1. this pr is used to optimize the array_distinct and array_sort function.

Issue Number: close #10052

Problem Summary:

Checklist(Required)

  1. Type of your changes:
    • Improvement
    • Fix
    • Feature-WIP
    • Feature
    • Doc
    • Refator
    • Others:
  2. Does it affect the original behavior:
    • Yes
    • No
    • I don't know
  3. Has unit tests been added:
    • Yes
    • No
    • No Need
  4. Has document been added or modified:
    • Yes
    • No
    • No Need
  5. Does it need to update dependencies:
    • Yes
    • No
  6. Are there any changes that cannot be rolled back:
    • Yes
    • No

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

Copy link
Member

@xy720 xy720 left a comment

Choose a reason for hiding this comment

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

There are still much duplicate code between function_array_sort.cpp and function_array_distinct.cpp. Is there any good idea to extract these code out?

}

auto res_val =
Impl::_execute_by_type(*src_nested_column, src_offsets, *dest_nested_column,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Impl::_execute_by_type(*src_nested_column, src_offsets, *dest_nested_column,
Impl::execute(*src_nested_column, src_offsets, *dest_nested_column,

I think execute is better. Because we may be add a function in future which don't need to classify the execute by type.

static bool _execute_string(const IColumn& src_column, const ColumnArray::Offsets& src_offsets,
IColumn& dest_column, ColumnArray::Offsets& dest_offsets,
const NullMapType* src_null_map, NullMapType* dest_null_map) {
const ColumnString* src_data_concrete = reinterpret_cast<const ColumnString*>(&src_column);
Copy link
Member

Choose a reason for hiding this comment

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

Duplicate with function_array_distinct.cpp
If it is hard to add an abstract method, you can put the duplicate code into function_array_utils.h and use a common util method instead.

return false;
}

ColumnString& dest_column_string = reinterpret_cast<ColumnString&>(dest_column);
Copy link
Member

Choose a reason for hiding this comment

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

Duplicate too.

@xy720 xy720 added kind/refactor Issues or PRs to refactor code area/array-type Issues or PRs related to array type labels Jul 29, 2022
@carlvinhust2012
Copy link
Contributor Author

There are still much duplicate code between function_array_sort.cpp and function_array_distinct.cpp. Is there any good idea to extract these code out?

ok,I will re-check again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/array-type Issues or PRs related to array type area/vectorization kind/refactor Issues or PRs to refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add lots of Array Functions

2 participants