-
Notifications
You must be signed in to change notification settings - Fork 420
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
[VL] Support Decimal type in Gluten #1176
Conversation
Thanks for opening a pull request! Could you open an issue for this pull request on Github Issues? https://github.com/oap-project/gluten/issues Then could you also rename commit message and pull request title in the following format?
See also: |
4151b91
to
44e6e3c
Compare
|
||
import org.apache.spark.sql.catalyst.expressions.Expression | ||
|
||
class UnscaledValueTransformer( |
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.
Please move this transformer to UnaryExpressionTransformer.scala
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.
it can reuse UnaryExpressionTransformer and don't need to create a new one, right ?
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.
Yes
case class UnscaledValue(child: Expression) extends UnaryExpression
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.
@liujiayi771 Can you help to resolve this comment? Thanks.
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 have removed these codes.
@zzcclp This patch enabled several decimal related expressions, CK backend ran into seg faults in some tests. Can you take a look?
|
@taiyang-li please help to review this pr, it's about decimal type support |
val decimalType = datatype.asInstanceOf[DecimalType] | ||
val precision = decimalType.precision | ||
val scale = decimalType.scale | ||
typedFuncName.concat("dec<" + precision + "," + scale + ">") |
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.
It seems like needs to support this name for ch backend. @taiyang-li
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, let's do it
@JkSelf there are two issues related to clickhouse backend AFAIK:
|
val expressionNodes = | ||
Lists.newArrayList(childNode, new BooleanLiteralNode(original.nullOnOverflow)) | ||
Lists.newArrayList(childNode, toTypeNodes, new BooleanLiteralNode(original.nullOnOverflow)) |
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.
Why do you need to pass the parameter toTypeNodes
, there is already a return type in the substrait plan.
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.
@jinchengchenghh Can you help to check whether we can use the return type directly in the substrait plan?
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.
This is from CheckOverflow
constructor, velox should use it to match function signature, and decide if it is ShortDecimal
or LongDecimal
, so as MakeDecimal
. This is a special case, the input argument is same with return type, but I think we should not do some exceptional thing when convert substrait plan to velox plan
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.
@JkSelf @jinchengchenghh Maybe we can do this special logic only when backend is velox, or just append toTypeNodes
after nullOnOverflow
instead before it. Currently CH didn't need toTypeNodes
, those changes would cause an incompatiability issue as in CH uts.
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, I will move it after nullOnOverflow
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.
Please add comment 'test by CH[[378]]'.
Kyligence/ClickHouse#378
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.
Can you merge this one Kyligence/ClickHouse#378? So this PR can pass CH CI
@jinchengchenghh Can you help to look this suggestion about |
@@ -41,7 +41,9 @@ object CHExpressionUtil { | |||
SPLIT_PART -> Set(EMPTY_TYPE), | |||
TO_UNIX_TIMESTAMP -> Set(DATE_TYPE), | |||
UNIX_TIMESTAMP -> Set(DATE_TYPE), | |||
MIGHT_CONTAIN -> Set(EMPTY_TYPE) | |||
MIGHT_CONTAIN -> Set(EMPTY_TYPE), |
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.
@taiyang-li Please help to review. Thanks.
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.
LGTM
For the 2,
It extends |
bde4e51
to
14e89e0
Compare
14e89e0
to
ee887b3
Compare
@zzcclp @taiyang-li |
Add comment 'test by CH[[378]]' |
test by CH[[378]] |
ee887b3
to
9a5fbdd
Compare
@JkSelf |
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.
👍
9a5fbdd
to
630cba9
Compare
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.
👍 if CI is green
What changes were proposed in this pull request?
Co-working by @JkSelf @liujiayi771 @jinchengchenghh @rui-mo
How was this patch tested?
Verified TPC-DS 103 queries locally.
test by CH[[378]]