Opened 7 years ago

Closed 6 years ago

#1719 closed defect (fixed)

rasdaman should throw an error when importing array with wrong type

Reported by: Bang Pham Huu Owned by: dkamov
Priority: minor Milestone: 9.7
Component: rasql Version: development
Keywords: Cc: Dimitar Misev, Vlad Merticariu
Complexity: Medium

Description

test_rgb_wrong is a collection imported by Rasql with SetType: GreySet, meanwhile it should be RGBSet.

However, this collection can be imported normally without error.

rasql -q 'create collection test_rgb_wrong GreySet' --user rasadmin --passwd rasadmin

rasql -q 'insert into test_rgb_wrong values decode($1)' -f "/home/rasdaman/rasdaman_community/rasdaman/systemtest/testcases_services/test_all_wcst_import/test_data/wcps_rgb/rgb.png" --user rasadmin --passwd rasadmin

rasql -q 'select sdom(c) from test_rgb_wrong as c' --out string
rasql: rasdaman query tool v1.0, rasdaman v9.5.0-beta1-g83e5ca18.
opening database RASBASE at localhost:7001...ok
Executing retrieval query...ok
Query result collection has 1 element(s):
  Result element 1: [0:399,0:343]
rasql done.

rasql -q 'select dbinfo(c) from test_rgb_wrong as c' --out string
rasql: rasdaman query tool v1.0, rasdaman v9.5.0-beta1-g83e5ca18.
opening database RASBASE at localhost:7001...ok
Executing retrieval query...ok
Query result collection has 1 element(s):
  Result object 1: {
 "oid": "3585",
 "baseType": "marray <struct { char , char , char  }>",
 "tileNo": "1",
 "totalSize": "412800",
 "tiling": {
	"tilingScheme": "aligned",
	"tileSize": "4194304",
	"tileConfiguration": "[0:*,0:*]"
 },
 "index": {
	"type": "rpt_index",
	"PCTmax": "4096",
	"PCTmin": "2048"
 }
}


However, when trying to do avg_cells() on this collection, server killed:

rasql -q 'select avg_cells(c) from test_rgb_wrong as c' --out string
rasql: rasdaman query tool v1.0, rasdaman v9.5.0-beta1-g83e5ca18.
opening database RASBASE at localhost:7001...ok
Executing retrieval query...[ERROR] - Client failed with error:Endpoint read failed
rasdaman error 0: The client failed to contact the server.
aborting transaction...[ERROR] - The client failed to connect to rasserver.
ok

Change History (8)

comment:1 by Dimitar Misev, 7 years ago

Ok can you fix the systemtest? This collection should have type RGBSet, I'm surprise how any query worked this way!

in reply to:  1 comment:2 by Bang Pham Huu, 7 years ago

Replying to dmisev:

Ok can you fix the systemtest? This collection should have type RGBSet, I'm surprise how any query worked this way!

it is my mistake to use GreySet to import, in systemtest already used RGBSet

  create_coll $TEST_SUBSETTING_SINGLE RGBSet		
  insert_into $TEST_SUBSETTING_SINGLE "$TESTDATA_PATH/rgb.png" "" "decode"	

comment:3 by bbell, 7 years ago

Decode should check that the types are compatible, and as far as I understand, it should not affect the results of dbinfo aside from sdoms and tiles. Changing the type to a struct, anywhere in the code, just seems like bad practice, whether it manages to ingest the data or not.

comment:4 by Dimitar Misev, 7 years ago

Priority: majorminor

Phew ok, it's a minor issue. The place that needs to check for the type is here: browser:qlparser/qtinsert.cc#L228

comment:5 by Dimitar Misev, 7 years ago

Summary: Rasql_Avg_cells() doesn't work on collection imported with wrong SetTyperasdaman should throw an error when importing array with wrong type

comment:6 by Dimitar Misev, 7 years ago

Milestone: 9.69.7

comment:7 by Dimitar Misev, 6 years ago

Owner: changed from bbell to dkamov
Status: newassigned

With latest rasdaman the query even works :)

$ rasql -q 'select avg_cells(c) from test_rgb_wrong as c' --out string
rasql: rasdaman query tool v1.0, rasdaman 9.6.0.
Opening database RASBASE at localhost:7001... ok.
Executing retrieval query... ok.
Query result collection has 1 element(s):
  Result element 1: 173.039636627907
rasql done.

But anyway this should be fixed. See comment:4 for a guideline.

comment:8 by dkamov, 6 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.