Hey guys, A boolean type column seems to fit in a byte, I guess the extra space is to represent nulls (since it ain't a qubit). But does that mean that no column type is actually ':bit'? Given a BAT, how to distinguish between a byte (tinyint) column and a boolean one? Thanks, Dimitar
See https://www.monetdb.org/wiki/MonetDB_type_system ;-) our MAL representation of SQL type BOOLEAN is MAL type :bit, and the C representation of MAL type :bit is (out) C type bit, which is indeed 1 byte (8 bit) wide, because we need to accommodate 3 values: TRUE, FALSE & NULL (NIL). Thus, BOOLEAN columns are (should be) represented by a BAT with tail type (:)bit, which is (semantically) not the same as type TINYINT / (:)bte. Best, Stefan ----- On Oct 21, 2015, at 3:07 PM, Dimitar Nedev dimitar.nedev@monetdbsolutions.com wrote:
Hey guys,
A boolean type column seems to fit in a byte, I guess the extra space is to represent nulls (since it ain't a qubit). But does that mean that no column type is actually ':bit'? Given a BAT, how to distinguish between a byte (tinyint) column and a boolean one?
Thanks, Dimitar
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
Thanks for sending it, Stefan. Indeed, the page was quite helpful. That's how I fixed some real/float/double issues earlier. I see, so if I've got a boolean column, calling ATOMstorage(getColumnType(b->T->type)) where 'b' is a BAT would not sufficient to identify it as a boolean? It will return TYPE_bte (2). OK, I'll need to push the logic a bit further. Best, Dimitar
On 2015-Oct-21, at 15:14, Stefan Manegold
wrote: See https://www.monetdb.org/wiki/MonetDB_type_system ;-)
our MAL representation of SQL type BOOLEAN is MAL type :bit, and the C representation of MAL type :bit is (out) C type bit, which is indeed 1 byte (8 bit) wide, because we need to accommodate 3 values: TRUE, FALSE & NULL (NIL).
Thus, BOOLEAN columns are (should be) represented by a BAT with tail type (:)bit, which is (semantically) not the same as type TINYINT / (:)bte.
Best, Stefan
----- On Oct 21, 2015, at 3:07 PM, Dimitar Nedev dimitar.nedev@monetdbsolutions.com wrote:
Hey guys,
A boolean type column seems to fit in a byte, I guess the extra space is to represent nulls (since it ain't a qubit). But does that mean that no column type is actually ':bit'? Given a BAT, how to distinguish between a byte (tinyint) column and a boolean one?
Thanks, Dimitar
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) | _______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
On 21/10/15 15:41, Dimitar Nedev wrote:
Thanks for sending it, Stefan. Indeed, the page was quite helpful. That's how I fixed some real/float/double issues earlier.
I see, so if I've got a boolean column, calling ATOMstorage(getColumnType(b->T->type)) where 'b' is a BAT would not sufficient to identify it as a boolean? It will return TYPE_bte (2).
The name ATOMstorage should tell you a lot: it's about *storage*, not semantics. A bit uses the same amount of storage as a bte, but that doesn't mean those bytes are interpreted the same. It may well be that you shouldn't use ATOMstorage here.
OK, I'll need to push the logic a bit further.
Best, Dimitar
On 2015-Oct-21, at 15:14, Stefan Manegold
wrote: See https://www.monetdb.org/wiki/MonetDB_type_system ;-)
our MAL representation of SQL type BOOLEAN is MAL type :bit, and the C representation of MAL type :bit is (out) C type bit, which is indeed 1 byte (8 bit) wide, because we need to accommodate 3 values: TRUE, FALSE & NULL (NIL).
Thus, BOOLEAN columns are (should be) represented by a BAT with tail type (:)bit, which is (semantically) not the same as type TINYINT / (:)bte.
Best, Stefan
----- On Oct 21, 2015, at 3:07 PM, Dimitar Nedev dimitar.nedev@monetdbsolutions.com wrote:
Hey guys,
A boolean type column seems to fit in a byte, I guess the extra space is to represent nulls (since it ain't a qubit). But does that mean that no column type is actually ':bit'? Given a BAT, how to distinguish between a byte (tinyint) column and a boolean one?
Thanks, Dimitar
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) | _______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- Sjoerd Mullender
of a type t, ATOMstorage(t) gives you the "normalized" type with the same storage size; getColumnType() gives you the actual type. ATOMstorage(t) is usually used to reduce the type-specific code expansion, if only the size matters (e.g., for copying or bit-wise equality comparison), rather than the full type semantics ----- On Oct 21, 2015, at 3:41 PM, Dimitar Nedev dimitar.nedev@monetdbsolutions.com wrote:
Thanks for sending it, Stefan. Indeed, the page was quite helpful. That's how I fixed some real/float/double issues earlier.
I see, so if I've got a boolean column, calling ATOMstorage(getColumnType(b->T->type)) where 'b' is a BAT would not sufficient to identify it as a boolean? It will return TYPE_bte (2).
OK, I'll need to push the logic a bit further.
Best, Dimitar
On 2015-Oct-21, at 15:14, Stefan Manegold
wrote: See https://www.monetdb.org/wiki/MonetDB_type_system ;-)
our MAL representation of SQL type BOOLEAN is MAL type :bit, and the C representation of MAL type :bit is (out) C type bit, which is indeed 1 byte (8 bit) wide, because we need to accommodate 3 values: TRUE, FALSE & NULL (NIL).
Thus, BOOLEAN columns are (should be) represented by a BAT with tail type (:)bit, which is (semantically) not the same as type TINYINT / (:)bte.
Best, Stefan
----- On Oct 21, 2015, at 3:07 PM, Dimitar Nedev dimitar.nedev@monetdbsolutions.com wrote:
Hey guys,
A boolean type column seems to fit in a byte, I guess the extra space is to represent nulls (since it ain't a qubit). But does that mean that no column type is actually ':bit'? Given a BAT, how to distinguish between a byte (tinyint) column and a boolean one?
Thanks, Dimitar
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) | _______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
participants (3)
-
Dimitar Nedev
-
Sjoerd Mullender
-
Stefan Manegold