2010YOUY01 commented on code in PR #560:
URL: https://github.com/apache/sedona-db/pull/560#discussion_r2758212663
##########
rust/sedona-geoparquet/src/provider.rs:
##########
@@ -213,23 +244,32 @@ impl ReadOptions<'_> for GeoParquetReadOptions<'_> {
let mut options = self.inner.to_listing_options(config, table_options);
if let Some(parquet_format) =
options.format.as_any().downcast_ref::<ParquetFormat>() {
- let geoparquet_options = parquet_format.options().clone().into();
+ let mut geoparquet_options =
+ TableGeoParquetOptions::from(parquet_format.options().clone());
+ if let Some(geometry_columns) = &self.geometry_columns {
+ geoparquet_options.geometry_columns =
Some(geometry_columns.clone());
+ }
options.format =
Arc::new(GeoParquetFormat::new(geoparquet_options));
return options;
}
unreachable!("GeoParquetReadOptions with non-ParquetFormat
ListingOptions");
}
+ /// Infer schema from GeoParquet metadata, then apply the user option
+ /// `geometry_columns` from `read_parquet()` to override if provided. See
the
+ /// Python DataFrame `read_parquet(..)` documentation for details.
Review Comment:
Cleaned up in
[dd75822](https://github.com/apache/sedona-db/pull/560/commits/dd75822c1bf9e39c17e68ad3c2a70f8c19542acb)
##########
python/sedonadb/tests/test_context.py:
##########
@@ -14,10 +14,37 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+import json
+from pathlib import Path
+from typing import Any, Mapping
+
import geoarrow.pyarrow as ga # noqa: F401
import pyarrow as pa
+import pyarrow.parquet as pq
import pytest
import sedonadb
+import shapely
+
+
+def _parse_geo_metadata(geoparquet_path: Path) -> Mapping[str, Any]:
+ """Return the GeoParquet "geo" metadata map, asserting it exists."""
+ metadata = pq.read_metadata(geoparquet_path).metadata
+ assert metadata is not None
+
+ geo = metadata.get(b"geo")
+ assert geo is not None
+
+ return json.loads(geo.decode("utf-8"))
Review Comment:
[dd75822](https://github.com/apache/sedona-db/pull/560/commits/dd75822c1bf9e39c17e68ad3c2a70f8c19542acb)
--
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]