Changeset: 8f85d1dd4e0f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8f85d1dd4e0f
Modified Files:
        gdk/gdk.h
        gdk/gdk_atoms.c
        sql/common/sql_types.c
Branch: nilmask
Log Message:

small steps towards unsigned types


diffs (152 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -431,15 +431,20 @@ enum {
        TYPE_msk,               /* bit mask */
        TYPE_bit,               /* TRUE, FALSE, or nil */
        TYPE_bte,
+       TYPE_ubte,
        TYPE_sht,
+       TYPE_usht,
        TYPE_int,
+       TYPE_uint,
        TYPE_oid,
        TYPE_ptr,               /* C pointer! */
        TYPE_flt,
        TYPE_dbl,
        TYPE_lng,
+       TYPE_ulng,
 #ifdef HAVE_HGE
        TYPE_hge,
+       TYPE_uhge,
 #endif
        TYPE_date,
        TYPE_daytime,
@@ -718,6 +723,7 @@ typedef struct {
        bool key:1,             /* no duplicate values present */
                nonil:1,        /* there are no nils in the column */
                nil:1,          /* there is a nil in the column */
+               nilmask:1,      /* bat has nils seperated */
                sorted:1,       /* column is sorted in ascending order */
                revsorted:1,    /* column is sorted in descending order */
                ascii:1;        /* string column is fully ASCII (7 bit) */
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -1691,6 +1691,19 @@ atomDesc BATatoms[MAXATOMS] = {
                .atomCmp = (int (*)(const void *, const void *)) bteCmp,
                .atomHash = (BUN (*)(const void *)) bteHash,
        },
+       [TYPE_ubte] = {
+               .name = "ubte",
+               .storage = TYPE_bte,
+               .linear = true,
+               .size = sizeof(bte),
+               .atomNull = NULL,
+               .atomFromStr = (ssize_t (*)(const char *, size_t *, void **, 
bool)) bteFromStr,
+               .atomToStr = (ssize_t (*)(char **, size_t *, const void *, 
bool)) bteToStr,
+               .atomRead = (void *(*)(void *, size_t *, stream *, size_t)) 
bteRead,
+               .atomWrite = (gdk_return (*)(const void *, stream *, size_t)) 
bteWrite,
+               .atomCmp = (int (*)(const void *, const void *)) bteCmp,
+               .atomHash = (BUN (*)(const void *)) bteHash,
+       },
        [TYPE_sht] = {
                .name = "sht",
                .storage = TYPE_sht,
@@ -1704,6 +1717,19 @@ atomDesc BATatoms[MAXATOMS] = {
                .atomCmp = (int (*)(const void *, const void *)) shtCmp,
                .atomHash = (BUN (*)(const void *)) shtHash,
        },
+       [TYPE_usht] = {
+               .name = "usht",
+               .storage = TYPE_sht,
+               .linear = true,
+               .size = sizeof(sht),
+               .atomNull = NULL,
+               .atomFromStr = (ssize_t (*)(const char *, size_t *, void **, 
bool)) shtFromStr,
+               .atomToStr = (ssize_t (*)(char **, size_t *, const void *, 
bool)) shtToStr,
+               .atomRead = (void *(*)(void *, size_t *, stream *, size_t)) 
shtRead,
+               .atomWrite = (gdk_return (*)(const void *, stream *, size_t)) 
shtWrite,
+               .atomCmp = (int (*)(const void *, const void *)) shtCmp,
+               .atomHash = (BUN (*)(const void *)) shtHash,
+       },
        [TYPE_int] = {
                .name = "int",
                .storage = TYPE_int,
@@ -1717,6 +1743,19 @@ atomDesc BATatoms[MAXATOMS] = {
                .atomCmp = (int (*)(const void *, const void *)) intCmp,
                .atomHash = (BUN (*)(const void *)) intHash,
        },
+       [TYPE_uint] = {
+               .name = "uint",
+               .storage = TYPE_int,
+               .linear = true,
+               .size = sizeof(int),
+               .atomNull = NULL,
+               .atomFromStr = (ssize_t (*)(const char *, size_t *, void **, 
bool)) intFromStr,
+               .atomToStr = (ssize_t (*)(char **, size_t *, const void *, 
bool)) intToStr,
+               .atomRead = (void *(*)(void *, size_t *, stream *, size_t)) 
intRead,
+               .atomWrite = (gdk_return (*)(const void *, stream *, size_t)) 
intWrite,
+               .atomCmp = (int (*)(const void *, const void *)) intCmp,
+               .atomHash = (BUN (*)(const void *)) intHash,
+       },
        [TYPE_oid] = {
                .name = "oid",
                .linear = true,
@@ -1796,6 +1835,19 @@ atomDesc BATatoms[MAXATOMS] = {
                .atomCmp = (int (*)(const void *, const void *)) lngCmp,
                .atomHash = (BUN (*)(const void *)) lngHash,
        },
+       [TYPE_ulng] = {
+               .name = "ulng",
+               .storage = TYPE_lng,
+               .linear = true,
+               .size = sizeof(lng),
+               .atomNull = NULL,
+               .atomFromStr = (ssize_t (*)(const char *, size_t *, void **, 
bool)) lngFromStr,
+               .atomToStr = (ssize_t (*)(char **, size_t *, const void *, 
bool)) lngToStr,
+               .atomRead = (void *(*)(void *, size_t *, stream *, size_t)) 
lngRead,
+               .atomWrite = (gdk_return (*)(const void *, stream *, size_t)) 
lngWrite,
+               .atomCmp = (int (*)(const void *, const void *)) lngCmp,
+               .atomHash = (BUN (*)(const void *)) lngHash,
+       },
 #ifdef HAVE_HGE
        [TYPE_hge] = {
                .name = "hge",
@@ -1810,6 +1862,19 @@ atomDesc BATatoms[MAXATOMS] = {
                .atomCmp = (int (*)(const void *, const void *)) hgeCmp,
                .atomHash = (BUN (*)(const void *)) hgeHash,
        },
+       [TYPE_uhge] = {
+               .name = "uhge",
+               .storage = TYPE_hge,
+               .linear = true,
+               .size = sizeof(hge),
+               .atomNull = NULL,
+               .atomFromStr = (ssize_t (*)(const char *, size_t *, void **, 
bool)) hgeFromStr,
+               .atomToStr = (ssize_t (*)(char **, size_t *, const void *, 
bool)) hgeToStr,
+               .atomRead = (void *(*)(void *, size_t *, stream *, size_t)) 
hgeRead,
+               .atomWrite = (gdk_return (*)(const void *, stream *, size_t)) 
hgeWrite,
+               .atomCmp = (int (*)(const void *, const void *)) hgeCmp,
+               .atomHash = (BUN (*)(const void *)) hgeHash,
+       },
 #endif
        [TYPE_date] = {
                .name = "date",
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1050,6 +1050,13 @@ sqltypeinit( allocator *sa)
                sql_create_func(sa, "right_shift", "geom", "mbrRight", TRUE, 
FALSE, SCALE_FIX, 0, BIT, 2, MBR, MBR);
        }
 
+       *t++ = sql_create_type(sa, "UTINYINT",   8, SCALE_FIX, 2, EC_NUM, 
"ubte");
+       *t++ = sql_create_type(sa, "USMALLINT", 16, SCALE_FIX, 2, EC_NUM, 
"usht");
+       *t++ = sql_create_type(sa, "UINT",      32, SCALE_FIX, 2, EC_NUM, 
"uint");
+       *t++ = sql_create_type(sa, "UBIGINT",   64, SCALE_FIX, 2, EC_NUM, 
"ulng");
+#ifdef HAVE_HGE
+               *t++ = sql_create_type(sa, "UHUGEINT",  128, SCALE_FIX, 2, 
EC_NUM, "uhge");
+#endif
        *t = NULL;
 
        /* The grouping aggregate doesn't have a backend implementation. It 
gets replaced at rel_unnest */
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to