paleolimbot commented on code in PR #173:
URL: https://github.com/apache/sedona-db/pull/173#discussion_r2399507687
##########
rust/sedona-geoparquet/src/format.rs:
##########
@@ -364,15 +364,21 @@ impl GeoParquetFileSource {
predicate: Option<Arc<dyn PhysicalExpr>>,
) -> Result<Self> {
if let Some(parquet_source) =
inner.as_any().downcast_ref::<ParquetSource>() {
- let mut parquet_source = parquet_source.clone();
+ let parquet_source = parquet_source.clone();
// Extract the predicate from the existing source if it exists so
we can keep a copy of it
let new_predicate = match (parquet_source.predicate().cloned(),
predicate) {
(None, None) => None,
(None, Some(specified_predicate)) => Some(specified_predicate),
(Some(inner_predicate), None) => Some(inner_predicate),
- (Some(_), Some(specified_predicate)) => {
- parquet_source =
parquet_source.with_predicate(specified_predicate.clone());
- Some(specified_predicate)
+ (Some(inner_predicate), Some(specified_predicate)) => {
+ // Sanity check: predicate in `GeoParquetFileSource` is
init
+ // from its inner ParquetSource's predicate, they should be
+ // equivalent.
+ if Arc::ptr_eq(&inner_predicate, &specified_predicate) {
Review Comment:
I personally like the stricter check...I'm confident that our test suite
covers the usage that we need to support!
##########
rust/sedona/tests/metrics.rs:
##########
@@ -0,0 +1,97 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+use datafusion::arrow::util::pretty::pretty_format_batches;
+use sedona::context::SedonaContext;
+
+#[tokio::test]
+async fn geo_parquet_metrics() {
Review Comment:
It's true that all of our other pruning tests are in sedona-geoparquet (for
better or worse! The top level sedona crate didn't exist when I wrote them..).
We don't have access to a real `ST_Intersects()` there but we do have a fake
one to test pruning:
https://github.com/apache/sedona-db/blob/a15844b4ff9c7e9416b8f1c1c07ad81d908a89cd/rust/sedona-geoparquet/src/format.rs#L684-L686
I'd prefer to keep the pruning tests together in sedona-geoparquet but also
happy to have some integration-y tests here if there's some technical reason
they can't live there 🙂
##########
rust/sedona/tests/metrics.rs:
##########
@@ -0,0 +1,97 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+use datafusion::arrow::util::pretty::pretty_format_batches;
+use sedona::context::SedonaContext;
+
+#[tokio::test]
+async fn geo_parquet_metrics() {
+ // Setup and register test table
+ // -----------------------------
+ let ctx = SedonaContext::new_local_interactive()
+ .await
+ .expect("interactive context should initialize");
+
+ let geo_parquet_path =
"../../submodules/sedona-testing/data/parquet/geoparquet-1.1.0.parquet";
Review Comment:
We have a helper for this one (mostly to give an actionable error if
somebody forgot to initialize the submodules):
https://github.com/apache/sedona-db/blob/a15844b4ff9c7e9416b8f1c1c07ad81d908a89cd/rust/sedona-testing/src/data.rs#L43-L48
--
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]