xushiyan commented on code in PR #170:
URL: https://github.com/apache/hudi-rs/pull/170#discussion_r1799846644
##########
crates/core/src/table/partition.rs:
##########
@@ -265,13 +265,34 @@ impl PartitionFilter {
safe: false,
format_options: Default::default(),
};
+
+ let value = match data_type {
+ DataType::Date32 => Self::trim_single_quotes(value),
+ DataType::Date64 => Self::trim_single_quotes(value),
+ DataType::Utf8 => Self::trim_single_quotes(value),
+ DataType::LargeUtf8 => Self::trim_single_quotes(value),
+ DataType::Utf8View => Self::trim_single_quotes(value),
+ _ => *value,
+ };
+
let value = StringArray::from(Vec::from(value));
+
Ok(Scalar::new(cast_with_options(
&value,
data_type,
&cast_options,
)?))
}
+
+ fn trim_single_quotes<'a>(s: &'a [&'a str; 1]) -> [&'a str; 1] {
+ let trimmed = s[0]
+ .strip_prefix('\'')
+ .unwrap_or(s[0])
+ .strip_suffix('\'')
+ .unwrap_or(s[0]);
Review Comment:
this does not complain when value is not wrapped with `'`. like it's
accepting `foo'`, `'foo`, or `foo`. can you follow and check what would be
valid in like spark sql and datafusion?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]