digital-guard / preserv

Digital Preservation Project
http://git.digital-guard.org/preserv
Apache License 2.0
0 stars 0 forks source link

ERROR: cannot call jsonb_each on a non-object #89

Closed 0e1 closed 2 years ago

0e1 commented 2 years ago

Averiaguar os motivos do jsonb estar null.

--- Gerando arquivos em /var/gits/_dg/preservCutGeo-BR2021/data/MG/Contagem/_pk0009.01/genericvia ---
psql postgres://postgres@localhost/ingest99 -c "SELECT ingest.publicating_geojsons('genericvia','BR-MG-Contagem','/var/gits/_dg/preservCutGeo-BR2021/data/MG/Contagem/_pk0009.01/genericvia','1');"
ERROR:  cannot call jsonb_each on a non-object
CONTEXT:  SQL statement "
          WITH t AS ( SELECT * FROM hcode_distribution_reduce_pre_raw('null'::jsonB, 1, 3, 100000, 2097152) )
--- Gerando arquivos em /var/gits/_dg/preservCutGeo-BR2021/data/PR/Pinhais/_pk0014.01/geoaddress ---
psql postgres://postgres@localhost/ingest99 -c "SELECT ingest.publicating_geojsons('geoaddress','BR-PR-Pinhais','/var/gits/_dg/preservCutGeo-BR2021/data/PR/Pinhais/_pk0014.01/geoaddress','1');"
ERROR:  cannot call jsonb_each on a non-object
CONTEXT:  SQL statement "
          WITH t AS ( SELECT * FROM hcode_distribution_reduce_pre_raw('null'::jsonB, 1, 4, 750, 8000) )
--- Gerando arquivos em /var/gits/_dg/preservCutGeo-BR2021/data/RS/Pelotas/_pk0080.01/genericvia ---
psql postgres://postgres@localhost/ingest99 -c "SELECT ingest.publicating_geojsons('genericvia','BR-RS-Pelotas','/var/gits/_dg/preservCutGeo-BR2021/data/RS/Pelotas/_pk0080.01/genericvia','1');"
ERROR:  cannot call jsonb_each on a non-object
CONTEXT:  SQL statement "
          WITH t AS ( SELECT * FROM hcode_distribution_reduce_pre_raw('null'::jsonB, 1, 2, 100000, 2097152) )

            SELECT hcode,
                   SUM(n_items)::int AS n_items,
                   round(AVG(mdn_items))::int AS mdn_items,
                   SUM(n_keys)::int AS n_keys,
                   NULL::jsonB as j
            FROM (
              -- Accepted rows:
              SELECT  *
              FROM t
              WHERE t.j IS NULL AND (100000 IS NULL OR n_items>=100000)

              UNION ALL

              -- Erode more (but can fail with no p_threshold_sum backtrack) and joins with accepted rows:
              SELECT *
              FROM hcode_distribution_reduce_recursive_raw(
                ( SELECT jsonb_object_agg(hcode,n_items) FROM t WHERE t.j IS NULL AND n_items<100000 ),
                  1,                            2,                      100000,                         2097152   , 3, (1+1)::smallint
              )

              UNION ALL

              -- Backtracking non-accepted rows:
                SELECT q.* FROM t,
                 LATERAL (   SELECT * FROM hcode_distribution_reduce_recursive_raw( t.j,   1,                            2,                      100000,                         2097152   , 3, (1+1)::smallint )   ) q
                WHERE t.j IS NOT NULL
            ) t2
            GROUP BY hcode ORDER BY hcode
         "
PL/pgSQL function hcode_distribution_reduce_recursive_raw(jsonb,integer,integer,integer,integer,integer,smallint) line 38 at RETURN QUERY
SQL function "hcode_distribution_reduce_recursive_raw" statement 1
SQL function "publicating_geojsons_p3" statement 2
SQL function "publicating_geojsons" statement 3
SQL function "publicating_geojsons" statement 1
make: *** [makefile:83: publicating_geojsons_genericvia] Error 1
0e1 commented 2 years ago

Problemas ocasionados pelo tipo do layer não ser compatível com a geometria, tendo como consequência a não ingestão e a ausência de dados para publicar. Foram ajustados os tipos.