digital-guard / preserv

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

ERROR: too few arguments for format() #132

Closed 0e1 closed 1 year ago

0e1 commented 1 year ago

A ingestão do layer nsvia de BR-MG-Contagem/_pk0009.01 e dos layers parcel e building de BR-SP-SaoPaulo/_pk0033.01 resultou nos erros

psql postgres://postgres@localhost/ingest42 -c "SELECT ingest.any_load('gdb2sql','/tmp/sandbox/_pk7600000901_001/OpenStreetMap.gdb/random_data_file','nsvia_full','pk7600000901101_p1_nsvia','7600000901101','058a6022054e8b3f9ba81f25f7511b58cbd4ad616b0510033b917f3f7f9f23d5.rar',array['OBJECTID AS gid', 'Teste2_P_1 AS nsvia', 'geom'],5,1)"
ERROR:  too few arguments for format()
CONTEXT:  SQL function "any_load_returnmsg" statement 1
PL/pgSQL function ingest.any_load(text,text,text,text,bigint,text,text[],integer,integer,boolean,text,boolean,text,text) line 304 at RETURN
make: *** [makefile:244: nsvia] Error 1

e

ERROR:  too few arguments for format()
CONTEXT:  SQL function "any_load_returnmsg" statement 1
PL/pgSQL function ingest.any_load(text,text,text,text,bigint,text,text[],integer,integer,boolean,text,boolean,text,text) line 304 at RETURN
psql postgres://postgres@localhost/ingest42 -c "SELECT ingest.any_load_assign('$(find /tmp/sandbox/_pk7600003301_001 -path "*SIRGAS_SHP_LOTES*.shp" | head -n 1)','parcel_ext','7600003301201' )"

ERROR:  too few arguments for format()
CONTEXT:  SQL function "any_load_returnmsg" statement 1
PL/pgSQL function ingest.any_load(text,text,text,text,bigint,text,text[],integer,integer,boolean,text,boolean,text,text) line 304 at RETURN
psql postgres://postgres@localhost/ingest42 -c "SELECT ingest.any_load_assign('$(find /tmp/sandbox/_pk7600003301_001 -path "*SIRGAS_SHP_edificacao*.shp" | head -n 1)','building_none','7600003301101' )"
0e1 commented 1 year ago

No caso de nsvia de BR-MG-Contagem/_pk0009.01 a função any_load_returnmsg tinha problemas pois a ingestão do layer não resulta em nenhuma geometria em _featureasis, conforme se vê no output da ingestão:

psql postgres://postgres@localhost/ingest55 -c "SELECT ingest.any_load('gdb2sql','/tmp/sandbox/_pk7600000901_001/OpenStreetMap.gdb/random_data_file','nsvia_full','pk7600000901101_p1_nsvia','7600000901101','058a6022054e8b3f9ba81f25f7511b58cbd4ad616b0510033b917f3f7f9f23d5.rar',array['OBJECTID AS gid', 'Teste2_P_1 AS nsvia', 'geom'],5,1)"
                                              any_load                                              
----------------------------------------------------------------------------------------------------
 Statistics from file_id=40 (nsvia_full of 7600000901101 of BR-MG-Contagem) in ingest.feature_asis.+
                                                                                                   +
             Originals: 269 items.                                                                 +
                                                                                                   +
             Not Intersecs: 0 items.                                                               +
                                                                                                   +
             Invalid: 0 items.                                                                     +
                                                                                                   +
             Not simple: 269 items.                                                                +
                                                                                                   +
             Empty: 0 items.                                                                       +
                                                                                                   +
             Small: 0 items.                                                                       +
                                                                                                   +
             Null: 0 items.                                                                        +
                                                                                                   +
             Invalid geometry type: 0 items.                                                       +
                                                                                                   +
             Not closed: 0 items.                                                                  +
                                                                                                   +
             Large: 0 items.                                                                       +
                                                                                                   +
             Deduplication: 0 items.                                                               +
                                                                                                   +
             Resulting in feature_asis: 0.                                                         +
                                                                                                   +
             Resulting in feature_asis_discarded: 269.                                             +

(1 row)

Confira os resultados nas tabelas ingest.donated_packcomponent e ingest.feature_asis.
psql postgres://postgres@localhost/ingest55 -c "DROP  TABLE IF EXISTS pk7600000901101_p1_nsvia CASCADE"
DROP TABLE
FIM.

Situação confirmada por:

SELECT ST_IsSimple(geom) FROM pk7600000901101_p1_nsvia;
 st_issimple 
-------------
 f
 f
 f
...
 f
 f
 f
(269 rows)

(END)

Nessa situação, a função _anyload produzia um array de estatísticas com tamanho menor, resultando em erro na any_load_returnmsg. Situação foi corrigida.

0e1 commented 1 year ago

Os casos dos layers parcel e building de BR-SP-SaoPaulo/_pk0033.01 também decorrem do tamanho diferente do array de estatísticas.

Isso foi ajustado. Adicionalmente foi implementado um acumulador. Lembrar que esses layers possuem múltiplos arquivos. Agora, a cada ingestão é exibida mensagem com o resultado acumulado. Exemplo de ingestão do layer parcel:

                                              any_load                                              
----------------------------------------------------------------------------------------------------
 Statistics from file_id=35 (parcel_ext of 7600003301201 of BR-SP-SaoPaulo) in ingest.feature_asis.+
                                                                                                   +
             Originals: 1718545 items.                                                             +
                                                                                                   +
             Not Intersecs: 107 items.                                                             +
                                                                                                   +
             Invalid: 5 items.                                                                     +
                                                                                                   +
             Not simple: 65 items.                                                                 +
                                                                                                   +
             Empty: 2 items.                                                                       +
                                                                                                   +
             Small: 18 items.                                                                      +
                                                                                                   +
             Null: 0 items.                                                                        +
                                                                                                   +
             Invalid geometry type: 0 items.                                                       +
                                                                                                   +
             Not closed: 0 items.                                                                  +
                                                                                                   +
             Large: 0 items.                                                                       +
                                                                                                   +
             Deduplication: 64920 items.                                                           +
                                                                                                   +
             Resulting in feature_asis: 1653005.                                                   +
                                                                                                   +
             Resulting in feature_asis_discarded: 65540.                                           +

(1 row)

psql postgres://postgres@localhost/ingest55 -c "SELECT ingest.any_load_assign('$(find /tmp/sandbox/_pk7600003301_001 -path "*SIRGAS_SHP_LOTES*.shp" | head -n 1)','parcel_ext','7600003301201' )"
 any_load_assign 
-----------------
 Ok
(1 row)

Confira os resultados nas tabelas ingest.donated_packcomponent e ingest.feature_asis.
psql postgres://postgres@localhost/ingest55 -c "DROP  TABLE IF EXISTS pk7600003301201_p2_parcel CASCADE"
DROP TABLE
FIM.
0e1 commented 1 year ago

O commit https://github.com/digital-guard/preserv/commit/d854ed016dde3bf8db581436b0be30097850aac3 resolve os problemas, os layers podem ser republicados.