You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/25 02:29:04 UTC
[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #3245: support decimal data type for the optimizer rule of PreCastLitInComparisonExpressions
liukun4515 commented on code in PR #3245:
URL: https://github.com/apache/arrow-datafusion/pull/3245#discussion_r954444739
##########
datafusion/optimizer/src/pre_cast_lit_in_comparison.rs:
##########
@@ -200,47 +160,110 @@ fn is_comparison_op(op: &Operator) -> bool {
}
fn is_support_data_type(data_type: &DataType) -> bool {
- // TODO support decimal with other data type
matches!(
data_type,
- DataType::Int8 | DataType::Int16 | DataType::Int32 | DataType::Int64
+ DataType::Int8
+ | DataType::Int16
+ | DataType::Int32
+ | DataType::Int64
+ | DataType::Decimal128(_, _)
)
}
-fn can_integer_literal_cast_to_type(
- integer_lit_value: &ScalarValue,
+fn try_cast_literal_to_type(
+ lit_value: &ScalarValue,
target_type: &DataType,
-) -> Result<bool> {
- if integer_lit_value.is_null() {
+) -> Result<(bool, Option<ScalarValue>)> {
Review Comment:
good suggestion.
Done for your comments.
PTAL @andygrove
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org