Changeset: 82b8cec92520 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=82b8cec92520
Modified Files:
        gdk/gdk_select.c
Branch: default
Log Message:

Extended thetasubselect with operator <> / !=.
This is equivalent to a anti-select.


diffs (39 lines):

diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1356,9 +1356,10 @@ BATsubselect(BAT *b, BAT *s, const void 
  * candidates.  s should be sorted on the tail value.
  *
  * Theta select returns all values from b which are less/greater than
- * or equal to the provided value depending on the value of op.  Op is
- * a string with one of the values: "=", "==", "<", "<=", ">", ">="
- * (the first two are equivalent).  Theta select never returns nils.
+ * or (not) equal to the provided value depending on the value of op.
+ * Op is a string with one of the values: "=", "==", "<", "<=", ">",
+ * ">=", "<>", "!=" (the first two are equivalent and the last two are
+ * equivalent).  Theta select never returns nils.
  *
  * If value is nil, the result is empty.
  */
@@ -1378,6 +1379,10 @@ BATthetasubselect(BAT *b, BAT *s, const 
                /* "=" or "==" */
                return BATsubselect(b, s, val, NULL, 1, 1, 0);
        }
+       if (op[0] == '!' && op[1] == '=' && op[2] == 0) {
+               /* "!=" (equivalent to "<>") */
+               return BATsubselect(b, s, val, NULL, 1, 1, 1);
+       }
        if (op[0] == '<') {
                if (op[1] == 0) {
                        /* "<" */
@@ -1387,6 +1392,10 @@ BATthetasubselect(BAT *b, BAT *s, const 
                        /* "<=" */
                        return BATsubselect(b, s, nil, val, 0, 1, 0);
                }
+               if (op[1] == '>' && op[2] == 0) {
+                       /* "<>" (equivalent to "!=") */
+                       return BATsubselect(b, s, val, NULL, 1, 1, 1);
+               }
        }
        if (op[0] == '>') {
                if (op[1] == 0) {
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to