pitrou commented on a change in pull request #11368:
URL: https://github.com/apache/arrow/pull/11368#discussion_r745869824
##########
File path: python/pyarrow/tests/parquet/test_dataset.py
##########
@@ -449,7 +449,7 @@ def test_filters_inclusive_set(tempdir, use_legacy_dataset):
dataset = pq.ParquetDataset(
base_path, filesystem=fs,
filters=[('integer', 'in', [1]), ('string', 'in', ('a', 'b')),
- ('boolean', 'not in', {False})],
+ ('boolean', 'not in', {'False'})],
Review comment:
Hmm, interesting. Why does passing the right type work for integers but
not booleans?
##########
File path: cpp/src/arrow/compute/kernels/scalar_set_lookup.cc
##########
@@ -184,7 +184,27 @@ struct InitStateVisitor {
}
Result<std::unique_ptr<KernelState>> GetResult() {
- if (!options.value_set.type()->Equals(arg_type)) {
+ if (arg_type->id() == Type::TIMESTAMP &&
+ options.value_set.type()->id() == Type::TIMESTAMP) {
+ // Other types will fail when casting, so no separate check is needed
+ const auto& ty1 = checked_cast<const TimestampType&>(*arg_type);
+ const auto& ty2 = checked_cast<const
TimestampType&>(*options.value_set.type());
+ if (ty1.timezone().empty() ^ ty2.timezone().empty()) {
+ return Status::Invalid(
+ "Cannot compare timestamp with timezone to timestamp without
timezone, got: ",
+ ty1, " and ", ty2);
+ }
+ } else if (arg_type->id() == Type::STRING &&
+ !is_base_binary_like(options.value_set.type()->id())) {
+ // This is a bit of a hack, but don't implicitly cast from a non-binary
+ // type to string, since most types support casting to string and that
+ // may lead to surprises. However, we do want most other implicit casts.
Review comment:
Should this also check LARGE_STRING or are the casts to string only
defined for the "short" string type?
--
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]