Opened 8 years ago

Closed 6 years ago

#1342 closed defect (fixed)

Petascope_Create correct base type with range fields when create collection

Reported by: Bang Pham Huu Owned by: bbell
Priority: critical Milestone: 9.7
Component: qlparser Version: development
Keywords: Cc: Dimitar Misev
Complexity: Medium

Description (last modified by Dimitar Misev)

create cell type:

rasql -q 'create type waxlake42_1470639570867_735_base as (b1 char, b2 char, b3 char)' --user rasadmin --passwd rasadmin

create array type:

rasql -q 'create type waxlake42_1470639570867_735_mdd as waxlake42_1470639570867_735_base mdarray [ x, y ]' --user rasadmin --passwd rasadmin

create set type:

rasql -q 'create type waxlake42_1470639570867_735_set as set (waxlake42_1470639570867_735_mdd)' --user rasadmin --passwd rasadmin

create collection:

rasql -q 'CREATE COLLECTION waxlake3 waxlake42_1470639570867_735_set' --user rasadmin --passwd rasadmin

insert data:

rasql -q "INSERT INTO waxlake3 VALUES <[0:0,0:0] {0c,0c,0c}> " --user rasadmin --passwd rasadmin

result of dbinfo:

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

result of referencing by band name:

rasql -q 'select c.b1 from waxlake3 as c' --out string
rasql: rasdaman query tool v1.0, rasdaman 9.5.0.
opening database RASBASE at localhost:7001...ok
Executing retrieval query...rasdaman error 370: Execution error 370 in line 1, column 9, near token .: Struct selector is not valid.
aborting transaction...ok
rasql done.

One can still reference the bands by c.0, c.1, c.2.

Change History (18)

comment:1 by Dimitar Misev, 8 years ago

Component: rasqlqlparser
Description: modified (diff)
Owner: changed from Vlad Merticariu to Sulav Timilsina
Status: newassigned

comment:2 by Sulav Timilsina, 8 years ago

Dropping the database and recreating it fixed this problem.

comment:3 by Dimitar Misev, 8 years ago

So irr_cube_2 has different band names, not b1/b2 (notice baseType here):

rasql -q 'select dbinfo(c) from irr_cube_2 as c' --out string --quiet
{
 "oid": "930305",
 "baseType": "marray <struct { float prediction, float variance }, 3>",
 "tileNo": "6",
 "totalSize": "72576",
 "tiling": {
	"tilingScheme": "aligned",
	"tileSize": "4194304",
	"tileConfiguration": "[0:*,0:*,0:*]"
 },
 "index": {
	"type": "rpt_index",
	"PCTmax": "4096",
	"PCTmin": "2048"
 }
}

For RGBSet however, dbinfo doesn't return any band names, and I think this is the issue (as Sulav pointed there's a null pointer):

rasql -q 'select dbinfo(c) from a as c' --out string --quiet
{
 "oid": "935937",
 "baseType": "marray <struct { char , char , char  }>",
 "tileNo": "1",
 "totalSize": "12",
 "tiling": {
	"tilingScheme": "aligned",
	"tileSize": "4194304",
	"tileConfiguration": "[0:*,0:*]"
 },
 "index": {
	"type": "rpt_index",
	"PCTmax": "4096",
	"PCTmin": "2048"
 }
}

comment:4 by Bang Pham Huu, 8 years ago

so as I checked with Sulav, the problem here is due to basetype which I think from Petascope is not correct then it has effect on Rasdaman which return NULL value and when check basetype with dbinfo() as Dimitar, it showed without the band name (e.g: "baseType": "marray <struct { char , char , char }>" ) for the rgb coverage.

I think Sulav can do this ticket in the meantime http://rasdaman.org/ticket/1269

comment:5 by Bang Pham Huu, 8 years ago

Component: qlparserpetascope
Owner: changed from Sulav Timilsina to Bang Pham Huu
Summary: Rasql_Cannot use range name with different coveragesPetascope_Create correct base type with range fields when create collection

