194 lines
5.1 KiB
Plaintext
194 lines
5.1 KiB
Plaintext
#This file is part of SECONDO.
|
|
#
|
|
#Copyright (C) 2004, University in Hagen, Department of Computer Science,
|
|
#Database Systems for New Applications.
|
|
#
|
|
#SECONDO is free software; you can redistribute it and/or modify
|
|
#it under the terms of the GNU General Public License as published by
|
|
#the Free Software Foundation; either version 2 of the License, or
|
|
#(at your option) any later version.
|
|
#
|
|
#SECONDO is distributed in the hope that it will be useful,
|
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
#GNU General Public License for more details.
|
|
#
|
|
#You should have received a copy of the GNU General Public License
|
|
#along with SECONDO; if not, write to the Free Software
|
|
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
|
|
|
|
# A fresh restored opt database needs to be present for
|
|
# this test
|
|
|
|
#setup partstreamtest
|
|
|
|
open database opt;
|
|
|
|
# the conventions for commands are the same as in SecondoTTYBDB
|
|
# make sure that commands are always terminated
|
|
# (either by a semicolon or by a newline)
|
|
|
|
# a TESTCASE consists of a TESTCASE declarative followed
|
|
# by a YIELDS declarative followed by a command.
|
|
# multiple or no commands after a YIELD directive
|
|
# will confuse the TestRunner
|
|
|
|
# the expected output specified by the YIELD declarative
|
|
# is converted to a ListExpr and the TestRunner compares
|
|
# it to Secondo's actual output by calling
|
|
# NestedList->Equal
|
|
|
|
# 1 - Construction of stream(ptuple(y))
|
|
|
|
#testcase pfeed-1
|
|
#yields (bool TRUE)
|
|
query plz pfeed[100] pdelete count = (plz count);
|
|
|
|
#testcase pfeed-2
|
|
#yields (bool TRUE)
|
|
query plz pfeed[1] pdelete count = (plz count);
|
|
|
|
#testcase pfeed-3
|
|
#yields (bool TRUE)
|
|
query plz pfeed[42100] pdelete count = (plz count);
|
|
|
|
#testcase pfeed-4
|
|
#yields (bool TRUE)
|
|
query plz pfeed[45000] pdelete count = (plz count);
|
|
|
|
#testcase pfeed-5
|
|
#yields error
|
|
query plz feed pfeed[100] count;
|
|
|
|
#testcase pfeed-6
|
|
#yields error
|
|
query plz pdelete count;
|
|
|
|
|
|
# 2 - Operations on stream(ptuple(y))
|
|
|
|
|
|
#testcase puse-1
|
|
#yields (int 5)
|
|
query plz pfeed[100] puse [. head[5] ] pdelete count
|
|
|
|
#testcase puse-2
|
|
#yields (int 165)
|
|
query plz pfeed[100] puse [. filter[.Ort = "Dortmund"] ] pdelete count
|
|
|
|
#testcase puse-3
|
|
#yields (int 41267)
|
|
query plz pfeed[100] puse [. extend[Pck: .PLZ mod 10] ] pdelete count
|
|
|
|
#testcase puse-4a
|
|
#yields error
|
|
query plz pfeed[100] puse [. count ] pdelete count
|
|
|
|
#testcase puse-4b
|
|
#yields success
|
|
query plz pfeed[100] puse [. filter[.PLZ > 50000] ] pdelete count
|
|
|
|
#testcase puse-4c
|
|
#yields success
|
|
query plz pfeed[100] puse [. filter[.PLZ < 50000] ] pdelete count
|
|
|
|
#testcase puse-5
|
|
#yields error
|
|
query plz feed puse [. head[5] ] pdelete count
|
|
|
|
#testcase puse-6
|
|
#yields (int 8)
|
|
query ten pfeed[10] puse[. filter[.No > 2]] pdelete count;
|
|
|
|
#testcase puse-7
|
|
#yields (int 100)
|
|
query ten pfeed[2] puse[(.) plz feed head[10] product] pdelete count
|
|
|
|
# 3 - Operations on stream(ptuple(y)) x stream(ptuple(z))
|
|
|
|
#testcase pjoin2-1
|
|
#yields success
|
|
query
|
|
plz pfeed[100] puse[. project[PLZ] {a} ]
|
|
plz pfeed[100] puse[. project[PLZ] {b} ]
|
|
pjoin2[ symj: . .. symmjoin[(.PLZ_a = ..PLZ_b)],
|
|
hj: . .. hashjoin[PLZ_a, PLZ_b, 997],
|
|
smj: . .. sortmergejoin[PLZ_a, PLZ_b]
|
|
]
|
|
pdelete
|
|
count;
|
|
|
|
#testcase pjoin2-2
|
|
#yields success
|
|
query
|
|
Staedte pfeed[100] puse[. project[SName] {a} ]
|
|
plz pfeed[100] puse[. project[Ort] {b} ]
|
|
pjoin2[ symj: . .. symmjoin[(.SName_a = ..Ort_b)],
|
|
hj: . .. hashjoin[SName_a, Ort_b, 997],
|
|
smj: . .. sortmergejoin[SName_a, Ort_b]
|
|
]
|
|
pdelete
|
|
count;
|
|
|
|
|
|
|
|
#Example for expressing an index join with the PartStreamAlgebra!
|
|
#testcase pjoin1-1
|
|
#yields success
|
|
query
|
|
Staedte pfeed[100] puse[. {arg1}]
|
|
plz
|
|
pjoin1[ 1; symj: . .. feed head[1000] {1} filter[.PLZ < 50000] head[500] {2} symmjoin[.SName_arg1 = ..Ort],
|
|
smj: . .. feed filter[.PLZ < 50000] {3} sortmergejoin[SName_arg1, Ort],
|
|
hj: . .. feed filter[.PLZ < 50000] {3} hashjoin[SName_arg1, Ort, 997],
|
|
ilj: . loopjoin[fun(t1: TUPLE) plz_Ort .. exactmatch[attr(t1, SName_arg1)] filter[.PLZ < 50000] {3} ]
|
|
]
|
|
pdelete
|
|
count;
|
|
|
|
#testcase pjoin1-2
|
|
#yields success
|
|
query
|
|
Staedte pfeed[100] puse[. {arg1}]
|
|
plz
|
|
pjoin1[ 4; symj: . .. feed head[1000] {4} head[500] {5} symmjoin[.SName_arg1 = ..Ort],
|
|
smj: . .. feed {6} sortmergejoin[SName_arg1, Ort],
|
|
hj: . .. feed {6} hashjoin[SName_arg1, Ort, 997],
|
|
ilj: . loopjoin[fun(t1: TUPLE) plz_Ort .. exactmatch[attr(t1, SName_arg1)] {6} ]
|
|
]
|
|
pdelete
|
|
count;
|
|
|
|
|
|
#testcase pjoin1-3
|
|
#yields success
|
|
query
|
|
Staedte pfeed[100] puse[. {arg1}]
|
|
plz
|
|
pjoin1[ 1; symj: . .. feed head[1000] {1} head[500] {2} symmjoin[.SName_arg1 = ..Ort],
|
|
smj: . .. feed {3} sortmergejoin[SName_arg1, Ort],
|
|
hj: . .. feed {3} hashjoin[SName_arg1, Ort, 997],
|
|
ilj: . loopjoin[plz_Ort .. exactmatch[.SName_arg1] {3} ]
|
|
]
|
|
pdelete
|
|
count;
|
|
|
|
|
|
# Example for expressing an index based selection
|
|
#testcase pcreate-1
|
|
#yields success
|
|
query
|
|
plz_Ort plz exactmatch["Dortmund"] pcreate[100] pdelete count;
|
|
|
|
|
|
#testcase pshow-1
|
|
#yields success
|
|
query plz pfeed[1000] pshow pdelete count;
|
|
|
|
#teardown
|
|
|
|
close database;
|
|
|