-
Notifications
You must be signed in to change notification settings - Fork 38
[Function] support vec hex #206
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
Conversation
be/src/vec/functions/function.h
Outdated
|
|
||
| void get_lambda_argument_types(DataTypes& arguments) const override { | ||
| check_number_of_arguments(arguments.size()); | ||
| // check_number_of_arguments(arguments.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注释代码直接删除了,不要留注释
48888fa to
c4dc213
Compare
c4dc213 to
aec440d
Compare
HappenLee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有一些小问题,得修改一下
be/src/vec/data_types/data_type.h
Outdated
| using DataTypePtr = std::shared_ptr<const IDataType>; | ||
| using DataTypes = std::vector<DataTypePtr>; | ||
|
|
||
| struct defaultDataTypes{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
类需要首字母大写
| *res = hexDigits[(src_str[i] >> 4) & 0x0F]; | ||
| std::copy(res, res + 2, dst_str + 2 * i); | ||
| } | ||
| return 2*length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
符号需要空格哈
| }; | ||
|
|
||
| // support hex variadic | ||
| struct hexStringDataTypes{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
| } | ||
|
|
||
| DataTypes get_variadic_argument_types_impl() const override{ | ||
| return argument_types::types; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是应该和name一样放在Impl类里面,这样扩展模板容易导致类膨胀的问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不能这样,像name那种写法的话,使用这个类的非重载函数都需要实现一遍。用这种默认参数的形式,其他代码不需要改动。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你让所有使用这个类的Impl统一继承一个公共类就行了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
提交的这一版是未使用SFINAE方式的版本
| if (iter != function_creators.end()) { | ||
| return iter->second()->build(arguments, return_type); | ||
| } | ||
| LOG(INFO) << "get_function() return nullptr in simple_function_factory.h"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不要打日志了,直接DCHECK吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
| '_ZN5doris13MathFunctions5unhexEPN9doris_udf15FunctionContextERKNS1_9StringValE', '', '', 'vec', ''], | ||
| [['unhex'], 'STRING', ['STRING'], | ||
| '_ZN5doris13MathFunctions5unhexEPN9doris_udf15FunctionContextERKNS1_9StringValE', '', '', '', ''], | ||
| '_ZN5doris13MathFunctions5unhexEPN9doris_udf15FunctionContextERKNS1_9StringValE', '', '', 'vec', ''], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数我看源码是always nullable的?
825a84d to
12d42d5
Compare
HappenLee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有一些小的格式问题, 改一下,一些没用的代码删除一下
be/src/vec/functions/function.h
Outdated
| public: | ||
| FunctionBasePtr build(const ColumnsWithTypeAndName& arguments, const DataTypePtr& return_type) const final { | ||
|
|
||
| if(!return_type->equals(*get_return_type(arguments))){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
符合之间需要空格,你这个代码是调试的吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯是的,我删一下
08f1f02 to
a265c31
Compare
* support function hex, fix hex(0)=0, fix unhex bug, support nullable. * format code and delete debug code.
* support function hex, fix hex(0)=0, fix unhex bug, support nullable. * format code and delete debug code.
Proposed changes
1.使用了支持函数重载的注册逻辑 #201 ,支持hex对int和string两种类型参数
2.相比之前关闭的pr,vec版本也修复了hex(0)=0的bug,apache/doris#6837
3.相比之前关闭的pr,使得向量化和非向量化的hex函数对于相同输入,输出保持一致
Types of changes
What types of changes does your code introduce to Doris?
Put an
xin the boxes that applyChecklist
Put an
xin 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.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...