#2191 closed defect (wontfix)
Rasql - wrong error message for encoding
Reported by: | Bang Pham Huu | Owned by: | apercov |
---|---|---|---|
Priority: | minor | Milestone: | 10.0 |
Component: | rasserver | Version: | 9.8 |
Keywords: | Cc: | Dimitar Misev, Peter Baumann | |
Complexity: | Medium |
Description
Try this query on test_grey collection
rasql -q 'SELECT encode((byte) c, "png" , "{\"geoReference\":{\"crs\":\"EPSG:25831\",\"bbox\":{\"xmin\":260170,\"ymin\":4488782,\"xmax\":527395,\"ymax\":4747982}},\"metadata\":{\"Title\":\"Coverage contains INSPIRE local metadata\",\"fileReferenceHistory\":\"/mnt/rasservice/DataImport/data/ICGC/ICGC_DATA_HELSINKI_WS_LC/mcsc_2019_0.tif\",\"INSPIRE\":\"\n<lcrmd:LandCoverGridCoverageMD \n\t\txmlns:ad=\\"http://inspire.ec.europa.eu/schemas/ad/4.0\\" \n\t\txmlns:base=\\"http://inspire.ec.europa.eu/schemas/base/3.3\\" \n\t\txmlns:base2=\\"http://inspire.ec.europa.eu/schemas/base2/2.0\\" \n\t\txmlns:gco=\\"http://www.isotc211.org/2005/gco\\" \n\t\txmlns:gmd=\\"http://www.isotc211.org/2005/gmd\\" \n\t\txmlns:gn=\\"http://inspire.ec.europa.eu/schemas/gn/4.0\\" \n\t\txmlns:lcn=\\"http://inspire.ec.europa.eu/schemas/lcn/4.0\\" \n\t\txmlns:lcrmd=\\"http://inspire.ec.europa.eu/schemas/lcrmd/4.0\\" \n\t\txmlns:xsi=\\"http://www.w3.org/2001/XMLSchema-instance\\" \n\t\txsi:schemaLocation=\\"http://inspire.ec.europa.eu/schemas/lcrmd/4.0 http://test.datacove.eu/LandCoverRasterMDExt.xsd\\">\n\t<lcrmd:inspireId>\n\t\t<base:Identifier>\n\t\t\t<base:localId >cobertes-sol- v1r0-2009-simplificat</base:localId>\n\t\t\t<base:namespace>catalunya</base:namespace>\n\t\t</base:Identifier>\n\t</lcrmd:inspireId>\n\t<lcrmd:beginLifespanVersion>2019-03-01T00:00:00+01:00</lcrmd:beginLifespanVersion>\n\t<lcrmd:extent>\n\t\t<gmd:EX_EReason: Parsing error 300 in line 1, column 22: Unexpected name cxtent>\n\t\t\t<gmd:geographicElement>\n\t\t\t\t<gmd:EX_GeographicBoundingBox>\n\t\t\t\t\t<gmd:westBoundLongitude>\n\t\t\t\t\t\t<gco:Decimal>0.169154347</gco:Decimal>\n\t\t\t\t\t</gmd:westBoundLongitude>\n\t\t\t\t\t<gmd:eastBoundLongitude>\n\t\t\t\t\t\t<gco:Decimal>3.335579920</gco:Decimal>\n\t\t\t\t\t</gmd:eastBoundLongitude>\n\t\t\t\t\t<gmd:southBoundLatitude>\n\t\t\t\t\t\t<gco:Decimal>40.515122408</gco:Decimal>\n\t\t\t\t\t</gmd:southBoundLatitude>\n\t\t\t\t\t<gmd:northBoundLatitude>\n\t\t\t\t\t\t<gco:Decimal>42.883946531</gco:Decimal>\n\t\t\t\t\t</gmd:northBoundLatitude>\n\t\t\t\t</gmd:EX_GeographicBoundingBox>\n\t\t\t</gmd:geographicElement>\n\t\t</gmd:EX_Extent>\n\t</lcrmd:extent>\n\t<lcrmd:name>Mapa de Cobertes del Sol de Catalunya (MCSC) 2009 (Simplificat - Llegenda 41 classes)</lcrmd:name>\n\t<lcrmd:nomenclatureDocumentation>\n\t\t<lcn:LandCoverNomenclature>\n\t\t\t<lcn:inspireId>\n\t\t\t\t<base:Identifier>\n\t\t\t\t\t<base:localId >cobertes- sol_v1r0_esp_02ca_20190415.pdf</base:localId>\n\t\t\t\t\t<base:namespace>Catalunya</base:namespace>\n\t\t\t\t</base:Identifier>\n\t\t\t</lcn:inspireId>\n\t\t\t<lcn:nomenclatureCodeList/>\n\t\t\t<lcn:responsibleParty>\n\t\t\t\t<base2:RelatedParty>\n\t\t\t\t\t<base2:organisationName>\n\t\t\t\t\t\t<gmd:LocalisedCharacterString>Institut Cartogràfic i Geològic de Catalunya (ICGC)</gmd:LocalisedCharacterString>\n\t\t\t\t\t</base2:organisationName>\n\t\t\t\t\t<base2:contact>\n\t\t\t\t\t\t<base2:Contact>\n\t\t\t\t\t\t\t<base2:address>\n\t\t\t\t\t\t\t\t<ad:AddressRepresentation>\n\t\t\t\t\t\t\t\t\t<ad:adminUnit>\n\t\t\t\t\t\t\t\t\t\t<gn:GeographicalName>\n\t\t\t\t\t\t\t\t\t\t\t<gn:language>cat</gn:language>\n\t\t\t\t\t\t\t\t\t\t\t<!-- language of municipality name-->\n\t\t\t\t\t\t\t\t\t\t\t<gn:nativeness nilReason=\\"missing\\" xsi:nil=\\"true\\"/>\n\t\t\t\t\t\t\t\t\t\t\t<gn:nameStatus nilReason=\\"missing\\" xsi:nil=\\"true\\"/>\n\t\t\t\t\t\t\t\t\t\t\t<gn:sourceOfName nilReason=\\"missing\\" xsi:nil=\\"true\\"/>\n\t\t\t\t\t\t\t\t\t\t\t<gn:pronunciation nilReason=\\"missing\\" xsi:nil=\\"true\\"/>\n\t\t\t\t\t\t\t\t\t\t\t<gn:spelling>\n\t\t\t\t\t\t\t\t\t\t\t\t<gn:SpellingOfName>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<!-- municipality name -->\n\t\t\t\t\t\t\t\t\t\t\t\t\t<gn:text>BReason: Parsing error 300 in line 1, column 22: Unexpected name carcelona</gn:text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<gn:script>Latn</gn:script>\n\t\t\t\t\t\t\t\t\t\t\t\t</gn:SpellingOfName>\n\t\t\t\t\t\t\t\t\t\t\t</gn:spelling>\n\t\t\t\t\t\t\t\t\t\t</gn:GeographicalName>\n\t\t\t\t\t\t\t\t\t</ad:adminUnit>\n\t\t\t\t\t\t\t\t\t<!-- Street address -->\n\t\t\t\t\t\t\t\t\t<ad:locatorDesignator>Parc de Montjüic s/n</ad:locatorDesignator>\n\t\t\t\t\t\t\t\t\t<!-- Postal Code-->\n\t\t\t\t\t\t\t\t\t<ad:postCode>08038</ad:postCode>\n\t\t\t\t\t\t\t\t</ad:AddressRepresentation>\n\t\t\t\t\t\t\t</base2:address>\n\t\t\t\t\t\t\t<!-- e-mail of responsible person -->\n\t\t\t\t\t\t\t<base2:electronicMailAddress>icgc@icgc.cat</base2:electronicMailAddress>\n\t\t\t\t\t\t\t<!-- phonel of responsible person -->\n\t\t\t\t\t\t\t<base2:telephoneVoice>+34 93 567 15 00</base2:telephoneVoice>\n\t\t\t\t\t\t\t<!-- web URI of responsible organization-->\n\t\t\t\t\t\t\t<base2:website>http://www.icgc.cat</base2:website>\n\t\t\t\t\t\t</base2:Contact>\n\t\t\t\t\t</base2:contact>\n\t\t\t\t</base2:RelatedParty>\n\t\t\t</lcn:responsibleParty>\n\t\t</lcn:LandCoverNomenclature>\n\t</lcrmd:nomenclatureDocumentation>\n\t<lcrmd:validFrom>2009-08-16</lcrmd:validFrom>\n\t<lcrmd:validTo>2009-08-17</lcrmd:validTo>\n</lcrmd:LandCoverGridCoverageMD>\"}}") FROM test_mr AS c'
it returns error about collection alias
rasdaman error 300: Parsing error 300 in line 1, column 23: Unexpected name c.
However, this query below (without casting to byte
) doesn't return error
rasql -q 'SELECT encode( c, "png" , "{\"geoReference\":{\"crs\":\"EPSG:25831\",\"bbox\":{\"xmin\":260170,\"ymin\":4488782,\"xmax\":527395,\"ymax\":4747982}},\"metadata\":{\"Title\":\"Coverage contains INSPIRE local metadata\",\"fileReferenceHistory\":\"/mnt/rasservice/DataImport/data/ICGC/ICGC_DATA_HELSINKI_WS_LC/mcsc_2019_0.tif\",\"INSPIRE\":\"\n<lcrmd:LandCoverGridCoverageMD \n\t\txmlns:ad=\\"http://inspire.ec.europa.eu/schemas/ad/4.0\\" \n\t\txmlns:base=\\"http://inspire.ec.europa.eu/schemas/base/3.3\\" \n\t\txmlns:base2=\\"http://inspire.ec.europa.eu/schemas/base2/2.0\\" \n\t\txmlns:gco=\\"http://www.isotc211.org/2005/gco\\" \n\t\txmlns:gmd=\\"http://www.isotc211.org/2005/gmd\\" \n\t\txmlns:gn=\\"http://inspire.ec.europa.eu/schemas/gn/4.0\\" \n\t\txmlns:lcn=\\"http://inspire.ec.europa.eu/schemas/lcn/4.0\\" \n\t\txmlns:lcrmd=\\"http://inspire.ec.europa.eu/schemas/lcrmd/4.0\\" \n\t\txmlns:xsi=\\"http://www.w3.org/2001/XMLSchema-instance\\" \n\t\txsi:schemaLocation=\\"http://inspire.ec.europa.eu/schemas/lcrmd/4.0 http://test.datacove.eu/LandCoverRasterMDExt.xsd\\">\n\t<lcrmd:inspireId>\n\t\t<base:Identifier>\n\t\t\t<base:localId >cobertes-sol- v1r0-2009-simplificat</base:localId>\n\t\t\t<base:namespace>catalunya</base:namespace>\n\t\t</base:Identifier>\n\t</lcrmd:inspireId>\n\t<lcrmd:beginLifespanVersion>2019-03-01T00:00:00+01:00</lcrmd:beginLifespanVersion>\n\t<lcrmd:extent>\n\t\t<gmd:EX_EReason: Parsing error 300 in line 1, column 22: Unexpected name cxtent>\n\t\t\t<gmd:geographicElement>\n\t\t\t\t<gmd:EX_GeographicBoundingBox>\n\t\t\t\t\t<gmd:westBoundLongitude>\n\t\t\t\t\t\t<gco:Decimal>0.169154347</gco:Decimal>\n\t\t\t\t\t</gmd:westBoundLongitude>\n\t\t\t\t\t<gmd:eastBoundLongitude>\n\t\t\t\t\t\t<gco:Decimal>3.335579920</gco:Decimal>\n\t\t\t\t\t</gmd:eastBoundLongitude>\n\t\t\t\t\t<gmd:southBoundLatitude>\n\t\t\t\t\t\t<gco:Decimal>40.515122408</gco:Decimal>\n\t\t\t\t\t</gmd:southBoundLatitude>\n\t\t\t\t\t<gmd:northBoundLatitude>\n\t\t\t\t\t\t<gco:Decimal>42.883946531</gco:Decimal>\n\t\t\t\t\t</gmd:northBoundLatitude>\n\t\t\t\t</gmd:EX_GeographicBoundingBox>\n\t\t\t</gmd:geographicElement>\n\t\t</gmd:EX_Extent>\n\t</lcrmd:extent>\n\t<lcrmd:name>Mapa de Cobertes del Sol de Catalunya (MCSC) 2009 (Simplificat - Llegenda 41 classes)</lcrmd:name>\n\t<lcrmd:nomenclatureDocumentation>\n\t\t<lcn:LandCoverNomenclature>\n\t\t\t<lcn:inspireId>\n\t\t\t\t<base:Identifier>\n\t\t\t\t\t<base:localId >cobertes- sol_v1r0_esp_02ca_20190415.pdf</base:localId>\n\t\t\t\t\t<base:namespace>Catalunya</base:namespace>\n\t\t\t\t</base:Identifier>\n\t\t\t</lcn:inspireId>\n\t\t\t<lcn:nomenclatureCodeList/>\n\t\t\t<lcn:responsibleParty>\n\t\t\t\t<base2:RelatedParty>\n\t\t\t\t\t<base2:organisationName>\n\t\t\t\t\t\t<gmd:LocalisedCharacterString>Institut Cartogràfic i Geològic de Catalunya (ICGC)</gmd:LocalisedCharacterString>\n\t\t\t\t\t</base2:organisationName>\n\t\t\t\t\t<base2:contact>\n\t\t\t\t\t\t<base2:Contact>\n\t\t\t\t\t\t\t<base2:address>\n\t\t\t\t\t\t\t\t<ad:AddressRepresentation>\n\t\t\t\t\t\t\t\t\t<ad:adminUnit>\n\t\t\t\t\t\t\t\t\t\t<gn:GeographicalName>\n\t\t\t\t\t\t\t\t\t\t\t<gn:language>cat</gn:language>\n\t\t\t\t\t\t\t\t\t\t\t<!-- language of municipality name-->\n\t\t\t\t\t\t\t\t\t\t\t<gn:nativeness nilReason=\\"missing\\" xsi:nil=\\"true\\"/>\n\t\t\t\t\t\t\t\t\t\t\t<gn:nameStatus nilReason=\\"missing\\" xsi:nil=\\"true\\"/>\n\t\t\t\t\t\t\t\t\t\t\t<gn:sourceOfName nilReason=\\"missing\\" xsi:nil=\\"true\\"/>\n\t\t\t\t\t\t\t\t\t\t\t<gn:pronunciation nilReason=\\"missing\\" xsi:nil=\\"true\\"/>\n\t\t\t\t\t\t\t\t\t\t\t<gn:spelling>\n\t\t\t\t\t\t\t\t\t\t\t\t<gn:SpellingOfName>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<!-- municipality name -->\n\t\t\t\t\t\t\t\t\t\t\t\t\t<gn:text>BReason: Parsing error 300 in line 1, column 22: Unexpected name carcelona</gn:text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<gn:script>Latn</gn:script>\n\t\t\t\t\t\t\t\t\t\t\t\t</gn:SpellingOfName>\n\t\t\t\t\t\t\t\t\t\t\t</gn:spelling>\n\t\t\t\t\t\t\t\t\t\t</gn:GeographicalName>\n\t\t\t\t\t\t\t\t\t</ad:adminUnit>\n\t\t\t\t\t\t\t\t\t<!-- Street address -->\n\t\t\t\t\t\t\t\t\t<ad:locatorDesignator>Parc de Montjüic s/n</ad:locatorDesignator>\n\t\t\t\t\t\t\t\t\t<!-- Postal Code-->\n\t\t\t\t\t\t\t\t\t<ad:postCode>08038</ad:postCode>\n\t\t\t\t\t\t\t\t</ad:AddressRepresentation>\n\t\t\t\t\t\t\t</base2:address>\n\t\t\t\t\t\t\t<!-- e-mail of responsible person -->\n\t\t\t\t\t\t\t<base2:electronicMailAddress>icgc@icgc.cat</base2:electronicMailAddress>\n\t\t\t\t\t\t\t<!-- phonel of responsible person -->\n\t\t\t\t\t\t\t<base2:telephoneVoice>+34 93 567 15 00</base2:telephoneVoice>\n\t\t\t\t\t\t\t<!-- web URI of responsible organization-->\n\t\t\t\t\t\t\t<base2:website>http://www.icgc.cat</base2:website>\n\t\t\t\t\t\t</base2:Contact>\n\t\t\t\t\t</base2:contact>\n\t\t\t\t</base2:RelatedParty>\n\t\t\t</lcn:responsibleParty>\n\t\t</lcn:LandCoverNomenclature>\n\t</lcrmd:nomenclatureDocumentation>\n\t<lcrmd:validFrom>2009-08-16</lcrmd:validFrom>\n\t<lcrmd:validTo>2009-08-17</lcrmd:validTo>\n</lcrmd:LandCoverGridCoverageMD>\"}}") FROM test_mr AS c'
Change History (13)
comment:1 by , 5 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 5 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
please read again: it is about the error message.
comment:3 by , 5 years ago
I think it's difficult to fix this in the rasql parser. It should say "unexpected name byte".
@apercov you can try to fix it if possible.
comment:4 by , 5 years ago
not in the parser, but in the codec factory if you don't find a matching driver.
comment:5 by , 5 years ago
but the error is that "byte" is not a known base type name in rasdaman. It has nothing to do with encode.
comment:6 by , 5 years ago
oops, correct - I was thinking of the encode() which is totally different. OK, so back with the parser. But then again, in the rule for cast we can determine if we do not know the type, from the base types or user-defined.
BTW, friendly amendment on the format make, error message like this:
Error: Unknown cell type name 'byte'.
comment:7 by , 5 years ago
Priority: | major → minor |
---|
comment:8 by , 16 months ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
I don't think there's any easy way to fix this. (byte) c
basically parses to (identifier) identifier
which is an invalid expression. (identifier)
(which is what (byte)
is) is valid, so then it comes to c and it becomes invalid.
comment:9 by , 16 months ago
might be a problem of the grammar being too coarse. What about
cast ::= "(" typeIdentifier ")" typeIdentifier ::= "byte" | ...
comment:10 by , 16 months ago
As I mentioned in comment:1, "byte" is not a keyword in rasql. I should change the example in this ticket to SELECT encode((asdgfewwr) c,
comment:11 by , 16 months ago
yep, true - first thought was to hardwire our well-known base types in the syntax, but then we have the custom types.
Next attempt: at parse time, can you access the known cell types to determine whether a "(…)" contents is a type? If so, you could give a hint to the parser that a cast rule is active.
comment:12 by , 16 months ago
That's already done:
$ rasql -q 'select (RGBPixel) rgb from rgb' rasql: rasdaman query tool 10.2.6. Opening database RASBASE at 127.0.0.1:7001... ok. Executing retrieval query... ok. rasql done. $ rasql -q 'select (UnknownType) rgb from rgb' rasql: rasdaman query tool 10.2.6. Opening database RASBASE at 127.0.0.1:7001... ok. Executing retrieval query... rasdaman error 300: Parsing error 300 in line 1, column 22: Unexpected name rgb. aborting transaction... ok. rasql done.
comment:13 by , 16 months ago
why then does it say "unexpected rgb" instead of "unknown UnknownType"? Would be easier to understand IMHO.
"byte" does not exist in rasql, see http://doc.rasdaman.org/04_ql-guide.html#cell-types