Skip to content

Extracting geometry column from GeoParquet file streams the entire remote file #733

@glaroc

Description

@glaroc

Hi, I'm having a weird issue with a particular GeoParquet that I've created of protected areas of the world. Any time I try to get the geometry column through a query, it appears to stream the entire file, which is over 1GB.

LOAD SPATIAL;
CREATE OR REPLACE VIEW wdpa AS SELECT * FROM read_parquet("https://object-arbutus.cloud.computecanada.ca/bq-io/vectors-cloud/wdpa/wdpa.parquet");
CREATE OR REPLACE TABLE region AS SELECT * FROM 'https://data.fieldmaps.io/edge-matched/humanitarian/intl/adm1_polygons.parquet' WHERE adm0_src='CAN' and adm1_name='Quebec';`
CREATE OR REPLACE TABLE wdpa_region AS (WITH reg AS (
          SELECT
              geometry_bbox.xmin AS xmin_r,
              geometry_bbox.ymin AS ymin_r,
              geometry_bbox.xmax AS xmax_r,
              geometry_bbox.ymax AS ymax_r
          FROM region
      )
      SELECT w.*
      FROM wdpa w, reg r
      WHERE 
          bbox.xmax >= r.xmin_r AND
          bbox.xmin <= r.xmax_r AND
          bbox.ymin <= r.ymax_r AND
          bbox.ymax >= r.ymin_r);

This query should select 7487 out of 296046 polygons. If I SELECT SITE_ID, the query is very fast. If I SELECT w.* or SELECT geometry, then it is very slow and it appears that it is streaming well over 1GB of data, which is about the size of the WDPA parquet file. Any idea why that would be ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions