Skip to content

[vectorized][feature](planner)(executor)support grouping sets,rollup,cube(#7599) - #7601

Merged
HappenLee merged 1 commit into
apache:vectorizedfrom
anneji-dev:vectorized
Jan 17, 2022
Merged

HappenLee merged 1 commit into
apache:vectorizedfrom
anneji-dev:vectorized

Conversation

@anneji-dev

Copy link
Copy Markdown

Proposed changes

Close related #7599
Support grouping sets,rollup,cube

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • [x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Code refactor (Modify the code structure, format the code, etc...)
  • Optimization. Including functional usability improvements and performance improvements.
  • Dependency. Such as changes related to third-party components.
  • Other.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • [ x] I have created an issue on (Fix #ISSUE) and described the bug/feature there in detail
  • [ x] Compiling and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • If these changes need document changes, I have updated the document
  • Any dependent changes have been merged

Further comments

If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...

@morningman morningman added area/vectorization kind/feature Categorizes issue or PR as related to a new feature. labels Jan 5, 2022

@HappenLee HappenLee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some problem need to recheck

#include "vec/data_types/get_least_supertype.h"

namespace doris::vectorized {
class FunctionGroupingId : public IFunction {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the funcion GroupingId and Grouping is similar, you should do a union abstruct. like other funcion maybe the FunctionToNoNullableOneArgument

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok


Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
size_t result, size_t input_rows_count) override {
if (arguments.size() != 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No Need Check here, you set get_number_of_arguments() == 1

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok

bool src_is_nullable = src_column.type->is_nullable();
TypeIndex src_typeid = src_column.type->get_type_id();
TypeIndex res_typeid = rel_column.type->get_type_id();
if (res_typeid != TypeIndex::Int64)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no need check here, FE will promise the argment is bigint

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok

return Status::InternalError("Return type is not int64 of function grouping_id");

MutableColumnPtr res_column = rel_column.type->create_column();
if (src_is_nullable) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the argument may nullable ? maybe we should promise the argument is not nullable and DCHECK here

for (int i = 0; i < aggregateExprStartIndex; ++i) {
SlotDescriptor slot = aggOutTupleDescriptor.getSlots().get(i);
if (!slot.getIsNullable())
slot.setIsNullable(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why change the slot nullable ? give a problem case please

@HappenLee HappenLee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some little problem and rebase code again

Comment thread be/src/vec/exec/vrepeat_node.cpp Outdated
return Status::OK();
}

Status VRepeatNode::get_repeated_block(Block* child_block, int repeat_id_idx, Block* output_Block) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

output_Block -> output_block

Comment thread be/src/vec/exec/vrepeat_node.cpp Outdated
size_t column_size = _output_slots.size();
bool mem_reuse = output_Block->mem_reuse();
DCHECK_EQ(child_column_size, _child_slots.size());
DCHECK_LE(child_column_size, column_size);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LT replace LE ?

// set slot null not in repeat_ids
if (is_set_null_slot) {
for (size_t j = 0; j < src_column.column->size(); ++j) {
nullable_column->insert_data(nullptr, 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This code maybe can not SIMD? maybe should call resize function to set nullable_column size to SIMD

_repeat_id_idx++;

int size = _repeat_id_list.size();
if (_repeat_id_idx >= size) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why here reset the _child_block, call release_block_memory to reuse the mem of _child_block

#include "function_grouping.h"

namespace doris::vectorized {
void register_function_grouping(SimpleFunctionFactory& factory) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

void register_function_grouping(SimpleFunctionFactory& factory) {
factory.register_function();
factory.register_function();
}

@HappenLee
HappenLee merged commit d2f2210 into apache:vectorized Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/vectorization kind/feature Categorizes issue or PR as related to a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants