You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was going through the taxonomizr code and I noticed that while the taxonomy IDs are generally treated as integers (eg in the accessionTaxa.taxa column, names.id column, and nodes.id column), in the nodes table, the parent column uses as.numeric (here) and the resulting sqlite datatype becomes REAL rather than INTEGER (as observed when I dump the schema).
I'm wondering if REAL was chosen for that datatype rather than INTEGER for a specific reason?
I haven't checked to see if it makes a performance difference on a join or not, and in fact I'm not even sure if sqlite would do any conversion between REAL and INTEGER before comparing (see 4.2. Type Conversions Prior To Comparison in https://www.sqlite.org/datatype3.html).
Anyway, I'm curious about your thoughts on it.
The text was updated successfully, but these errors were encountered:
Good catch. I don't think any special reason to be REAL and it just slipped by. The code has been working so some conversion must be going on in the background hence why this wasn't noticed. For example, sqlite does seem to compare INT and REAL without erroring out e.g.:
CREATE TABLE A (a int, b real);
INSERT INTO A(a,b) VALUES (4,4);
INSERT INTO A(a,b) VALUES (4,4.0);
INSERT INTO A(a,b) VALUES (4,3.999999);
INSERT INTO A(a,b) VALUES (4,4.000001);
SELECT * FROM A WHERE a=b;
returning:
4|4.0
4|4.0
Might as well fix it since it seems an easy change. Should be updated on github now and I'll push to CRAN after the holidays. Thanks!
I was going through the taxonomizr code and I noticed that while the taxonomy IDs are generally treated as integers (eg in the
accessionTaxa.taxa
column,names.id
column, andnodes.id
column), in thenodes
table, theparent
column usesas.numeric
(here) and the resulting sqlite datatype becomesREAL
rather thanINTEGER
(as observed when I dump the schema).I'm wondering if
REAL
was chosen for that datatype rather thanINTEGER
for a specific reason?I haven't checked to see if it makes a performance difference on a join or not, and in fact I'm not even sure if sqlite would do any conversion between REAL and INTEGER before comparing (see 4.2. Type Conversions Prior To Comparison in https://www.sqlite.org/datatype3.html).
Anyway, I'm curious about your thoughts on it.
The text was updated successfully, but these errors were encountered: