#119 closed defect (fixed)
casting fails with user-defined types
Reported by: | Dimitar Misev | Owned by: | Veranika Liaukevich |
---|---|---|---|
Priority: | major | Milestone: | 9.0.x |
Component: | conversion | Version: | 8.3 |
Keywords: | Cc: | Peter Baumann, Dimitar Misev | |
Complexity: | Medium |
Description
Casting to a user-defined composite type fails, e.g. assuming a base type
struct CustomPixel { octet band1, band2, band3, band4; };
has been inserted with rasdl, the following statement fails:
insert into coll values (CustomPixel) inv_tiff($1)
Change History (18)
comment:1 by , 12 years ago
Milestone: | → 9.0 |
---|
comment:2 by , 11 years ago
Cc: | added |
---|---|
Complexity: | → Very Hard |
comment:3 by , 11 years ago
The casting itself is the issue, has nothing to do with the convertor function.
comment:4 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:6 by , 11 years ago
Complexity: | Very Hard → Medium |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
I submitted a patch with a test in source:systemtest/testcases_mandatory/test_conversion
(TestPixel) decode($1)
seems to work fine, but (TestPixel) inv_tiff($1)
fails with
Error: QtConversion::evaluate() no structure type compatible found
comment:7 by , 11 years ago
Did you recompile code? Both selection and insertion with inv_tiff
work for me, the test from your patch is passed.
comment:8 by , 11 years ago
Hmm yes I did recompile, this is the output of my test:
test.sh: ----- user-defined type conversion ------ test.sh: creating collection... ok. rasdaman error 2002: Internal error: Entry in user defined type not found. test.sh: user-defined base type cast inf_tiff test failed. test.sh: user-defined base type cast decode test passed.
comment:9 by , 11 years ago
(By the way, you have a typo: "inV_tiff test passed").
That's strange:
test.sh: ----- user-defined type conversion ------ test.sh: creating collection... ok. test.sh: user-defined base type cast inf_tiff test. test.sh: user-defined base type cast decode test passed.
Does "select (TestPixel) inv_tiff($1)"
also fail?
comment:10 by , 11 years ago
Strange indeed, and select fails as well
rasql: rasdaman query tool v1.0, rasdaman v9.0.1-ge5210e4 -- generated on 13.05.2014 14:27:43. opening database RASBASE at localhost:7001...ok fetching type information for GreyString from database, using readonly transaction...ok reading file /home/dimitar/projects/rasdaman/community/src/systemtest/testcases_mandatory/test_conversion/testdata/multiband.tif...ok constant 1: GMarray Oid...................: Type Structure........: Type Schema...........: marray< char > Domain................: [0:691] Base Type Schema......: char Base Type Length......: 1 Data format.......... : Array Data size (bytes).... : 692 Executing retrieval query...rasdaman error aborting transaction...2002: Internal error: Entry in user defined type not found. ok rasql done.
comment:11 by , 11 years ago
These are the last commits from git log
* e5210e4 (HEAD, master) ticket:119 - add conversion test * 053b4fe (origin/master, origin/HEAD) ticket:707 - Hide debug output in StorageLayout * 4383ed3 ticket:119 - Casting with user-defined types * 251db02 ticket:210 - Fix null pointer dereference ...
comment:12 by , 11 years ago
I have the same commits order, and the working directory is clean.
Try just "select inv_tiff($1)"
, the error message seems to appear during conversion, not casting.
comment:13 by , 11 years ago
Yes indeed, still same error
Request: 'select inv_tiff(#MDD0#)'...parsing...checking semantics...evaluating...Error: QtConversion::evaluate() no structure type compatible found
comment:14 by , 11 years ago
I took a look at QtConversion
code, it doesn't create a new temprorary type after the conversion is done, but searches for an appropriate among already existing. On my system it succeeds, on yours fails, so we need to change this behaviour. I will have a look later.
comment:15 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
It seems that the inv_tiff returns a struct of chars, rather than of octets.
The TestPixel is a struct of 4 octets, which doesn't match a struct of 4 chars, so that's why it fails.
The input testdata file multiband.tif has char bands, after creating a multiband.tif with octet bands it works fine. Still puzzled how it worked for you though
In any case, it was an issue of the test and not the implementation, so reclosing the ticket.
comment:16 by , 11 years ago
Wait, this is what casting is about: converting one types into others. You can convert char into octet without any problem (try "select (octet) 128"
), the result should be 127 because of overflow. This is how it works now for base types, so I think it should work in the same way for attributes of structures.
decode($1)
also returns structure of chars, which is later converted to structure of octets (TestPixel
), and this works for you as well.
comment:17 by , 11 years ago
Yes, so inv_tiff should actually create a temporary struct, if it cannot find the corresponding type in the database.
Dimitar, do you think his is a cast or a "TIFF with 4 bands" problem?