|
@@ -16,12 +16,21 @@
|
|
|
############################################################################## */
|
|
|
|
|
|
//version multiPart=false
|
|
|
+//version multiPart=true
|
|
|
+//version multiPart=false,useSequential=true
|
|
|
+//version multiPart=false,useSequential=true,useNoFold=true
|
|
|
+//version multiPart=false,useSequential=true,useNoFold=true,optRemoteRead=true
|
|
|
|
|
|
import ^ as root;
|
|
|
multiPart := #IFDEFINED(root.multiPart, false);
|
|
|
+useSequential := #IFDEFINED(root.useSequential, false);
|
|
|
+useNoFold := #IFDEFINED(root.useNoFold, false);
|
|
|
+optRemoteRead := #IFDEFINED(root.optRemoteRead, false);
|
|
|
|
|
|
//--- end of version configuration ---
|
|
|
|
|
|
+#option('forceRemoteRead', optRemoteRead);
|
|
|
+
|
|
|
import $.setup;
|
|
|
sq := setup.sq(multiPart);
|
|
|
|
|
@@ -31,7 +40,11 @@ sq := setup.sq(multiPart);
|
|
|
udecimal8 todaysDate := 20040602D;
|
|
|
unsigned4 age(udecimal8 dob) := ((todaysDate - dob) / 10000D);
|
|
|
|
|
|
-//MORE: books[1] ave(books)
|
|
|
+#if (useNoFold)
|
|
|
+protect(virtual dataset x) := NOFOLD(x);
|
|
|
+#else
|
|
|
+protect(virtual dataset x) := x;
|
|
|
+#end
|
|
|
|
|
|
// Different child operators, all inline.
|
|
|
house := sq.HousePersonBookDs.persons;
|
|
@@ -45,10 +58,16 @@ personsDsDs := sq.PersonDs(houseid = sq.HouseDs.id);
|
|
|
booksDsDsDs := sq.BookDs(personid = personsDsDs.id);
|
|
|
|
|
|
//Who has a book worth more than their book limit? (nest, nest), (nest, ds) (ds, ds)
|
|
|
-t1 := table(sq.HousePersonBookDs, { addr, max(persons,booklimit), max(persons.books,price), count(persons(exists(books(price>persons.booklimit)))); });
|
|
|
-t2 := table(sq.HousePersonBookDs, { addr, count(persons(exists(booksDs(price>persons.booklimit)))); });
|
|
|
-t3 := table(sq.HouseDs, { addr, count(personsDsDs(exists(booksDsDsDs(price>personsDs.booklimit)))); });
|
|
|
+t1 := table(protect(sq.HousePersonBookDs), { addr, max(persons,booklimit), max(persons.books,price), count(persons(exists(books(price>persons.booklimit)))); });
|
|
|
+t2 := table(protect(sq.HousePersonBookDs), { addr, count(persons(exists(booksDs(price>persons.booklimit)))); });
|
|
|
+t3 := table(protect(sq.HouseDs), { addr, count(personsDsDs(exists(booksDsDsDs(price>personsDs.booklimit)))); });
|
|
|
|
|
|
-output(t1,,named('NumPeopleExceedBookLimit'));
|
|
|
-output(t2,,named('NumPeopleExceedBookLimitDs'));
|
|
|
-output(t3,,named('NumPeopleExceedBookLimitDsDs'));
|
|
|
+#if (useSequential)
|
|
|
+SEQUENTIAL(
|
|
|
+#end
|
|
|
+ output(t1,,named('NumPeopleExceedBookLimit'));
|
|
|
+ output(t2,,named('NumPeopleExceedBookLimitDs'));
|
|
|
+ output(t3,,named('NumPeopleExceedBookLimitDsDs'));
|
|
|
+#if (useSequential)
|
|
|
+);
|
|
|
+#end
|