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

Spark sum can overflow #101

Merged
merged 2 commits into from
Dec 21, 2022
Merged

Spark sum can overflow #101

merged 2 commits into from
Dec 21, 2022

Conversation

jinchengchenghh
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@rui-mo rui-mo left a comment

Choose a reason for hiding this comment

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

I found the behaviour may depend on a Spark config to throw or not. Maybe we can use this fix for now, and in the long term, we can consider to implement sum under spark sql folder to resolves the differences.

std::is_same_v<TData, double> || std::is_same_v<TData, float>) {
std::is_same_v<TData, double> || std::is_same_v<TData, float> ||
std::is_same_v<TData, int8_t> || std::is_same_v<TData, int16_t> ||
std::is_same_v<TData, int32_t> || std::is_same_v<TData, int64_t>) {
result += value;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the type of reuslt? Maybe accumulated type should be used for the result here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like the accumalted types for int8/int16/int32 are all int64. Maybe we only need to handle int64 here.

          case TypeKind::TINYINT:
            return std::make_unique<T<int8_t, int64_t, int64_t>>(BIGINT());
          case TypeKind::SMALLINT:
            return std::make_unique<T<int16_t, int64_t, int64_t>>(BIGINT());
          case TypeKind::INTEGER:
            return std::make_unique<T<int32_t, int64_t, int64_t>>(BIGINT());
          case TypeKind::BIGINT:
            return std::make_unique<T<int64_t, int64_t, int64_t>>(BIGINT());

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@jinchengchenghh
Copy link
Collaborator Author

Yes, you are right, it is controled by ansi enabled

@rui-mo rui-mo merged commit 1b7344b into oap-project:main Dec 21, 2022
@jinchengchenghh
Copy link
Collaborator Author

jinchengchenghh commented Dec 22, 2022

Mark here, after switch to spark function, we should check AverageAggregate and select add numeric overflow format

zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Jan 3, 2023
zhejiangxiaomai pushed a commit that referenced this pull request Jan 11, 2023
zhejiangxiaomai pushed a commit that referenced this pull request Jan 11, 2023
zhejiangxiaomai pushed a commit that referenced this pull request Jan 31, 2023
zhejiangxiaomai pushed a commit that referenced this pull request Feb 22, 2023
zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Feb 27, 2023
zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Mar 6, 2023
zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Mar 27, 2023
zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Mar 29, 2023
zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Mar 29, 2023
zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Apr 14, 2023
zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Apr 17, 2023
zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Apr 19, 2023
zhejiangxiaomai pushed a commit to zhejiangxiaomai/velox that referenced this pull request Apr 20, 2023
zhejiangxiaomai added a commit to zhejiangxiaomai/velox that referenced this pull request May 31, 2023
relative pr:

Fix replace SparkSQL function oap-project#277
Support kPreceeding & kFollowing for window range frame type oap-project#287
support timestamp hash oap-project#269
Spark sum can overflow oap-project#101
Support float & double types in pmod function oap-project#157
Implement datetime functions in velox/sparksql. oap-project#81
Fix type check in MapFunction oap-project#273
Let function validation fail for lookaround pattern in RE2-based implementation oap-project#124
Register lpad/rpad functions for Spark SQL. oap-project#63
Support substring_index sql function oap-project#189
Fix First/Last aggregate functions intermediate type and support decimal oap-project#245
Support date_add spark sql function oap-project#144
zhejiangxiaomai added a commit to zhejiangxiaomai/velox that referenced this pull request May 31, 2023
relative pr:

Fix replace SparkSQL function oap-project#277
Support kPreceeding & kFollowing for window range frame type oap-project#287
support timestamp hash oap-project#269
Spark sum can overflow oap-project#101
Support float & double types in pmod function oap-project#157
Implement datetime functions in velox/sparksql. oap-project#81
Fix type check in MapFunction oap-project#273
Let function validation fail for lookaround pattern in RE2-based implementation oap-project#124
Register lpad/rpad functions for Spark SQL. oap-project#63
Support substring_index sql function oap-project#189
Fix First/Last aggregate functions intermediate type and support decimal oap-project#245
Support date_add spark sql function oap-project#144
zhejiangxiaomai added a commit to zhejiangxiaomai/velox that referenced this pull request Jul 3, 2023
relative pr:

Fix replace SparkSQL function oap-project#277
Support kPreceeding & kFollowing for window range frame type oap-project#287
support timestamp hash oap-project#269
Spark sum can overflow oap-project#101
Support float & double types in pmod function oap-project#157
Implement datetime functions in velox/sparksql. oap-project#81
Fix type check in MapFunction oap-project#273
Let function validation fail for lookaround pattern in RE2-based implementation oap-project#124
Register lpad/rpad functions for Spark SQL. oap-project#63
Support substring_index sql function oap-project#189
Fix First/Last aggregate functions intermediate type and support decimal oap-project#245
Support date_add spark sql function oap-project#144
zhejiangxiaomai added a commit to zhejiangxiaomai/velox that referenced this pull request Jul 4, 2023
relative pr:

Fix replace SparkSQL function oap-project#277
Support kPreceeding & kFollowing for window range frame type oap-project#287
support timestamp hash oap-project#269
Spark sum can overflow oap-project#101
Support float & double types in pmod function oap-project#157
Implement datetime functions in velox/sparksql. oap-project#81
Fix type check in MapFunction oap-project#273
Let function validation fail for lookaround pattern in RE2-based implementation oap-project#124
Register lpad/rpad functions for Spark SQL. oap-project#63
Support substring_index sql function oap-project#189
Fix First/Last aggregate functions intermediate type and support decimal oap-project#245
Support date_add spark sql function oap-project#144
zhejiangxiaomai added a commit to zhejiangxiaomai/velox that referenced this pull request Jul 11, 2023
relative pr:

Fix replace SparkSQL function oap-project#277
Support kPreceeding & kFollowing for window range frame type oap-project#287
support timestamp hash oap-project#269
Spark sum can overflow oap-project#101
Support float & double types in pmod function oap-project#157
Implement datetime functions in velox/sparksql. oap-project#81
Fix type check in MapFunction oap-project#273
Let function validation fail for lookaround pattern in RE2-based implementation oap-project#124
Register lpad/rpad functions for Spark SQL. oap-project#63
Support substring_index sql function oap-project#189
Fix First/Last aggregate functions intermediate type and support decimal oap-project#245
Support date_add spark sql function oap-project#144
zhejiangxiaomai added a commit to zhejiangxiaomai/velox that referenced this pull request Jul 12, 2023
relative pr:

Fix replace SparkSQL function oap-project#277
Support kPreceeding & kFollowing for window range frame type oap-project#287
support timestamp hash oap-project#269
Spark sum can overflow oap-project#101
Support float & double types in pmod function oap-project#157
Implement datetime functions in velox/sparksql. oap-project#81
Fix type check in MapFunction oap-project#273
Let function validation fail for lookaround pattern in RE2-based implementation oap-project#124
Register lpad/rpad functions for Spark SQL. oap-project#63
Support substring_index sql function oap-project#189
Fix First/Last aggregate functions intermediate type and support decimal oap-project#245
Support date_add spark sql function oap-project#144
zhejiangxiaomai added a commit to zhejiangxiaomai/velox that referenced this pull request Jul 12, 2023
relative pr:

Fix replace SparkSQL function oap-project#277
Support kPreceeding & kFollowing for window range frame type oap-project#287
support timestamp hash oap-project#269
Spark sum can overflow oap-project#101
Support float & double types in pmod function oap-project#157
Implement datetime functions in velox/sparksql. oap-project#81
Fix type check in MapFunction oap-project#273
Let function validation fail for lookaround pattern in RE2-based implementation oap-project#124
Register lpad/rpad functions for Spark SQL. oap-project#63
Support substring_index sql function oap-project#189
Fix First/Last aggregate functions intermediate type and support decimal oap-project#245
Support date_add spark sql function oap-project#144
zhejiangxiaomai added a commit to zhejiangxiaomai/velox that referenced this pull request Jul 17, 2023
relative pr:

Fix replace SparkSQL function oap-project#277
Support kPreceeding & kFollowing for window range frame type oap-project#287
support timestamp hash oap-project#269
Spark sum can overflow oap-project#101
Support float & double types in pmod function oap-project#157
Implement datetime functions in velox/sparksql. oap-project#81
Fix type check in MapFunction oap-project#273
Let function validation fail for lookaround pattern in RE2-based implementation oap-project#124
Register lpad/rpad functions for Spark SQL. oap-project#63
Support substring_index sql function oap-project#189
Fix First/Last aggregate functions intermediate type and support decimal oap-project#245
Support date_add spark sql function oap-project#144
marin-ma pushed a commit to marin-ma/velox-oap that referenced this pull request Dec 15, 2023
* port to master

* port shuffle and enable fake arrow result

* remove InputRel and use ReadRel instead

* refine setting fake arrow format

* use velox-to-row converter for velox backend
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.

2 participants