[Dachs-support] unknown data type 'L' in FITS booster
carlosadean at linea.gov.br
carlosadean at linea.gov.br
Mon Nov 21 12:16:38 CET 2016
Hi Markus,
First of all thank you for your support.
----- Mensagem original -----
> De: "Markus Demleitner" <msdemlei at ari.uni-heidelberg.de>
> Para: dachs-support at g-vo.org
> Enviadas: Sexta-feira, 18 de novembro de 2016 7:41:30
> Assunto: Re: [Dachs-support] unknown data type 'L' in FITS booster
>
> Hi Carlos,
>
> Yeah, that's because you set, in the RD, the corresponding column to
> boolean, and the FITS booster doesn't know how to create code to fill
> boolean DB columns.
>
> I won't teach it, either, since booleans will be trouble with ADQL
> and normally don't save space either (unless there's a bunch of them
> or an array of booleans, which you'd have to handle manually).
>
> Instead, simply declare the respective column (snx3) as a short
> (bytea should work, too, but I'd say only bother if there's an even
> number of consecutive booleans).
>
> Even then, the above patch has a problem, since it turns out that
> cfitsio dumps booleans in chars, so you'll get 257 instead of 1 into
> your table column (and possibly worse).
>
> So, I revert the above statement and correct myself to:
>
> Index: grammars/directgrammar.py
> ===================================================================
> --- grammars/directgrammar.py (revision 5404)
> +++ grammars/directgrammar.py (revision 5405)
> @@ -546,6 +546,7 @@
> "J": ("TLONG", "long"),
> "K": ("TLONGLONG", "long long"),
> "E": ("TFLOAT", "float"),
> + "L": ("TLOGICAL", "unsigned char"),
> "D": ("TDOUBLE", "double")}
> makers = {
> "bigint": "MAKE_BIGINT",
>
> (that's 5404:5405 in svn).
>
> Summing up: If you
>
> (a) fix the patched source and
> (b) declare snx3 as short
>
> things should just work.
>
> -- Markus
That's the result after applied the changes and importing the sample data.
./sample/s.rd
<column name="SNX3" type="bytea" description="" ucd="" unit="">
<values nullLiteral="-9999" />
</column>
./gavo/grammars/directgrammar.py
548 "E": ("TFLOAT", "float"),
549 "L": ("TLOGICAL", "unsigned char"),
550 "D": ("TDOUBLE", "double")}
551 makers = {
552 "bigint": "MAKE_BIGINT",
553 "smallint": "MAKE_SHORT",
[carlosadean at devel2 inputs [master]]$ gavo mkboost sample/s.rd#booster > sample/res/boosterfunc.c
[carlosadean at devel2 inputs [master]]$ gavo imp -v sample/s.rd
Making data import_table
00130734 records done.
Rows affected: 0
** WARNING: Could not update timestamp on RD sample/s
[carlosadean at devel2 inputs [master]]$ psql -h desdb4 -U gavo gavo
psql (8.4.1, server 9.2.9)
WARNING: psql version 8.4, server version 9.2.
Some psql features might not work.
Type "help" for help.
gavo=# select snx3 from sample.fits limit 10;
snx3
------
\x00
\x00
\x00
\x00
\x00
\x00
\x00
\x00
\x00
\x00
(10 rows)
At this moment our main data release does not have this data type, so I think we can work without worry about that.
In any case it is important to fix it and I'm happy to contribute.
cheers,
--
Carlos Adean
IT Team
linea.gov.br
skype: carlosadean
More information about the Dachs-support
mailing list