Changeset: 7434a29cfb36 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7434a29cfb36
Modified Files:
        gdk/gdk_cand.c
        gdk/gdk_join.c
        gdk/gdk_private.h
Branch: unlock
Log Message:

Properly check for candidate list.


diffs (59 lines):

diff --git a/gdk/gdk_cand.c b/gdk/gdk_cand.c
--- a/gdk/gdk_cand.c
+++ b/gdk/gdk_cand.c
@@ -11,6 +11,18 @@
 #include "gdk_private.h"
 #include "gdk_cand.h"
 
+bool
+BATiscand(BAT *b)
+{
+       if (b->ttype == TYPE_msk)
+               return true;
+       if (ATOMtype(b->ttype) != TYPE_oid)
+               return false;
+       if (b->ttype == TYPE_void && is_oid_nil(b->tseqbase))
+               return false;
+       return BATtordered(b) && BATtkey(b);
+}
+
 /* create a new, dense candidate list with values from `first' up to,
  * but not including, `last' */
 static inline BAT *
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -84,19 +84,8 @@ joinparamcheck(BAT *l, BAT *r1, BAT *r2,
                GDKerror("%s: right inputs not aligned.\n", func);
                return GDK_FAIL;
        }
-       if ((sl && ATOMtype(sl->ttype) != TYPE_oid) ||
-           (sr && ATOMtype(sr->ttype) != TYPE_oid)) {
-               GDKerror("%s: candidate lists must have type OID.\n", func);
-               return GDK_FAIL;
-       }
-       if ((sl && !BATtordered(sl)) ||
-           (sr && !BATtordered(sr))) {
-               GDKerror("%s: candidate lists must be sorted.\n", func);
-               return GDK_FAIL;
-       }
-       if ((sl && !BATtkey(sl)) ||
-           (sr && !BATtkey(sr))) {
-               GDKerror("%s: candidate lists must be unique.\n", func);
+       if (!BATiscand(sl) || !BATiscand(sr)) {
+               GDKerror("%s: argument not a candidate list.\n", func);
                return GDK_FAIL;
        }
        return GDK_SUCCEED;
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -78,6 +78,8 @@ gdk_return BAThashsave(BAT *b, bool dosy
        __attribute__((__visibility__("hidden")));
 void BATinit_idents(BAT *bn)
        __attribute__((__visibility__("hidden")));
+bool BATiscand(BAT *b)
+       __attribute__((__visibility__("hidden")));
 BAT *BATload_intern(bat bid, bool lock)
        __attribute__((__visibility__("hidden")));
 gdk_return BATmaterialize(BAT *b)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to