-
Notifications
You must be signed in to change notification settings - Fork 49
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
Conversation
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.
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; |
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.
What is the type of reuslt? Maybe accumulated type should be used for the result here.
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.
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());
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.
Fixed
Yes, you are right, it is controled by ansi enabled |
Mark here, after switch to spark function, we should check AverageAggregate and select add numeric overflow format |
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
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
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
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
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
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
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
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
* 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
No description provided.