so the problem is exactly from Petascope as it will use the existing MDD type from Rasdaman without regarding to the band names (i.e: in wcst_import define the band name, however, it will just use the defined base types from Rasdaman.

example: mean_summer_airtemp coverage has 1 band (Gray) and Petascope will use the

typedef marray <char, 2> GreyImage;

instead of create a new structure

marray <struct { char Gray }, 2> Mean_Summer_AirTemp_Image

so the Rasql select dbinfo() will show correct basetype (GreyImage).

in reply to:  5 ; comment:6 by Dimitar Misev, 8 years ago

So what is the problem exactly?

  1. In single band images we shouldn't create structs but use the primitive type directly
  2. In multi band you specify the band names in the recipe, and that works as far as I know

in reply to:  6 comment:7 by Bang Pham Huu, 8 years ago

Replying to dmisev:

So what is the problem exactly?

  1. In single band images we shouldn't create structs but use the primitive type directly
  2. In multi band you specify the band names in the recipe, and that works as far as I know

The second one is not correct, if you have a 3 bands coverage and you define their names in wcst_import recipe as b1, b2, b3 it will choose RBGSet which will use red, green, blue instead.

comment:8 by Dimitar Misev, 8 years ago

Ah I see, this needs to be fixed then.

comment:9 by Bang Pham Huu, 8 years ago

There is a bug in rasdl ?

i.e: I have 2 different band names for base, mdd and set type (waxlake40 is b3, b2, b1 and waxlkae42 is b1, b2, b3)

//base
typedef struct { char b3, char b2, char b1 } waxlake40_1470639488218_207_base;
typedef struct { char b1, char b2, char b3 } waxlake42_1470639570867_735_base;

//mdd
typedef marray <struct { char b3, char b2, char b1 }, [*:*,*:*]> waxlake40_1470639488218_207_mdd;
typedef marray <struct { char b1, char b2, char b3 }, [*:*,*:*]> waxlake42_1470639570867_735_mdd;

//set
typedef set <waxlake40_1470639488218_207_mdd> waxlake40_1470639488218_207_set;
typedef set <waxlake42_1470639570867_735_mdd> waxlake42_1470639570867_735_set;

However, when I create a new collection and insert some 0 values to this collection with set type waxlake42, the output with dbinfo() shows that it was used with waxlake40 instead.

rasql -q 'CREATE COLLECTION waxlake3 waxlake42_1470639570867_735_set' --user rasadmin --passwd rasadmin

rasql -q "INSERT INTO waxlake3 VALUES <[0:0,0:0] {0c,0c,0c}> " --user rasadmin --passwd rasadmin


rasql -q 'select dbinfo(c)from waxlake3 as c' --out string

Query result collection has 1 element(s):
  Result object 1: {
 "oid": "2561",
 "baseType": "marray <struct { char b3, char b2, char b1 }, [*:*,*:*]>",
 "tileNo": "1",
 "totalSize": "3",
 "tiling": {
	"tilingScheme": "aligned",
	"tileSize": "4194304",
	"tileConfiguration": "[0:*,0:*]"
 },
 "index": {
	"type": "rpt_index",
	"PCTmax": "4096",
	"PCTmin": "2048"
 }
}
rasql done.


comment:10 by Dimitar Misev, 8 years ago

Can you use rasql 'CREATE TYPE' statements to create types? rasdl is deprecated.

in reply to:  10 comment:11 by Bang Pham Huu, 8 years ago

Replying to dmisev:

Can you use rasql 'CREATE TYPE' statements to create types? rasdl is deprecated.

it was called in Petascope when create base,mdd,set with Create TYPE already

CREATE TYPE waxlake46_1470640461292_21_base AS ( b3 char ,b2 char ,b1 char  )

comment:12 by Bang Pham Huu, 8 years ago

Milestone: 9.39.4

comment:13 by Dimitar Misev, 7 years ago

Owner: changed from Bang Pham Huu to bbell

@bbell please have a look at this one as well, while you're considering the struct alignment issue. There are some rasql queries to help reproduce, start from the most recent comments.

comment:14 by Dimitar Misev, 7 years ago

Component: petascopeqlparser
Milestone: 9.49.5

comment:15 by bbell, 7 years ago

Just to update the ticket, and save some work, with the current state:

create cell type:

rasql -q 'create type waxlake42_1470639570867_735_base as (b1 char, b2 char, b3 char)' --user rasadmin --passwd rasadmin

create array type:

rasql -q 'create type waxlake42_1470639570867_735_mdd as waxlake42_1470639570867_735_base mdarray [ x, y ]' --user rasadmin --passwd rasadmin

create set type:

rasql -q 'create type waxlake42_1470639570867_735_set as set (waxlake42_1470639570867_735_mdd)' --user rasadmin --passwd rasadmin

create collection:

rasql -q 'CREATE COLLECTION waxlake3 waxlake42_1470639570867_735_set' --user rasadmin --passwd rasadmin

insert data:

rasql -q "INSERT INTO waxlake3 VALUES <[0:0,0:0] {0c,0c,0c}> " --user rasadmin --passwd rasadmin

result of dbinfo:

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

result of referencing by band name:

rasql -q 'select c.b1 from waxlake3 as c' --out string
rasql: rasdaman query tool v1.0, rasdaman 9.5.0.
opening database RASBASE at localhost:7001...ok
Executing retrieval query...rasdaman error 370: Execution error 370 in line 1, column 9, near token .: Struct selector is not valid.
aborting transaction...ok
rasql done.

One can still reference the bands by c.0, c.1, c.2.

comment:16 by Vlad Merticariu, 7 years ago

Milestone: 9.59.6

comment:17 by Dimitar Misev, 7 years ago

Description: modified (diff)
Milestone: 9.69.7
Priority: majorcritical

comment:18 by Dimitar Misev, 6 years ago

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