├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── aclocal.m4 ├── compile ├── config.guess ├── config.sub ├── configure ├── configure.ac ├── contrib ├── Makefile.am ├── Makefile.in ├── README └── fbmerge │ ├── Makefile.am │ ├── Makefile.in │ ├── fbmerge.cpp │ ├── fbmerge.sln │ └── fbmerge.vcproj ├── depcomp ├── doc ├── contact.html ├── dataDistributions.html ├── dataLoading.html ├── footer.html ├── header.html ├── ibisCommandLine.html ├── index.html ├── indexSpec.html ├── quickstart.html └── rara.html ├── examples ├── Makefile.am ├── Makefile.in ├── README ├── ardea.cpp ├── ibis.cpp ├── rara.cpp ├── tcapi.c ├── thula.cpp └── tiapi.c ├── install-sh ├── java ├── FastBit.c ├── FastBit.h ├── Makefile.am ├── Makefile.in ├── README ├── build.xml ├── gov │ └── lbl │ │ └── fastbit │ │ ├── FastBit.java │ │ ├── FastBitStringReader.java │ │ ├── FastBitStringReaderException.java │ │ ├── FastBitStringWriter.java │ │ └── FastBitStringWriterException.java ├── milky.java └── tests │ ├── README │ ├── TestFastBitJava.java │ ├── lib │ ├── commons-logging.jar │ ├── junit-4.4.jar │ └── log4j-1.2.15.jar │ └── log4j.properties ├── ltmain.sh ├── missing ├── runconfig ├── src ├── Doxyfile ├── Makefile.am ├── Makefile.in ├── array_t.cpp ├── array_t.h ├── bitvector.cpp ├── bitvector.h ├── bitvector64.cpp ├── bitvector64.h ├── blob.cpp ├── blob.h ├── bord.cpp ├── bord.h ├── bordm.cpp ├── bundle.cpp ├── bundle.h ├── capi.cpp ├── capi.h ├── category.cpp ├── category.h ├── colValues.cpp ├── colValues.h ├── column.cpp ├── column.h ├── const.h ├── countQuery.cpp ├── countQuery.h ├── dictionary.cpp ├── dictionary.h ├── fastbit-0.7.pc.in ├── fastbit-config.h.in ├── fileManager.cpp ├── fileManager.h ├── filter.cpp ├── filter.h ├── fromClause.cpp ├── fromClause.h ├── fromLexer.cc ├── fromLexer.h ├── fromLexer.ll ├── fromParser.cc ├── fromParser.hh ├── fromParser.yy ├── horometer.h ├── iapi.cpp ├── iapi.h ├── ibin.cpp ├── ibin.h ├── ibis.h ├── icegale.cpp ├── icentre.cpp ├── icmoins.cpp ├── idbak.cpp ├── idbak2.cpp ├── idirekte.cpp ├── idirekte.h ├── ifade.cpp ├── ikeywords.cpp ├── ikeywords.h ├── imesa.cpp ├── index.cpp ├── index.h ├── irange.cpp ├── irelic.cpp ├── irelic.h ├── iroster.cpp ├── iroster.h ├── isapid.cpp ├── isbiad.cpp ├── iskive.cpp ├── islice.cpp ├── ixambit.cpp ├── ixbylt.cpp ├── ixfuge.cpp ├── ixfuzz.cpp ├── ixpack.cpp ├── ixpale.cpp ├── ixzona.cpp ├── ixzone.cpp ├── jnatural.cpp ├── jnatural.h ├── jrange.cpp ├── jrange.h ├── location.hh ├── mensa.cpp ├── mensa.h ├── meshQuery.cpp ├── meshQuery.h ├── part.cpp ├── part.h ├── parth.cpp ├── parth2d.cpp ├── parth3d.cpp ├── parth3da.cpp ├── parth3db.cpp ├── parth3dw.cpp ├── parti.cpp ├── party.cpp ├── position.hh ├── qExpr.cpp ├── qExpr.h ├── quaere.cpp ├── quaere.h ├── query.cpp ├── query.h ├── resource.cpp ├── resource.h ├── rids.cpp ├── rids.h ├── selectClause.cpp ├── selectClause.h ├── selectLexer.cc ├── selectLexer.h ├── selectLexer.ll ├── selectParser.cc ├── selectParser.hh ├── selectParser.yy ├── stack.hh ├── tab.h ├── table.h ├── tafel.cpp ├── tafel.h ├── twister.h ├── util.cpp ├── util.h ├── utilidor.cpp ├── utilidor.h ├── whereClause.cpp ├── whereClause.h ├── whereLexer.cc ├── whereLexer.h ├── whereLexer.ll ├── whereParser.cc ├── whereParser.hh └── whereParser.yy ├── tests ├── Makefile.am ├── Makefile.in ├── README ├── acmpub.csv ├── acmpub.v.a ├── acmpub.v.b ├── inRange.cpp ├── jrf.cpp ├── js2.csv ├── m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ └── lt~obsolete.m4 ├── marksdb.csv ├── maurel.csv ├── readcsv.cpp ├── scripts │ ├── fastbit-config.in │ ├── hcompare.pl │ ├── jrf-check.pl │ ├── matchCounts.pl │ ├── printWarning.pl │ ├── query-count.list │ └── star2002.sh ├── setqgen.cpp ├── smatch.cpp ├── test0.csv ├── test1.csv └── vault │ ├── acmpub-0 │ ├── acmpub-1 │ ├── acmpub-2 │ ├── hist0 │ ├── hist1 │ ├── hist2 │ ├── hist3 │ ├── hist4 │ ├── hist5 │ ├── hist6 │ ├── inRange-1 │ ├── join-1 │ ├── join-2 │ ├── join-3 │ ├── join-4 │ ├── join-5 │ ├── join-6 │ ├── join-7 │ ├── join-8 │ ├── marksdb-1 │ ├── marksdb-3 │ ├── marksdb-4 │ ├── small-1 │ ├── small-10 │ ├── small-11 │ ├── small-12 │ ├── small-2 │ ├── small-3 │ ├── small-4 │ ├── small-5 │ ├── small-6 │ ├── small-7 │ ├── smatch-1 │ ├── tcapi-3 │ ├── text-0 │ ├── thula-0 │ └── thula-1 └── win ├── FlexLexer.h ├── MinGW.mak ├── README ├── Win.mak ├── ardea.vcproj ├── ardea.vcxproj ├── dll.vcproj ├── dll.vcxproj ├── ibis.sln ├── ibis.vcproj ├── ibis.vcxproj ├── java.vcproj ├── java.vcxproj ├── rara.vcproj ├── rara.vcxproj ├── setqgen.vcproj ├── setqgen.vcxproj ├── static_pthread.patch ├── static_pthread_init.c ├── tcapi.vcproj ├── tcapi.vcxproj ├── thula.vcproj ├── thula.vcxproj ├── trydll.cpp ├── trydll.vcproj ├── trydll.vcxproj └── xMinGW.mak /AUTHORS: -------------------------------------------------------------------------------- 1 | John Wu 2 | With support from Kurt Stockinger, Ekow Otoo and Arie Shoshani 3 | 4 | 5 | With contributions in the form of sources code, patches, data files and 6 | test queries from (in chronological order of the first contribution): 7 | Aaron Hong 8 | Mark Sordo 9 | Jochen Schlosser 10 | David Kantowitz 11 | Matthias Vallentin 12 | Andrey Kolchanov 13 | Norbert Heusser 14 | David B. Marks 15 | Alexandre Maurel 16 | Jan Steemann 17 | Luca Deri 18 | Andreas Streichardt 19 | Shiran Pasternak 20 | Bernd Jaenichen 21 | Jon Strabala 22 | Chen Hang 23 | Justin Swanhart 24 | Divya Chandrasekar 25 | Petr Valen 26 | 27 | 28 | 29 | Many users have identified bugs and suggested fixes, their names are 30 | mentioned in ChangeLog together with the bugs and suggestions. 31 | 32 | Contributors with code in the directory contrib are listed with their code. 33 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | "FastBit, Copyright (c) 2014, The Regents of the University of 2 | California, through Lawrence Berkeley National Laboratory (subject to 3 | receipt of any required approvals from the U.S. Dept. of Energy). All 4 | rights reserved." 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | (1) Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | (2) Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | (3) Neither the name of the University of California, Lawrence Berkeley 18 | National Laboratory, U.S. Dept. of Energy nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 23 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 24 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 26 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | 34 | You are under no obligation whatsoever to provide any bug fixes, 35 | patches, or upgrades to the features, functionality or performance of 36 | the source code ("Enhancements") to anyone; however, if you choose to 37 | make your Enhancements available either publicly, or directly to 38 | Lawrence Berkeley National Laboratory, without imposing a separate 39 | written license agreement for such Enhancements, then you hereby grant 40 | the following license: a non-exclusive, royalty-free perpetual license 41 | to install, use, modify, prepare derivative works, incorporate into 42 | other computer software, distribute, and sublicense such enhancements or 43 | derivative works thereof, in binary and source code form. 44 | 45 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS=gnu 2 | ACLOCAL_AMFLAGS=-I tests/m4 3 | SUBDIRS = src examples java tests contrib 4 | bin_SCRIPTS = tests/scripts/fastbit-config 5 | EXTRA_DIST = runconfig win/README win/Win.mak win/MinGW.mak win/ardea.vcproj \ 6 | win/ibis.sln win/ibis.vcproj win/thula.vcproj win/tcapi.vcproj \ 7 | win/trydll.cpp win/dll.vcproj win/trydll.vcproj win/java.vcproj \ 8 | win/FlexLexer.h contrib/README contrib/fbmerge/fbmerge.cpp \ 9 | contrib/fbmerge/Makefile.am contrib/fbmerge/Makefile.in \ 10 | contrib/fbmerge/fbmerge.sln contrib/fbmerge/fbmerge.vcproj 11 | 12 | dist_doc_DATA = doc/dataDistributions.html \ 13 | doc/index.html doc/quickstart.html doc/dataLoading.html \ 14 | doc/ibisCommandLine.html doc/indexSpec.html doc/footer.html 15 | 16 | docs: 17 | cd src && $(MAKE) docs 18 | 19 | # three levels of thoroughness are available for checking the 20 | # correctness of FastBit functions: check, more-check, and full-check. 21 | # The normal check may take about a few seconds on a typical Linux machine, 22 | # more-check takes about ten to fifteen minutes, while full-check takes 23 | # several hours. 24 | more-check: 25 | cd tests && $(MAKE) more-check 26 | 27 | full-check: 28 | cd tests && $(MAKE) full-check 29 | 30 | clean: clean-recursive 31 | -rm -f win/*.suo win/*.ncb win/*/*.suo win/*/*.ncb win/*.obj win/*.lib win/*.exe win/*.exe.* win/*/*.obj win/*/*.lib win/*/*.exe win/*/*.exe.* win/fastbit.def 32 | -rm -fr autom4te.cache doc/html doc/latex win/Debug win/Release win/*/Debug win/*/Release win/dll win/*.vcproj.* win/*/*.vcproj.* 33 | 34 | distclean: distclean-recursive 35 | -rm -f $(am__CONFIG_DISTCLEAN_FILES) Makefile win/*.suo win/*.ncb win/*.obj win/*.exe win/*.exe.* win/*/*.suo win/*/*.ncb win/*/*.obj win/*/*.exe win/*/*.exe.* 36 | -rm -fr autom4te.cache doc/html doc/latex win/Debug win/Release win/*/Debug win/*/Release win/dll win/*.vcproj.* win/*/*.vcproj.* 37 | 38 | maintainer-clean: maintainer-clean-am 39 | -rm -rf ./$(DEPDIR) autom4te.cache 40 | -rm -f Makefile 41 | 42 | #dist-hook: 43 | # -rm -rf `find $(distdir) \( -name CVS -o \name .svn \)` 44 | 45 | .PHONY: docs more-check full-check 46 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | *** COMPILING ON WINDOWS *** 2 | As of 2014, FastBit source code starts to make use of some C++11x 3 | features that are not supported yet in MS Visual Studio, therefore, 4 | there is no way to compile with Visual Studio until C++0x is 5 | supported. However, it is possible to compile with CYGWIN. 6 | **************************** 7 | 8 | 9 | 10 | This directory contains the current version of FastBit (code named 11 | IBIS). Please report any problem you've encountered in using this 12 | package to . 13 | 14 | Please feel free to post any success story or paper you wrote that makes 15 | use of FastBit in some way. Your success stories will be encouragement 16 | for the developers and users. 17 | 18 | 19 | This software is packaged with GNU build tools. On systems that 20 | support such tools, you should be able to build it by running the 21 | following two commands in this directory 22 | 23 | ./configure 24 | make 25 | 26 | Due to the uses of a number of C++11 features, such as, unique_ptr and 27 | unordered_map, the current version of the source code requires GCC 4.8 28 | or clang 3.5 to compile. If your C++ compiler supports C++11, please 29 | give it a try and let us know. 30 | 31 | Further information about installation is available in file INSTALL in 32 | this directory. For installation on a MS Windows system using Visual 33 | Studio, follow instructions in win/README. 34 | 35 | To check the correctness of the build, run the following command 36 | 37 | make check 38 | 39 | Read the file README in tests directory to find out more about the tests. 40 | 41 | The main body of the source code is located in directory src. The code 42 | is built into a single library named libfastbit.la on systems with 43 | libtools. 44 | 45 | Some examples of using the library are located in the directory examples. 46 | The following is a brief description of the four examples. 47 | 48 | -- ibis.cpp exercises much of the functions of the lower level indexing 49 | functions. 50 | -- tcapi.c is an example of using the C API querying defined in capi.h. 51 | -- thula.cpp exercises the querying interface defined in class 52 | ibis::table. 53 | -- ardea.cpp exercises the functions to extend a table (API defined in 54 | ibis::tablex). 55 | 56 | The directory doc contains a number of HTML files that documents key 57 | features of FastBit. In particular, the file quickstart.html contains 58 | brief instructions for basic tasks and should be useful starting for 59 | those not familiar with FastBit already. 60 | 61 | There is considerable amount of in-line documentation in the source 62 | code; execute the following command to invoke doxygen and extract the 63 | in-line documentation 64 | 65 | make docs 66 | 67 | The resulting documentation is in directory doc/html. 68 | Alternatively, you may view the on-line version of the documents at 69 | http://sdm.lbl.gov/fastbit/doc/. 70 | 71 | 72 | The FastBit mailing list could be a valuable resource. It is archived 73 | on line at http://hpcrdm.lbl.gov/mailman/private/fastbit-users/. If you have 74 | question not answered in the documents or the mailing list, post your 75 | questions to the FastBit mailing list. You need to first join the 76 | mailing list by visiting 77 | https://hpcrdm.lbl.gov/mailman/listinfo/fastbit-users. 78 | 79 | Before reporting a problem, it might be helpful to check whether the 80 | problem still exist with the current source code. A nightly snapshot of 81 | the SVN repository for the code is available for download at 82 | . The snapshot is 83 | built daily between 2 and 3 AM Pacific Time zone (USA). 84 | -------------------------------------------------------------------------------- /contrib/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS=gnu 2 | SUBDIRS = fbmerge 3 | 4 | #EXTRA_DIST = README 5 | -------------------------------------------------------------------------------- /contrib/README: -------------------------------------------------------------------------------- 1 | This directory contains contributed code. It may carry its own license, 2 | not necessarily the LGPL license used by the main FastBit code. 3 | 4 | -------------------------------------------------------------------------------- /contrib/fbmerge/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS=gnu 2 | EXTRA_DIST = fbmerge.sln fbmerge.vcproj 3 | 4 | bin_PROGRAMS = fbmerge 5 | fbmerge_SOURCES = fbmerge.cpp 6 | fbmerge_DEPENDENCIES = ../../src/libfastbit.la 7 | fbmerge_LDADD = ../../src/libfastbit.la 8 | # 9 | ../../src/libfastbit.la:: 10 | cd ../../src && $(MAKE) libfastbit.la 11 | 12 | distclean-local: 13 | -rm -rf .ibis 14 | -------------------------------------------------------------------------------- /contrib/fbmerge/fbmerge.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbmerge", "fbmerge.vcproj", "{E9D5FF9E-4058-4ECE-ABDC-3FC947D87C7F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {E9D5FF9E-4058-4ECE-ABDC-3FC947D87C7F}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {E9D5FF9E-4058-4ECE-ABDC-3FC947D87C7F}.Debug|Win32.Build.0 = Debug|Win32 14 | {E9D5FF9E-4058-4ECE-ABDC-3FC947D87C7F}.Release|Win32.ActiveCfg = Release|Win32 15 | {E9D5FF9E-4058-4ECE-ABDC-3FC947D87C7F}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /doc/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | FastBit Contact Information 9 | 10 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
FastBit 23 |
 FastBit Front PageResearch PublicationsSoftware DocumentationSoftware DownloadSoftware License 
35 |

36 | Organization: LBNL » 37 | CRD » 38 | SDM » 39 | FastBit » 40 | Documentation

41 | 42 |

Contacts

43 | 44 |
45 | 54 |
55 | 56 |

57 | Please join the 58 | FastBit 59 | mailing list to post your questions and share your experience. This 60 | is our preferred means of contacting us. It gives us a way to 61 | keep track of 62 | the exchanges. The users on the list can also keep us accountable. 63 | However, if you would prefer a less public channel to contact us, you 64 | may email one of the following persons: 65 |

71 |

72 | 73 | 83 | 84 | 87 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /doc/footer.html: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 16 |
5 | 14 | 15 |
17 | Make It A Bit Faster 20 | 21 |
22 | Contact us
23 | Disclaimers
24 | FastBit source code
25 | FastBit 26 | mailing list archive
27 | 30 |
31 |
32 | 33 | 36 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /doc/header.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | $title ($projectnumber) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS=gnu 2 | bin_PROGRAMS = ibis tcapi thula ardea rara tiapi 3 | #EXTRA_PROGRAMS = 4 | ibis_SOURCES = ibis.cpp 5 | ibis_DEPENDENCIES = ../src/libfastbit.la 6 | ibis_LDADD = ../src/libfastbit.la 7 | rara_SOURCES = rara.cpp 8 | rara_DEPENDENCIES = ../src/libfastbit.la 9 | rara_LDADD = ../src/libfastbit.la 10 | thula_SOURCES = thula.cpp 11 | thula_DEPENDENCIES = ../src/libfastbit.la 12 | thula_LDADD = ../src/libfastbit.la 13 | ardea_SOURCES = ardea.cpp 14 | ardea_DEPENDENCIES = ../src/libfastbit.la 15 | ardea_LDADD = ../src/libfastbit.la 16 | tcapi_SOURCES = tcapi.c 17 | tcapi_DEPENDENCIES = ../src/libfastbit.la 18 | tcapi_LDADD = ../src/libfastbit.la 19 | tiapi_SOURCES = tiapi.c 20 | tiapi_DEPENDENCIES = ../src/libfastbit.la 21 | tiapi_LDADD = ../src/libfastbit.la 22 | # 23 | ../src/libfastbit.la:: 24 | cd ../src && $(MAKE) libfastbit.la 25 | # has to be linked with $(CXXLINK) 26 | tcapi$(EXEEXT): tcapi.$(OBJEXT) $(tcapi_LDADD) 27 | $(CXXLINK) tcapi.$(OBJEXT) $(tcapi_LDADD) $(LIBS) 28 | tiapi$(EXEEXT): tiapi.$(OBJEXT) $(tiapi_LDADD) 29 | $(CXXLINK) tiapi.$(OBJEXT) $(tiapi_LDADD) $(LIBS) 30 | 31 | clean-local: 32 | -rm -rf *.dSYM .ibis 33 | 34 | distclean-local: 35 | -rm -rf *.dSYM .ibis 36 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | This directory contains a few relative simple examples. 2 | 3 | ibis.cpp -- this program demonstrates how to use the lower-level data 4 | partitions directly. This is also the program used for 5 | tests defined in directory ../tests. 6 | 7 | thula.cpp -- this program demonstrates how to use the ibis::table 8 | interface. It can only perform queries. 9 | 10 | ardea.cpp -- this program demonstrates how to use the ibis::tablex 11 | interface to add new data records. It supports additions of 12 | data both through columns and rows, but does not support 13 | queries. 14 | 15 | tcapi.c -- this program demonstrates how to use the C API for accessing 16 | FastBit functions. Since it requires a C++ compiler to make an 17 | executable, it is a not particularly useful in itself. However, 18 | it is useful for exporting FastBit functions to other languages. 19 | -------------------------------------------------------------------------------- /examples/rara.cpp: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // Author: John Wu Lawrence Berkeley National Laboratory 3 | // Copyright (c) 2008-2016 the Regents of the University of California 4 | /** @file rara.cpp 5 | 6 | This is meant to be the simplest test program for the querying 7 | functions of ibis::query and ibis::part. It accepts the following 8 | fixed list of arguments to simplify the program: 9 | 10 | data-dir query-conditions [column-to-print [column-to-print ...]] 11 | 12 | The data-dir must exist and contain valid data files and query 13 | conditions much be specified as well. If no column-to-print, this 14 | program effective is answering the following SQL query 15 | 16 | SELECT count(*) FROM data-dir WHERE query-conditions 17 | 18 | If any column-to-print is specified, all of them are concatenated 19 | together and the SQL query answered is of the form 20 | 21 | SELECT column-to-print, column-to-print, ... FROM data-dir WHERE query-conditions 22 | 23 | About the name: Bostrychia rara, Spot-breasted Ibis, the smallest ibis 24 | . As an example 25 | program for using FastBit IBIS, this might be also the smallest. 26 | 27 | @ingroup FastBitExamples 28 | */ 29 | #include "ibis.h" // FastBit IBIS primary include file 30 | 31 | // printout the usage string 32 | static void usage(const char* name) { 33 | std::cout << "usage:\n" << name << " data-dir query-conditions" 34 | << " [column-to-print [column-to-print ...]]\n" 35 | << std::endl; 36 | } // usage 37 | 38 | int main(int argc, char** argv) { 39 | if (argc < 3) { 40 | usage(*argv); 41 | return -1; 42 | } 43 | 44 | // construct a data partition from the given data directory. 45 | ibis::part apart(argv[1], static_cast(0)); 46 | // create a query object with the current user name. 47 | ibis::query aquery(ibis::util::userName(), &apart); 48 | // assign the query conditions as the where clause. 49 | int ierr = aquery.setWhereClause(argv[2]); 50 | if (ierr < 0) { 51 | std::clog << *argv << " setWhereClause(" << argv[2] 52 | << ") failed with error code " << ierr << std::endl; 53 | return -2; 54 | } 55 | // collect all column-to-print together 56 | std::string sel; 57 | for (int j = 3; j < argc; ++ j) { 58 | if (j > 3) 59 | sel += ", "; 60 | sel += argv[j]; 61 | } 62 | if (sel.empty()) { // select count(*)... 63 | ierr = aquery.evaluate(); // evaluate the query 64 | std::cout << "SELECT count(*) FROM " << argv[1] << " WHERE " 65 | << argv[2] << "\n--> "; 66 | if (ierr >= 0) { 67 | std::cout << aquery.getNumHits(); 68 | } 69 | else { 70 | std::cout << "error " << ierr; 71 | } 72 | } 73 | else { // select column-to-print... 74 | ierr = aquery.setSelectClause(sel.c_str()); 75 | if (ierr < 0) { 76 | std::clog << *argv << " setSelectClause(" << sel 77 | << ") failed with error code " << ierr << std::endl; 78 | return -3; 79 | } 80 | ierr = aquery.evaluate(); // evaluate the query 81 | std::cout << "SELECT " << sel << " FROM " << argv[1] << " WHERE " 82 | << argv[2] << "\n--> "; 83 | if (ierr >= 0) { // print out the select values 84 | aquery.printSelected(std::cout); 85 | } 86 | else { 87 | std::cout << "error " << ierr; 88 | } 89 | } 90 | std::cout << std::endl; 91 | return ierr; 92 | } // main 93 | -------------------------------------------------------------------------------- /java/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS=gnu 2 | EXTRA_DIST=README build.xml milky.java \ 3 | gov/lbl/fastbit/FastBit.java \ 4 | gov/lbl/fastbit/FastBitStringReader.java \ 5 | gov/lbl/fastbit/FastBitStringReaderException.java \ 6 | gov/lbl/fastbit/FastBitStringWriter.java \ 7 | gov/lbl/fastbit/FastBitStringWriterException.java \ 8 | tests/lib/commons-logging.jar \ 9 | tests/lib/junit-4.4.jar \ 10 | tests/lib/log4j-1.2.15.jar \ 11 | tests/README \ 12 | tests/log4j.properties \ 13 | tests/TestFastBitJava.java 14 | 15 | if BUILD_JAVA_INTERFACE 16 | lib_LTLIBRARIES = libfastbitjni.la 17 | libfastbitjni_la_SOURCES = FastBit.c 18 | pkginclude_HEADERS = FastBit.h ../src/capi.h 19 | libfastbitjni_la_DEPENDENCIES = ../src/libfastbit.la build.properties 20 | libfastbitjni_la_LIBADD = ../src/libfastbit.la 21 | # 22 | install-exec-local: fastbitjni.jar 23 | $(INSTALL) fastbitjni.jar "$(DESTDIR)$(libdir)" 24 | endif 25 | # 26 | ../src/libfastbit.la:: 27 | cd ../src && $(MAKE) libfastbit.la 28 | # 29 | fastbitjni.jar: gov/lbl/fastbit/FastBit.class \ 30 | gov/lbl/fastbit/FastBitStringReader.class \ 31 | gov/lbl/fastbit/FastBitStringReaderException.class \ 32 | gov/lbl/fastbit/FastBitStringWriter.class \ 33 | gov/lbl/fastbit/FastBitStringWriterException.class 34 | jar cf fastbitjni.jar gov/lbl/fastbit/*.class 35 | SUFFIXES=.java .class 36 | .java.class: 37 | $(JAVAC) $(JFLAGS) $< 38 | # 39 | # build.properties is used to specify the locations of the JNI libraries 40 | build.properties:: 41 | echo "fastbit.library.path=$(PWD)/$(OBJDIR):$(PWD)/../src/$(OBJDIR)" >| build.properties 42 | install-data-local: 43 | echo "fastbit.library.path=$(libdir)" >| build.properties 44 | # 45 | clean: clean-am 46 | find . -name '*.class' -exec $(RM) \{\} \; 47 | rm -f *~ core core.[0-9]* 48 | rm -rf tmp 49 | -------------------------------------------------------------------------------- /java/README: -------------------------------------------------------------------------------- 1 | This directory contains the Java Native Interface (JNI) code for FastBit 2 | functions, java FastBitStringReader and FastBit StringWriter classes for 3 | operations on string, a simple test program milky.java, and a set of 4 | java unit tests. The JNI code was developed by John Wu and Aaron Hong; 5 | the code for string operations and the unit tests was contributed by 6 | Andrey Kolchanov. 7 | 8 | 9 | -- build JNI -- 10 | 11 | On a unix machine, you need autoconf, automake and java development kit 12 | in order to use the Java Native Interface (JNI) code defined in 13 | FastBit.c and FastBit.h. If you are using gcc, it is likely that the 14 | commands './configure && make' would have build the correct library 15 | (libfastbitjni.so) for you already. Before executing 'make install', 16 | the file libfastbitjni.so should be located in .libs within this 17 | directory. In order for the java run-time environment to find it, you 18 | need to include the directory containing the file libfastbitjni.so in 19 | LD_LIBRARY_PATH. 20 | 21 | If autoconf scripts didnot produce the right makefiles for you, you need 22 | a variations of the following command line to build the .so file. 23 | 24 | gcc -O -shared -o libfastbitjni.so -Wl,-soname,libfastbitjni.so \ 25 | -I/export/home/jdk1.2/include \ 26 | -I/export/home/jdk1.2/include/linux FastBit.c \ 27 | ..\src\libfastbit.lo -lm 28 | 29 | On a windows machine, use ..\win\java.vcproj to build a DLL library for 30 | the JNI interface. The DLL file (named fastbitjni.dll) will end up in 31 | either ..\win\dll\Debug or ..\win\dll\Release depending how you build 32 | it. The directory containg the DLL file needs to be in environment 33 | variable PATH in order for the java run-time system to find it. 34 | 35 | 36 | -- Run tests -- 37 | 38 | To test JNI interface, an example file (named milky.java) is provided. 39 | To compile it, type 40 | 41 | javac gov/lbl/fastbit/FastBit.java milky.java 42 | 43 | Two class files are generated from FastBit.java, FastBit.class and 44 | FastBit$QueryHandle.class. These two class files need to be in a 45 | directory named gov/lbl/fastbit in the current working directory or some 46 | directory named in the environment variable named CLASSPATH. 47 | 48 | To run 49 | 50 | java milky data-dir "query conditions" 51 | 52 | for example, 53 | 54 | java milky ../tests/tmp/t1 "a>10 and c between 50 and 70" 55 | 56 | The above mentioned data directory is created by running "make check" in 57 | the top level directory of FastBit source code distribution. The 58 | expected output is 59 | 60 | applying "a>10 and c between 50 and 70" on data in ../tests/tmp/t1 produced 42 hits 61 | 62 | 63 | To run the unit test code in tests/TestFastBitJava.java, you will need 64 | Apache ant. The test program also makes use of the Apache commons 65 | logging module and junit module. The jar files for these modules are 66 | located in tests/lib already. 67 | 68 | 69 | -- About the name -- 70 | 71 | milky.java is named after Milky Stork (Mycteria cinerea), an endangered 72 | white stork that was common on Java Island, Indonesia. More information 73 | about the bird can be found at 74 | http://www.birdlife.org/datazone/sites/index.html?action=SpcHTMDetails.asp&sid=3825 75 | A few other example programs in FastBit are also named after various 76 | storks, such as ibis, ardea and thula. 77 | -------------------------------------------------------------------------------- /java/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | *********************************************************** 76 | *********************************************************** 77 | **** One or more tests failed! Check the output ... **** 78 | *********************************************************** 79 | *********************************************************** 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /java/gov/lbl/fastbit/FastBitStringReader.java: -------------------------------------------------------------------------------- 1 | package gov.lbl.fastbit; 2 | 3 | import gov.lbl.fastbit.FastBitStringWriter.WriteHandle; 4 | 5 | import java.io.BufferedOutputStream; 6 | import java.io.ByteArrayOutputStream; 7 | import java.io.FileNotFoundException; 8 | import java.io.IOException; 9 | import java.io.RandomAccessFile; 10 | import java.io.UnsupportedEncodingException; 11 | import java.nio.ByteBuffer; 12 | import java.nio.MappedByteBuffer; 13 | import java.nio.channels.FileChannel; 14 | import java.nio.channels.FileLock; 15 | import java.util.ArrayList; 16 | import java.util.Arrays; 17 | 18 | /** 19 | * Java StringReader for FastBit. It converts the strings retured from 20 | * FastBit into strings that can be accessed from a Java program. See 21 | * java/tests/TestFastBitJava.java for an example of use. 22 | * 23 | * @author Andrey Kolchanov 24 | * @ingroup FastBitJava 25 | */ 26 | public class FastBitStringReader { 27 | /** 28 | * Maximum size of the byte buffer. 29 | */ 30 | final private long bufferSize; 31 | private static int DEFAULT_BUFFER_LENGTH = 1024; 32 | 33 | /** 34 | * FastBitStringReader constructor with default buffer length 35 | */ 36 | public FastBitStringReader () { 37 | this.bufferSize = DEFAULT_BUFFER_LENGTH; 38 | } 39 | 40 | /** 41 | * FastBitStringReader constructor 42 | * @param bufferSize 43 | */ 44 | public FastBitStringReader (long bufferSize) { 45 | this.bufferSize = bufferSize; 46 | } 47 | 48 | /** 49 | * Thread-safe FastBit String[] getter. This function does not open 50 | * and lock file. 51 | * @param fc 52 | * @param handle 53 | * @param column 54 | * @return 55 | * @throws FastBitStringReaderException 56 | */ 57 | 58 | public String[] 59 | getQualifiedStrings(final FileChannel fc, 60 | final FastBitStringReader.ReadHandle handle, 61 | String column) 62 | throws FastBitStringReaderException { 63 | ArrayList ret = new ArrayList(); 64 | try { 65 | getStringArrayList(fc, handle, column, ret); 66 | return ret.toArray(new String[0]); 67 | } 68 | catch (IOException ex) { 69 | throw new FastBitStringReaderException(ex.getMessage()); 70 | } 71 | } 72 | 73 | /** 74 | * Thread-safe FastBit String[] getter. This function opens and closes file. 75 | * @param handle 76 | * @param column 77 | * @return 78 | * @throws FastBitStringReaderException 79 | */ 80 | public String[] 81 | getQualifiedStrings(final FastBitStringReader.ReadHandle handle, 82 | String column) 83 | throws FastBitStringReaderException { 84 | ArrayList ret = new ArrayList(); 85 | StringBuffer sb = 86 | new StringBuffer(handle.getPartition()).append("/").append(column); 87 | FileChannel ch = null; 88 | 89 | try { 90 | ch = new RandomAccessFile(new String(sb),"r").getChannel(); 91 | getStringArrayList(ch, handle, column, ret); 92 | return ret.toArray(new String[0]); 93 | } 94 | catch (IOException ex) { 95 | throw new FastBitStringReaderException(ex.getMessage()); 96 | } 97 | finally { 98 | try { 99 | ch.close(); 100 | } 101 | catch (IOException ex) { 102 | } 103 | } 104 | } 105 | 106 | private void getStringArrayList(final FileChannel fc, 107 | final FastBitStringReader.ReadHandle handle, 108 | String column, 109 | ArrayList ret) 110 | throws FastBitStringReaderException, 111 | IOException, UnsupportedEncodingException { 112 | long[] offsets = 113 | handle.getFb().get_qualified_longs(handle.getFbHandle(), column); 114 | if (offsets == null) { 115 | throw new FastBitStringReaderException 116 | ("get_qualified_longs result is null"); 117 | } 118 | 119 | for (int i=0; i. It exercises some basic 3 | functionality of FastBit Java Native Interface (class 4 | gov.lbl.fastbit.FastBit), FastBitStringReader and FastBitStringWriter. 5 | Andrey also contributed FastBitStringRead and FastBitStringWriter. 6 | 7 | Note the jar files in the lib directory are required for running the 8 | tests. 9 | 10 | -------------------------------------------------------------------------------- /java/tests/lib/commons-logging.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gingi/fastbit/5370ce2877c9e435b39d81f66b0550e7d740a8fe/java/tests/lib/commons-logging.jar -------------------------------------------------------------------------------- /java/tests/lib/junit-4.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gingi/fastbit/5370ce2877c9e435b39d81f66b0550e7d740a8fe/java/tests/lib/junit-4.4.jar -------------------------------------------------------------------------------- /java/tests/lib/log4j-1.2.15.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gingi/fastbit/5370ce2877c9e435b39d81f66b0550e7d740a8fe/java/tests/lib/log4j-1.2.15.jar -------------------------------------------------------------------------------- /java/tests/log4j.properties: -------------------------------------------------------------------------------- 1 | # Configure logging for testing: optionally with log file 2 | log4j.rootLogger= INFO, stdout, logfile 3 | 4 | 5 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 6 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n 8 | log4j.appender.stdout.Threshold=INFO 9 | 10 | log4j.appender.logfile=org.apache.log4j.FileAppender 11 | log4j.appender.logfile.Threshold=INFO 12 | log4j.appender.logfile.File=test.log 13 | log4j.appender.logfile.Append=false 14 | log4j.appender.logfile.layout=org.apache.log4j.PatternLayout 15 | log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n 16 | -------------------------------------------------------------------------------- /runconfig: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # A script used by the authors of FastBit to configure the package on a 4 | # few common machines used. Terse comments are provided in hoping they 5 | # might be instructive for configuring the package on other machines. 6 | # 7 | use Env qw(HOME HOSTNAME PWD SYS); 8 | 9 | if (! ${HOSTNAME}) { 10 | $HOSTNAME=`hostname | tr -d '[[:space:]]'`; 11 | } 12 | if (! ${SYS}) { 13 | $SYS=`uname -s`; 14 | } 15 | print "Configuring on ${HOSTNAME} with ${SYS}\n"; 16 | 17 | if (${HOSTNAME} =~ m/^bit/) { 18 | # on a Mac used by a developer, enable maintainer mode, use debug options # CC=gcc-mp-4.7 CXX=g++-mp-4.7 # CC=clang CXX=clang++ -gdwarf-2 19 | # -DFASTBIT_RECURSIVE_UNLOAD 20 | $cmd="./configure --prefix=${HOME}/tmp --enable-maintainer-mode --with-java CFLAGS='-g -O0 -Wall' CXXFLAGS='-g -O0 -Wall'"; 21 | } elsif (${HOSTNAME} =~ m/^data5[.lbl.gov]?$/) { 22 | # on data5, know where is java and where to install, use extra optimization 23 | $cmd="./configure --enable-xopt --disable-debug --with-java=/software/jdk1.7.0 --prefix=/data/john/Linux"; 24 | } elsif (${HOSTNAME} =~ m/^d\w+[.lbl.gov]?$/) { 25 | # on sdm group's linux machines, know where is java and where to install 26 | $cmd="./configure --enable-xopt --disable-debug --with-java=/software/jdk1.7.0 --prefix=/fastbit/`uname -s`"; 27 | } elsif (${HOSTNAME} =~ m/^cori\w+[.nersc.gov]?$/) { 28 | # on the front end of cori at NERSC, there is a choice to be made about what compiler to use 29 | # print "\nPlease make sure that PrgEnv-gnu is used, for example by executing 'module swap PrgEnv-intel PrgEnv-gnu'\n\n"; 30 | $cmd="./configure --without-getpwuid --with-quiet-nan CFLAGS='-fPIC -O3 -std=c++11' CXXFLAGS='-fPIC -O3 -std=c++11' --without-java --prefix=/project/projectdirs/m1248/pkgs/cori/gnu"; 31 | #$cmd="./configure CC=pgcc CXX=pgCC --without-getpwuid --with-quiet-nan CFLAGS='-fPIC -O3' CXXFLAGS='-fPIC -O3' --without-java --prefix=/project/projectdirs/m1248/pkgs/cori/pgi"; 32 | } elsif (${HOSTNAME} =~ m/^edison\w+[.nersc.gov]?$/) { 33 | # on the front end of edison at NERSC, the default compiler is from Intel 34 | print "\nPlease make sure that PrgEnv-gnu is used, for example by executing 'module swap PrgEnv-intel PrgEnv-gnu'\n\n"; 35 | $cmd="./configure --without-getpwuid --with-quiet-nan CFLAGS='-fPIC -O3 -std=c++11' CXXFLAGS='-fPIC -O3 -std=c++11' --without-java --prefix=/project/projectdirs/m1248/pkgs/edison/gnu"; 36 | #$cmd="./configure CC=icc CXX=icpc --without-getpwuid --with-quiet-nan CFLAGS='-fPIC -g -O3' CXXFLAGS='-fPIC -g -O3' --without-java --prefix=/project/projectdirs/m1248/pkgs/edison/intel"; 37 | } elsif (${HOSTNAME} =~ m/^hopper\w+[.nersc.gov]?$/) { 38 | # on the front end of hopper at NERSC, there is a choice to be made about what compiler to use 39 | # print "\nPlease make sure that PrgEnv-gnu is used, for example by executing 'module swap PrgEnv-pgi PrgEnv-gnu'\n\n"; 40 | $cmd="./configure --without-getpwuid --with-quiet-nan CFLAGS='-fPIC -O3 -std=c++11' CXXFLAGS='-fPIC -O3 -std=c++11' --without-java --prefix=/project/projectdirs/m1248/pkgs/hopper/gnu"; 41 | #$cmd="./configure CC=pgcc CXX=pgCC --without-getpwuid --with-quiet-nan CFLAGS='-fPIC -O3' CXXFLAGS='-fPIC -O3' --without-java --prefix=/project/projectdirs/m1248/pkgs/hopper/pgi"; 42 | } elsif (${HOSTNAME} =~ m/^sith/) {# sith.ccs.ornl.gov 43 | # on sith at ORNL, try GNU compilers 44 | $cmd="./configure --prefix=${HOME}/`uname -s`/sith-gnu --without-java --enable-xopt --disable-debug" 45 | } elsif (${HOSTNAME} =~ m/^titan/) {#[-\w+]?[.ornl.gov]?$ 46 | # on titan at ORNL, try GNU compilers 47 | $cmd="./configure --prefix=${HOME}/`uname -s`/titan-gnu --without-java --enable-xopt --disable-debug --disable-shared --without-getpwuid --with-quiet-nan" 48 | # on titan at ORNL, need to choose between PGI and GNU compilers 49 | #$cmd="env CC=pgcc CXX=pgCC ./configure --prefix=${HOME}/`uname -s`/tital-pgi --without-java --enable-xopt --disable-debug --disable-shared" 50 | } elsif (${HOSTNAME} =~ m/^mira/) {# mira at ALCF 51 | # need bgclang 52 | print "\nPlease use +mpiwrapper-bgclang in .soft\n\n"; 53 | $cmd="env CC=bgclang CXX=bgclang++11 ./configure --prefix=${HOME}/`uname -s` --without-java --disable-debug --disable-shared" 54 | } elsif (${HOSTNAME} =~ m/^cvr\w+[\.nersc\.gov]?$/) { 55 | # on carver at NERSC, use the GNU compilers, no debugging 56 | $cmd="./configure --without-getpwuid --with-quiet-nan --enable-xopt --disable-debug --without-java --prefix=/project/projectdirs/m1248/pkgs/carver"; 57 | } elsif (defined $ENV{"NERSC_HOST"}) { 58 | # on other NERSC machines, use the GNU compilers, no debugging 59 | use Env qw(NERSC_HOST); 60 | $cmd="./configure --prefix=/project/projectdirs/m1248/pkgs/${NERSC_HOST}/gnu --without-getpwuid --with-quiet-nan --disable-debug --enable-xopt"; 61 | } else { # based on system type ${SYS} 62 | if (${SYS} =~ m/CYGWIN/i || ${SYS} =~ m/MINGW/i) { 63 | $cmd="env CPPFLAGS=-DHAVE_STRUCT_TIMESPEC CXXPPFLAGS='-std=gnu++0x -U__STRICT_ANSI__ -DHAVE_STRUCT_TIMESPEC' CFLAGS='-O0 -g -DHAVE_STRUCT_TIMESPEC' CXXFLAGS='-O0 -g -DHAVE_STRUCT_TIMESPEC -std=gnu++0x -U__STRICT_ANSI__' ./configure --with-pthread --prefix=${PWD}/${SYS}"; 64 | } 65 | else { # default options on generic linux/unix machines 66 | $cmd="./configure --prefix=${PWD}/${SYS}"; 67 | } 68 | } 69 | print "$cmd\n\n"; 70 | system($cmd); 71 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS=gnu 2 | 3 | lib_LTLIBRARIES = libfastbit.la 4 | libfastbit_la_SOURCES = part.cpp bordm.cpp bord.cpp ibin.cpp column.cpp \ 5 | index.cpp array_t.cpp parth3dw.cpp parth3da.cpp parth3db.cpp parth2d.cpp \ 6 | parth3d.cpp meshQuery.cpp query.cpp colValues.cpp bitvector.cpp islice.cpp \ 7 | ixambit.cpp parth.cpp mensa.cpp tafel.cpp party.cpp qExpr.cpp utilidor.cpp \ 8 | bitvector64.cpp irange.cpp category.cpp iroster.cpp irelic.cpp ixpack.cpp \ 9 | fileManager.cpp filter.cpp bundle.cpp capi.cpp ixbylt.cpp ixpale.cpp util.cpp \ 10 | ixzone.cpp ixfuge.cpp ixfuzz.cpp isbiad.cpp icegale.cpp ifade.cpp \ 11 | ixzona.cpp parti.cpp idirekte.cpp blob.cpp jnatural.cpp iskive.cpp isapid.cpp \ 12 | idbak2.cpp jrange.cpp icentre.cpp iapi.cpp quaere.cpp countQuery.cpp \ 13 | imesa.cpp ikeywords.cpp selectClause.cpp dictionary.cpp whereClause.cpp \ 14 | idbak.cpp icmoins.cpp resource.cpp fromClause.cpp rids.cpp selectParser.cc \ 15 | fromLexer.cc whereParser.cc selectLexer.cc whereLexer.cc fromParser.cc 16 | libfastbit_la_LDFLAGS = -version-info $(LIB_VERSION_INFO) 17 | 18 | pkginclude_HEADERS = array_t.h bitvector.h bitvector64.h blob.h bord.h bundle.h capi.h category.h colValues.h column.h const.h countQuery.h dictionary.h fileManager.h horometer.h iapi.h ibin.h ibis.h idirekte.h ikeywords.h index.h irelic.h iroster.h quaere.h mensa.h meshQuery.h part.h filter.h jnatural.h jrange.h whereClause.h whereLexer.h whereParser.hh qExpr.h query.h resource.h rids.h tab.h table.h tafel.h twister.h util.h utilidor.h location.hh position.hh stack.hh selectClause.h selectLexer.h selectParser.hh fromClause.h fromLexer.h fromParser.hh fastbit-config.h 19 | 20 | EXTRA_DIST=whereLexer.ll whereParser.yy selectLexer.ll selectParser.yy fromLexer.ll fromParser.yy Doxyfile 21 | 22 | # use a useless print statement to prevent the use of implicit rule 23 | # to generating executable named predicate 24 | parsers: whereLexer.cc whereParser.cc selectLexer.cc selectParser.cc fromLexer.cc fromParser.cc 25 | @echo Updated $@ 26 | 27 | docs: Doxyfile 28 | perl -pi -e 's/(PROJECT_NUMBER\s*=\s*).+/\1$(PACKAGE_VERSION)/' Doxyfile 29 | doxygen 30 | 31 | # override the default rule generated by automake to make sure the prefix is changed 32 | fastbit-config.h: stamp-h1 33 | @if test ! -f $@; then rm -f stamp-h1; else :; fi 34 | @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi 35 | @if [ "`fgrep ' PACKAGE_' fastbit-config.h | wc -l`" -gt 0 ]; then \ 36 | mv fastbit-config.h fastbit-config.bak; \ 37 | sed -e 's/ PACKAGE_/ FASTBIT_/' fastbit-config.bak > fastbit-config.h; \ 38 | if test ! fastbit-config.h -nt stamp-h1; then sleep 1; touch fastbit-config.h; else :; fi \ 39 | fi 40 | 41 | if MAINTAINER_MODE 42 | # # rules to generate .hh and .cc files from lex/yacc files 43 | location.hh position.hh stack.hh: whereParser.hh 44 | whereParser.cc: whereParser.hh 45 | touch whereParser.cc 46 | whereParser.hh: whereParser.yy 47 | bison -d -o whereParser.cc whereParser.yy 48 | whereLexer.cc: whereLexer.ll whereParser.hh 49 | flex -o whereLexer.cc whereLexer.ll 50 | selectParser.cc: selectParser.hh 51 | touch selectParser.cc 52 | selectParser.hh: selectParser.yy 53 | bison -d -o selectParser.cc selectParser.yy 54 | selectLexer.cc: selectLexer.ll selectParser.hh 55 | flex -o selectLexer.cc selectLexer.ll 56 | fromParser.cc: fromParser.hh 57 | touch fromParser.cc 58 | fromParser.hh: fromParser.yy 59 | bison -d -o fromParser.cc fromParser.yy 60 | fromLexer.cc: fromLexer.ll fromParser.hh 61 | flex -o fromLexer.cc fromLexer.ll 62 | endif 63 | 64 | # targets that are not files 65 | .PHONY: docs 66 | -------------------------------------------------------------------------------- /src/blob.h: -------------------------------------------------------------------------------- 1 | //File: $Id$ 2 | // Author: John Wu 3 | // Copyright (c) 2009-2016 the Regents of the University of California 4 | ///@file 5 | /// Define the class ibis::blob. 6 | #ifndef IBIS_BLOB_H 7 | #define IBIS_BLOB_H 8 | 9 | #include "table.h" // ibis::TYPE_T 10 | #include "bitvector.h" 11 | #include "column.h" // ibis::column 12 | 13 | /// A class to provide a minimal support for byte arrays. Since a byte 14 | /// array may contain any arbitrary byte values, we can not rely on the 15 | /// null terminator any more, nor use std::string as the container for each 16 | /// array. It is intended to store opaque data, and can not be searched. 17 | class ibis::blob : public ibis::column { 18 | public: 19 | virtual ~blob() {}; 20 | blob(const part*, FILE*); 21 | blob(const part*, const char*); 22 | blob(const ibis::column&); 23 | 24 | virtual long stringSearch(const char*, ibis::bitvector&) const {return -1;} 25 | virtual long stringSearch(const std::vector&, 26 | ibis::bitvector&) const {return -1;} 27 | virtual long stringSearch(const char*) const {return -1;} 28 | virtual long stringSearch(const std::vector&) const { 29 | return -1;} 30 | 31 | virtual void computeMinMax() {} 32 | virtual void computeMinMax(const char*) {} 33 | virtual void computeMinMax(const char*, double&, double&, bool&) const {} 34 | virtual void loadIndex(const char*, int) const throw () {} 35 | virtual long indexSize() const {return -1;} 36 | virtual int getValuesArray(void*) const {return -1;} 37 | 38 | virtual array_t* 39 | selectBytes(const bitvector&) const {return 0;} 40 | virtual array_t* 41 | selectUBytes(const bitvector&) const {return 0;} 42 | virtual array_t* 43 | selectShorts(const bitvector&) const {return 0;} 44 | virtual array_t* 45 | selectUShorts(const bitvector&) const {return 0;} 46 | virtual array_t* 47 | selectInts(const bitvector&) const {return 0;} 48 | virtual array_t* 49 | selectUInts(const bitvector&) const {return 0;} 50 | virtual array_t* 51 | selectLongs(const bitvector&) const {return 0;} 52 | virtual array_t* 53 | selectULongs(const bitvector&) const {return 0;} 54 | virtual array_t* 55 | selectFloats(const bitvector&) const {return 0;} 56 | virtual array_t* 57 | selectDoubles(const bitvector&) const {return 0;} 58 | virtual std::vector* 59 | selectStrings(const bitvector&) const {return 0;} 60 | virtual std::vector* 61 | selectOpaques(const bitvector& mask) const; 62 | virtual int getOpaque(uint32_t, ibis::opaque&) const; 63 | 64 | virtual double getActualMin() const {return DBL_MAX;} 65 | virtual double getActualMax() const {return -DBL_MAX;} 66 | virtual double getSum() const {return 0;} 67 | 68 | virtual long append(const void*, const ibis::bitvector&) {return -1;} 69 | virtual long append(const char* dt, const char* df, const uint32_t nold, 70 | const uint32_t nnew, uint32_t nbuf, char* buf); 71 | virtual long writeData(const char* dir, uint32_t nold, uint32_t nnew, 72 | ibis::bitvector& mask, const void *va1, 73 | void *va2); 74 | 75 | virtual void write(FILE*) const; 76 | virtual void print(std::ostream&) const; 77 | 78 | long countRawBytes(const bitvector&) const; 79 | int selectRawBytes(const bitvector&, 80 | array_t&, array_t&) const; 81 | int getBlob(uint32_t ind, char *&buf, uint64_t &size) const; 82 | 83 | protected: 84 | int extractAll(const bitvector&, 85 | array_t&, array_t&, 86 | const array_t&, 87 | const array_t&) const; 88 | int extractSome(const bitvector&, 89 | array_t&, array_t&, 90 | const array_t&, const array_t&, 91 | const uint32_t) const; 92 | int extractAll(const bitvector&, 93 | array_t&, array_t&, 94 | const char*, const array_t&) const; 95 | int extractSome(const bitvector&, 96 | array_t&, array_t&, 97 | const char*, const array_t&, const uint32_t) const; 98 | int extractSome(const bitvector&, 99 | array_t&, array_t&, 100 | const char*, const char*, const uint32_t) const; 101 | int readBlob(uint32_t ind, char *&buf, uint64_t &size, 102 | const array_t &starts, const char *datafile) const; 103 | int readBlob(uint32_t ind, char *&buf, uint64_t &size, 104 | const char *spfile, const char *datafile) const; 105 | }; // ibis::blob 106 | 107 | std::ostream& operator<<(std::ostream& out, const ibis::opaque& opq); 108 | #endif 109 | -------------------------------------------------------------------------------- /src/countQuery.h: -------------------------------------------------------------------------------- 1 | //File: $Id$ 2 | // Author: John Wu 3 | // Lawrence Berkeley National Laboratory 4 | // Copyright (c) 2008-2016 the Regents of the University of California 5 | #ifndef IBIS_COUNTQUERY_H 6 | #define IBIS_COUNTQUERY_H 7 | ///@file 8 | /// The header file defining the individual countQuery objects. 9 | /// 10 | #include "part.h" // class part 11 | #include "whereClause.h" // ibis::whereClause 12 | 13 | namespace ibis { 14 | class countQuery; 15 | } 16 | 17 | /// @ingroup FastBitMain 18 | /// A simple count query. A count query is a special form of the SQL 19 | /// select statement, where the select clause is "count(*)". This data 20 | /// structure is much simpler than ibis::query because it does not produce 21 | /// an identifier for itself and does not ever attempt to record the status 22 | /// of the query. However, it does accept the same where clause as 23 | /// ibis::query. In addition, it may take a select clause to provide 24 | /// definitions of aliases in the where clause. 25 | class FASTBIT_CXX_DLLSPEC ibis::countQuery { 26 | public: 27 | /// Destructor. 28 | virtual ~countQuery() {clear();} 29 | /// Constructor. Generates a new countQuery on the data partition et. 30 | countQuery(const part* et=0, const ibis::selectClause *s=0) 31 | : mypart(et), m_sel(s), hits(0), cand(0) {}; 32 | 33 | /// Specify the where clause in string form. 34 | int setWhereClause(const char *str); 35 | /// Specify the where clause in the form of a qExpr object. 36 | int setWhereClause(const ibis::qExpr*); 37 | /// Return the where clause string. 38 | const char* getWhereClause() const {return conds.getString();} 39 | /// Resets the data partition used to evaluate the query conditions to 40 | /// the partition specified in the argument. 41 | int setPartition(const ibis::part* tbl); 42 | /// Return the pointer to the data partition used to process the count. 43 | const part* getPartition() const {return mypart;} 44 | /// Change the select clause. 45 | int setSelectClause(const ibis::selectClause *s); 46 | /// Return the pointer to the select clause. 47 | const selectClause* getSelectClause() const {return m_sel;} 48 | 49 | /// Functions to perform estimation. 50 | int estimate(); 51 | /// Return the number of records in the lower bound. 52 | long getMinNumHits() const; 53 | /// Return the number of records in the upper bound. 54 | long getMaxNumHits() const; 55 | 56 | /// Computes the exact hits. 57 | int evaluate(); 58 | /// Return the number of records in the exact solution. 59 | long getNumHits() const; 60 | /// Get the row numbers of the hits. 61 | long getHitRows(std::vector &rids) const; 62 | /// Return the pointer to the internal hit vector. The user should NOT 63 | /// attempt to free the returned pointer. 64 | const ibis::bitvector* getHitVector() const {return hits;} 65 | /// Return the pointer to the candidates vector. The user should NOT 66 | /// attempt to free the returned pointer. 67 | const ibis::bitvector* getCandVector() const {return cand;} 68 | 69 | /// Releases the resources held by the query object and re-initialize 70 | /// the select clause and the where clause to blank. 71 | void clear(); 72 | 73 | protected: 74 | whereClause conds; ///!< Query conditions. 75 | const part* mypart; ///!< Data partition used to process the query. 76 | const selectClause *m_sel; ///!< Select clause. 77 | ibis::bitvector* hits;///!< Solution in bitvector form (or lower bound) 78 | ibis::bitvector* cand;///!< Candidate query results. 79 | 80 | /// Estimate one term of a query expression. 81 | void doEstimate(const qExpr* term, ibis::bitvector& low, 82 | ibis::bitvector& high) const; 83 | /// Evaluate one term of a query expression. 84 | int doEvaluate(const qExpr* term, const ibis::bitvector& mask, 85 | ibis::bitvector& hits) const; 86 | /// Evaluate one term using the base data. 87 | int doScan(const ibis::qExpr* term, const ibis::bitvector& mask, 88 | ibis::bitvector& ht) const; 89 | 90 | private: 91 | countQuery(const countQuery&); 92 | countQuery& operator=(const countQuery&); 93 | }; // class ibis::countQuery 94 | 95 | inline int ibis::countQuery::setSelectClause(const ibis::selectClause *s) { 96 | if (s == 0) return -1; 97 | m_sel = s; 98 | return 0; 99 | } // ibis::countQuery::setSelectClause 100 | #endif // IBIS_COUNTQUERY_H 101 | -------------------------------------------------------------------------------- /src/dictionary.h: -------------------------------------------------------------------------------- 1 | //File: $Id$ 2 | // Author: John Wu 3 | // Copyright (c) 2000-2016 the Regents of the University of California 4 | #ifndef IBIS_DICTIONARY_H 5 | #define IBIS_DICTIONARY_H 6 | ///@file 7 | /// Define a dictionary data structure used by ibis::category. 8 | #include "array_t.h" 9 | #if defined(HAVE_UNORDERED_MAP) 10 | #include 11 | #elif defined(__GNUC__) && (__GNUC__+0 <= 4 || ( __GNUC__+0 == 4 && __GNUC_MINOR__+0 <= 5)) 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | namespace std { 18 | // specialization of hash<> on const char* 19 | template <> struct hash< const char* > { 20 | size_t operator()(const char* x) const; 21 | }; 22 | } 23 | 24 | /// Provide a dual-directional mapping between strings and integers. A 25 | /// utility class used by ibis::category. The integer values are always 26 | /// treated as 32-bit unsigned integers. The NULL string is always mapped 27 | /// to 0xFFFFFFFF (-1U) and is NOT counted as an entry in a dictionary. 28 | /// 29 | /// This version uses an in-memory hash_map to provide a mapping from a 30 | /// string to an integer. 31 | /// 32 | /// @note The integer returned from this class is a unsigned 32-bit integer 33 | /// (uint32_t). This limits the size of the dictionary to be no more than 34 | /// 2^32 entries. The dictionary file is written with 64-bit internal 35 | /// pointers. However, since the dictionary has to be read into memory 36 | /// completely before any use, the size of a dictionary is generally 37 | /// limited by the size of the computer memory. 38 | /// 39 | /// @note If FASTBIT_CASE_SENSITIVE_COMPARE is defined to be 0, the values 40 | /// stored in a dictionary will be folded to the upper case. This will 41 | /// allow the words in the dictionary to be stored in a simple sorted 42 | /// order. By default, the dictionary is case sensitive. 43 | class FASTBIT_CXX_DLLSPEC ibis::dictionary { 44 | public: 45 | ~dictionary() {clear();} 46 | dictionary(); 47 | dictionary(const dictionary& dic); 48 | 49 | /// Return the number of entries in the dictionary. May have undefined 50 | /// entries. 51 | uint32_t size() const {return raw_.size();} 52 | 53 | const char* operator[](uint32_t i) const; 54 | uint32_t operator[](const char* str) const; 55 | const char* find(const char* str) const; 56 | void patternSearch(const char* pat, array_t& matches) const; 57 | 58 | uint32_t insert(const char*, uint32_t); 59 | uint32_t insert(const char*); 60 | uint32_t insertRaw(char*); 61 | uint32_t appendOrdered(const char*); 62 | 63 | void clear(); 64 | void swap(dictionary&); 65 | 66 | int read(const char*); 67 | int write(const char*) const; 68 | 69 | int fromASCII(std::istream &); 70 | void toASCII(std::ostream &) const; 71 | 72 | void sort(array_t&); 73 | int merge(const dictionary&); 74 | int morph(const dictionary&, array_t&) const; 75 | 76 | bool equal_to(const ibis::dictionary&) const; 77 | 78 | void copy(const dictionary& rhs); 79 | 80 | protected: 81 | 82 | /// Member variable raw_ contains the string values in the order of the 83 | /// code assignment. 84 | array_t raw_; 85 | /// Member varaible buffer_ contains a list of pointers to the memory 86 | /// that holds the strings. 87 | array_t buffer_; 88 | /// Member variable key_ contains the hash_map that connects a string 89 | /// value to an integer. 90 | typedef 91 | #if defined(HAVE_UNORDERED_MAP) 92 | std::unordered_map 93 | #elif defined(__GNUC__) && (__GNUC__+0 <= 4 || ( __GNUC__+0 == 4 && __GNUC_MINOR__+0 <= 5)) 94 | __gnu_cxx::hash_map 95 | #else 96 | std::unordered_map 97 | #endif 98 | , 99 | std::equal_to > MYMAP; 100 | MYMAP key_; 101 | 102 | int readRaw(const char*, FILE *); 103 | int readKeys0(const char*, FILE *); 104 | int readKeys1(const char*, FILE *); 105 | int readKeys2(const char*, FILE *); 106 | void mergeBuffers() const; 107 | int writeKeys(FILE*, uint32_t, array_t&, 108 | array_t&) const; 109 | int writeBuffer(FILE*, uint32_t, array_t&, 110 | array_t&) const; 111 | 112 | private: 113 | dictionary& operator=(const dictionary&); 114 | }; // ibis::dictionary 115 | 116 | /// Swap the content of two dictionaries. 117 | inline void ibis::dictionary::swap(ibis::dictionary& rhs) { 118 | raw_.swap(rhs.raw_); 119 | key_.swap(rhs.key_); 120 | buffer_.swap(rhs.buffer_); 121 | } // ibis::dictionary::swap 122 | 123 | /// Return a string corresponding to the integer. If the index is beyond 124 | /// the valid range, i.e., i > size(), then a null pointer will be 125 | /// returned. 126 | inline const char* ibis::dictionary::operator[](uint32_t i) const { 127 | return (i < raw_.size() ? raw_[i] : static_cast(0)); 128 | } // int to string 129 | 130 | /// Find the given string in the dictionary. If the input string is found 131 | /// in the dictionary, it returns the string. Otherwise it returns null 132 | /// pointer. This function makes a little easier to determine whether a 133 | /// string is in a dictionary. 134 | inline const char* ibis::dictionary::find(const char* str) const { 135 | const char* ret = 0; 136 | const uint32_t ind = operator[](str); 137 | if (ind < raw_.size()) 138 | ret = raw_[ind]; 139 | return ret; 140 | } // ibis::dictionary::find 141 | #endif // IBIS_DICTIONARY_H 142 | -------------------------------------------------------------------------------- /src/fastbit-0.7.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: fastbit 7 | Description: FastBit library @VERSION@. 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lfastbit-0.7 10 | #Cflags: -I${includedir}/fastbit-0.7 -I${libdir}/fastbit-0.7/include 11 | -------------------------------------------------------------------------------- /src/fastbit-config.h.in: -------------------------------------------------------------------------------- 1 | /* src/fastbit-config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* define the null values used */ 4 | #undef FASTBIT_DOUBLE_NULL 5 | 6 | /* define the null values used */ 7 | #undef FASTBIT_FLOAT_NULL 8 | 9 | /* Define an integer version of FastBit IBIS version number */ 10 | #undef FASTBIT_IBIS_INT_VERSION 11 | 12 | /* Compiler support template */ 13 | #undef HAVE_ATOMIC_TEMPLATE 14 | 15 | /* Define to 1 if you have the header file, and it defines `DIR'. 16 | */ 17 | #undef HAVE_DIRENT_H 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #undef HAVE_DLFCN_H 21 | 22 | /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ 23 | #undef HAVE_DOPRNT 24 | 25 | /* Define to 1 if you have the `flock' function. */ 26 | #undef HAVE_FLOCK 27 | 28 | /* Define to 1 if support __sync_add_and_fetch() on 32-bit integers */ 29 | #undef HAVE_GCC_ATOMIC32 30 | 31 | /* Define to 1 if support __sync_add_and_fetch() on 64-bit integers */ 32 | #undef HAVE_GCC_ATOMIC64 33 | 34 | /* Set to 1 if getpwuid compiles and runs correctly */ 35 | #undef HAVE_GETPWUID 36 | 37 | /* Set to 1 if getpwuid_r compiles and runs correctly */ 38 | #undef HAVE_GETPWUID_R 39 | 40 | /* Define to 1 if you have the `gettimeofday' function. */ 41 | #undef HAVE_GETTIMEOFDAY 42 | 43 | /* Define to 1 if you have the header file. */ 44 | #undef HAVE_INTTYPES_H 45 | 46 | /* Define to 1 if you have the `m' library (-lm). */ 47 | #undef HAVE_LIBM 48 | 49 | /* Define to 1 if you have the `rt' library (-lrt). */ 50 | #undef HAVE_LIBRT 51 | 52 | /* Define to 1 if you have the header file. */ 53 | #undef HAVE_MEMORY_H 54 | 55 | /* Define to 1 if you have the `mkdir' function. */ 56 | #undef HAVE_MKDIR 57 | 58 | /* Define to 1 if you have the header file, and it defines `DIR'. */ 59 | #undef HAVE_NDIR_H 60 | 61 | /* Define to 1 if nextafter is defined in math.h and is in libm. */ 62 | #undef HAVE_NEXTAFTER 63 | 64 | /* Define if you have POSIX threads libraries and header files. */ 65 | #undef HAVE_PTHREAD 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #undef HAVE_STDINT_H 69 | 70 | /* Define to 1 if you have the header file. */ 71 | #undef HAVE_STDLIB_H 72 | 73 | /* Define to 1 if you have the header file. */ 74 | #undef HAVE_STRINGS_H 75 | 76 | /* Define to 1 if you have the header file. */ 77 | #undef HAVE_STRING_H 78 | 79 | /* Define to 1 if you have the `strptime' function. */ 80 | #undef HAVE_STRPTIME 81 | 82 | /* Set to 1 if strtoll is defined in stdlib.h */ 83 | #undef HAVE_STRTOLL 84 | 85 | /* Define to 1 if you have the header file, and it defines `DIR'. 86 | */ 87 | #undef HAVE_SYS_DIR_H 88 | 89 | /* Define to 1 if you have the header file, and it defines `DIR'. 90 | */ 91 | #undef HAVE_SYS_NDIR_H 92 | 93 | /* Define to 1 if you have the header file. */ 94 | #undef HAVE_SYS_STAT_H 95 | 96 | /* Define to 1 if you have the header file. */ 97 | #undef HAVE_SYS_TYPES_H 98 | 99 | /* Define to 1 if you have the header file. */ 100 | #undef HAVE_UNISTD_H 101 | 102 | /* Compiler support std::unordered_map */ 103 | #undef HAVE_UNORDERED_MAP 104 | 105 | /* Define to 1 if you have the `vprintf' function. */ 106 | #undef HAVE_VPRINTF 107 | 108 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 109 | */ 110 | #undef LT_OBJDIR 111 | 112 | /* Define to the address where bug reports for this package should be sent. */ 113 | #undef PACKAGE_BUGREPORT 114 | 115 | /* Define to the full name of this package. */ 116 | #undef PACKAGE_NAME 117 | 118 | /* Define to the full name and version of this package. */ 119 | #undef PACKAGE_STRING 120 | 121 | /* Define to the one symbol short name of this package. */ 122 | #undef PACKAGE_TARNAME 123 | 124 | /* Define to the home page for this package. */ 125 | #undef PACKAGE_URL 126 | 127 | /* Define to the version of this package. */ 128 | #undef PACKAGE_VERSION 129 | 130 | /* Define to 1 if you have the ANSI C header files. */ 131 | #undef STDC_HEADERS 132 | -------------------------------------------------------------------------------- /src/filter.h: -------------------------------------------------------------------------------- 1 | // File: $Id$ 2 | // Author: John Wu 3 | // Copyright (c) 2010-2016 the Regents of the University of California 4 | #ifndef IBIS_FILTER_H 5 | #define IBIS_FILTER_H 6 | /**@file 7 | @brief FastBit Filter class. 8 | 9 | This is the simplest version of a query. Following the older code, this 10 | class attempts to apply the same where clause on all known data 11 | partitions and produce a concatenated result set. 12 | */ 13 | 14 | #include "quaere.h" // ibis::quaere 15 | #include "whereClause.h" // ibis::whereClause 16 | #include "selectClause.h" // ibis::selectClause 17 | 18 | namespace ibis { 19 | class filter; // forward definition 20 | } // namespace ibis 21 | 22 | /// A simple filtering query. The where clause does not contain any table 23 | /// names. Following the convention used in older version of the query 24 | /// class, the same where clause is applied to all known data partitions. 25 | class ibis::filter : public ibis::quaere { 26 | public: 27 | explicit filter(const ibis::whereClause *); 28 | filter(const ibis::selectClause *, const ibis::constPartList *, 29 | const ibis::whereClause *); 30 | filter(const ibis::bitvector &, const ibis::part &); 31 | virtual ~filter(); 32 | 33 | virtual void roughCount(uint64_t& nmin, uint64_t& nmax) const; 34 | virtual int64_t count() const; 35 | virtual table* select() const; 36 | virtual table* select(const char*) const; 37 | virtual table* select(const ibis::table::stringArray& colnames) const; 38 | 39 | static table* sift(const ibis::selectClause &sel, 40 | const ibis::constPartList &pl, 41 | const ibis::whereClause &wc); 42 | static table* sift0(const ibis::selectClause &, 43 | const ibis::constPartList &); 44 | static table* sift0S(const ibis::selectClause &, 45 | const ibis::constPartList &); 46 | static table* sift1(const ibis::selectClause &, 47 | const ibis::constPartList &, 48 | const ibis::whereClause &); 49 | static table* sift1S(const ibis::selectClause &, 50 | const ibis::constPartList &, 51 | const ibis::whereClause &); 52 | static table* sift2(const ibis::selectClause &, 53 | const ibis::constPartList &, 54 | const ibis::whereClause &); 55 | static table* sift2(const ibis::selectClause &, 56 | const ibis::constPartList &, 57 | const ibis::array_t &); 58 | static table* sift2(const ibis::selectClause &, 59 | const ibis::constPartList &, 60 | const ibis::whereClause &, 61 | ibis::array_t &); 62 | static table* sift2S(const ibis::selectClause &, 63 | const ibis::constPartList &, 64 | const ibis::whereClause &); 65 | static table* sift2S(const ibis::selectClause &, 66 | const ibis::constPartList &, 67 | const ibis::array_t &); 68 | static table* sift2S(const ibis::selectClause &, 69 | const ibis::constPartList &, 70 | const ibis::whereClause &, 71 | ibis::array_t &); 72 | 73 | protected: 74 | /// The where clause. 75 | const ibis::whereClause *wc_; 76 | /// A list of data partitions to query. 77 | const ibis::constPartList *parts_; 78 | /// The select clause. Also used to spply aliases. If the function 79 | /// select is called with an empty select clause, then this variable 80 | /// will be used as the substitute. 81 | const ibis::selectClause *sel_; 82 | /// Solution in bitvector form. If cand is no nil, then this bit 83 | /// vector is a lower bound. 84 | mutable array_t hits_; 85 | /// Candidate query results. 86 | mutable array_t cand_; 87 | 88 | /// Default constructor. Nothing can be done without explicitly 89 | /// initializing the member variables. 90 | filter() : wc_(0), parts_(0), sel_(0) {} 91 | 92 | private: 93 | filter(const filter&); // no copying 94 | filter& operator=(const filter&); // no assignment 95 | }; // class ibis::filter 96 | #endif 97 | -------------------------------------------------------------------------------- /src/fromClause.h: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // Author: John Wu 3 | // Lawrence Berkeley National Laboratory 4 | // Copyright (c) 2009-2016 the Regents of the University of California 5 | /** @file 6 | Declares ibis::fromClause class. 7 | */ 8 | #ifndef IBIS_FROMCLAUSE_H 9 | #define IBIS_FROMCLAUSE_H 10 | #include "qExpr.h" 11 | #include "table.h" 12 | 13 | namespace ibis { 14 | class fromLexer; 15 | class fromParser; 16 | } 17 | 18 | /// A class to represent the from clause. It parses a string into a list 19 | /// of names, a list of aliases and a join expression if present. 20 | /// 21 | /// The alias may optionally be preceded by the keyword "AS". For example, 22 | /// "FROM table_a as a" and "FROM table_a a" mean the same thing. 23 | /// 24 | /// The join expression is in the from clause can be of the form 25 | /// @code 26 | /// table_a JOIN table_b USING join_column 27 | /// @endcode 28 | /// or 29 | /// @code 30 | /// table_a JOIN table_b ON arithmetic_expression 31 | /// @endcode 32 | /// 33 | /// Note that the first form is equivalent to 34 | /// @code 35 | /// table_a JOIN table_b ON table_a.join_column = table_b.join_column 36 | /// @endcode 37 | /// 38 | /// @warning The current version of FastBit only supports join operating on 39 | /// two data tables. 40 | class FASTBIT_CXX_DLLSPEC ibis::fromClause { 41 | public: 42 | /// Parse a new string as a from clause. 43 | explicit fromClause(const char *cl=0); 44 | /// Parse a list of strings. 45 | fromClause(const ibis::table::stringArray&); 46 | ~fromClause(); 47 | fromClause(const fromClause&); 48 | 49 | int parse(const char *cl); 50 | 51 | /// Return a pointer to the string form of the from clause. 52 | const char* getString(void) const {return clause_.c_str();} 53 | /// Dereferences to the string form of the from clause. 54 | const char* operator*(void) const {return clause_.c_str();} 55 | 56 | /// Is it empty? Returns true or false. 57 | bool empty() const {return names_.empty();} 58 | /// Returns the number of valid names. 59 | uint32_t size() const {return names_.size();} 60 | void getNames(ibis::table::stringArray&) const; 61 | 62 | /// Report the join condition. 63 | const ibis::compRange* getJoinCondition() const {return jcond_;} 64 | 65 | void print(std::ostream&) const; 66 | void clear(); 67 | 68 | const char* realName(const char*) const; 69 | const char* alias(const char*) const; 70 | size_t position(const char*) const; 71 | void reorderNames(const char*, const char*); 72 | 73 | /// Assignment operator. 74 | fromClause& operator=(const fromClause& rhs) { 75 | fromClause tmp(rhs); 76 | swap(tmp); 77 | return *this; 78 | } 79 | /// Swap the content of two from clauses. 80 | void swap(fromClause& rhs) { 81 | names_.swap(rhs.names_); 82 | aliases_.swap(rhs.aliases_); 83 | clause_.swap(rhs.clause_); 84 | ordered_.swap(rhs.ordered_); 85 | ibis::compRange *tmp = jcond_; 86 | jcond_ = rhs.jcond_; 87 | rhs.jcond_ = tmp; 88 | } 89 | 90 | protected: 91 | /// The names of data tables. 92 | std::vector names_; 93 | /// The aliases. 94 | std::vector aliases_; 95 | /// The ordered version of the names. 96 | std::map ordered_; 97 | /// The join condition. A join condition may be specified in the from 98 | /// clause with the key words ON and USING, where On is followed by an 99 | /// arithmetic expression and USING is followed by a column name. The 100 | /// parser will translate the column name following USING into an 101 | /// eqaulity condition for generate a proper ibis::compRange object. 102 | /// If this variable is a nil pointer, no join condition has been 103 | /// specified in the from clause. 104 | ibis::compRange* jcond_; 105 | 106 | std::string clause_; ///!< String version of the from clause. 107 | ibis::fromLexer *lexer; ///!< A pointer for the parser. 108 | 109 | friend class ibis::fromParser; 110 | }; // class ibis::fromClause 111 | 112 | namespace std { 113 | inline ostream& operator<<(ostream& out, const ibis::fromClause& fc) { 114 | fc.print(out); 115 | return out; 116 | } // std::operator<< 117 | } 118 | #endif 119 | -------------------------------------------------------------------------------- /src/fromLexer.h: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // Author: John Wu 3 | // Lawrence Berkeley National Laboratory 4 | // Copyright (c) 2009-2016 the Regents of the University of California 5 | #ifndef IBIS_FROMLEXER_H 6 | #define IBIS_FROMLEXER_H 7 | /** \file 8 | Declares the name ibis::fromLexer. Defines the tokenizer with two 9 | arguments to satisfy the reentrant parser defined in selectParser.yy. 10 | */ 11 | #ifndef YY_DECL 12 | // the new lex function to satisfy the reentrant parser requirement 13 | #define YY_DECL ibis::fromParser::token_type ibis::fromLexer::lex \ 14 | (ibis::fromParser::semantic_type* yylval, \ 15 | ibis::fromParser::location_type* yylloc) 16 | #endif 17 | #include "fromParser.hh" // class fromParser 18 | 19 | // rename yyFlexLexer to _fLexer 20 | #undef yyFlexLexer 21 | #define yyFlexLexer _fLexer 22 | #include 23 | //#undef yyFlexLexer 24 | 25 | namespace ibis { 26 | /// Defines a new class with the desired lex function for C++ output of 27 | /// bison. 28 | /// 29 | /// @note All names must start with an alphabet or the underscore (_). 30 | /// @note This version of the lexer converts hexadecimal numbers to 31 | /// double precision floating-point numbers, which is not suitble for 32 | /// handling long integers. 33 | class fromLexer : public ::_fLexer { 34 | public: 35 | fromLexer(std::istream* in=0, std::ostream* out=0); 36 | virtual ~fromLexer(); 37 | 38 | // The new lex function. It carries the value of token and its type. 39 | // The value of the token is returned as the first argument and the 40 | // corresponding type is the return value of this function. 41 | virtual fromParser::token_type 42 | lex(fromParser::semantic_type*, fromParser::location_type*); 43 | 44 | void set_debug(bool); 45 | }; // ibis::fromLexer 46 | } // namespace ibis 47 | #endif 48 | -------------------------------------------------------------------------------- /src/fromLexer.ll: -------------------------------------------------------------------------------- 1 | /* $Id$ -*- mode: c++ -*- 2 | 3 | Author: John Wu 4 | Lawrence Berkeley National Laboratory 5 | Copyright (c) 2009-2016 the Regents of the University of California 6 | */ 7 | 8 | %{ /* C++ declarations */ 9 | /** \file Defines the tokenlizer using Flex C++ template. */ 10 | 11 | #include "fromLexer.h" // definition of YY_DECL 12 | #include "fromParser.hh" // class ibis::fromParser 13 | 14 | typedef ibis::fromParser::token token; 15 | typedef ibis::fromParser::token_type token_type; 16 | 17 | #define yyterminate() return token::END 18 | #define YY_USER_ACTION yylloc->columns(yyleng); 19 | %} 20 | 21 | /* Flex declarations and options */ 22 | %option c++ 23 | %option stack 24 | %option nounistd 25 | /*%option noyywrap*/ 26 | %option never-interactive 27 | %option prefix="_fromLexer_" 28 | 29 | /* regular expressions used to shorten the definitions 30 | */ 31 | WS [ \t\v\n] 32 | SEP [ \t\v\n,;] 33 | NAME [_a-zA-Z]((->)?[0-9A-Za-z_:.]+)*(\[[^\]]+\])? 34 | NUMBER ([0-9]+[.]?|[0-9]*[.][0-9]+)([eE][-+]?[0-9]+)? 35 | 36 | %% 37 | %{ 38 | yylloc->step(); 39 | %} 40 | /* section defining the tokens */ 41 | "|" {return token::BITOROP;} 42 | "&" {return token::BITANDOP;} 43 | "-" {return token::MINUSOP;} 44 | "^" {return token::EXPOP;} 45 | "+" {return token::ADDOP;} 46 | "*" {return token::MULTOP;} 47 | "/" {return token::DIVOP;} 48 | "%" {return token::REMOP;} 49 | "**" {return token::EXPOP;} 50 | [aA][sS] {return token::ASOP;} 51 | [oO][nN] {return token::ONOP;} 52 | [jJ][oO][iI][nN] {return token::JOINOP;} 53 | [uU][sS][iI][nN][gG] {return token::USINGOP;} 54 | [bB][eE][tT][wW][eE][eE][nN] {return token::BETWEENOP;} 55 | [aA][nN][dD] {return token::ANDOP;} 56 | 57 | {NAME} { /* a name, unquoted string */ 58 | #if defined(DEBUG) && DEBUG + 0 > 1 59 | LOGGER(ibis::gVerbose >= 0) 60 | << __FILE__ << ":" << __LINE__ << " got a name: " << yytext; 61 | #endif 62 | yylval->stringVal = new std::string(yytext, yyleng); 63 | return token::NOUNSTR; 64 | } 65 | 66 | {NUMBER} { /* a number (let parser deal with the sign) */ 67 | #if defined(DEBUG) && DEBUG + 0 > 1 68 | LOGGER(ibis::gVerbose >= 0) 69 | << __FILE__ << ":" << __LINE__ << " got a number: " << yytext; 70 | #endif 71 | yylval->doubleVal = atof(yytext); 72 | return token::NUMBER; 73 | } 74 | 75 | 0[xX][0-9a-fA-F]+ { /* a hexidacimal string */ 76 | #if defined(DEBUG) && DEBUG + 0 > 1 77 | LOGGER(ibis::gVerbose >= 0) 78 | << __FILE__ << ":" << __LINE__ << " got a hexadecimal number: " << yytext; 79 | #endif 80 | (void) sscanf(yytext+2, "%x", &(yylval->integerVal)); 81 | return token::NUMBER; 82 | } 83 | 84 | {WS}+ ; /* do nothing for blank space */ 85 | 86 | . { /* pass the character to the parser as a token */ 87 | return static_cast(*yytext); 88 | } 89 | 90 | %% 91 | /* additional c++ code to complete the definition of class fromLexer */ 92 | ibis::fromLexer::fromLexer(std::istream* in, std::ostream* out) 93 | : ::_fLexer(in, out) { 94 | #if defined(DEBUG) && DEBUG + 0 > 1 95 | yy_flex_debug = true; 96 | #endif 97 | } 98 | 99 | ibis::fromLexer::~fromLexer() { 100 | } 101 | 102 | /* function needed by the super-class of ibis::fromLexer */ 103 | #ifdef yylex 104 | #undef yylex 105 | #endif 106 | 107 | int ::_fLexer::yylex() { 108 | return 0; 109 | } // ::_fLexer::yylex 110 | 111 | int ::_fLexer::yywrap() { 112 | return 1; 113 | } // ::_fLexer::yywrap 114 | -------------------------------------------------------------------------------- /src/idirekte.h: -------------------------------------------------------------------------------- 1 | //File: $Id$ 2 | // Author: John Wu 3 | // Copyright (c) 2006-2016 the Regents of the University of California 4 | #ifndef IBIS_DIREKTE_H 5 | #define IBIS_DIREKTE_H 6 | ///@file 7 | /// This is an implementation of the the simple bitmap index without the 8 | /// first binning step. It directly uses the integer values as bin number. 9 | /// The word @c direkte in Danish means @c direct. 10 | #include "index.h" 11 | 12 | /// A version of precise index that directly uses the integer values. It 13 | /// can avoid some intemdiate steps during index building and query 14 | /// answering. However, this class can only be used with integer column 15 | /// with nonnegative values. Ideally, the values should start with 0, and 16 | /// only use small positive integers. 17 | class ibis::direkte : public ibis::index { 18 | public: 19 | virtual INDEX_TYPE type() const {return DIREKTE;} 20 | virtual const char* name() const {return "direct";} 21 | 22 | using ibis::index::evaluate; 23 | using ibis::index::estimate; 24 | virtual long evaluate(const ibis::qContinuousRange& expr, 25 | ibis::bitvector& hits) const; 26 | virtual void estimate(const ibis::qContinuousRange& expr, 27 | ibis::bitvector& lower, 28 | ibis::bitvector& upper) const; 29 | virtual uint32_t estimate(const ibis::qContinuousRange& expr) const; 30 | virtual float undecidable(const ibis::qContinuousRange& expr, 31 | ibis::bitvector& iffy) const { 32 | iffy.clear(); 33 | return 0.0; 34 | } 35 | 36 | virtual long evaluate(const ibis::qDiscreteRange& expr, 37 | ibis::bitvector& hits) const; 38 | virtual void estimate(const ibis::qDiscreteRange& expr, 39 | ibis::bitvector& lower, 40 | ibis::bitvector& upper) const; 41 | virtual uint32_t estimate(const ibis::qDiscreteRange& expr) const; 42 | virtual float undecidable(const ibis::qDiscreteRange& expr, 43 | ibis::bitvector& iffy) const { 44 | iffy.clear(); 45 | return 0.0; 46 | } 47 | 48 | virtual double estimateCost(const ibis::qContinuousRange& expr) const; 49 | virtual double estimateCost(const ibis::qDiscreteRange& expr) const; 50 | 51 | virtual long select(const ibis::qContinuousRange&, void*) const { 52 | return -1;} 53 | virtual long select(const ibis::qContinuousRange&, void*, 54 | ibis::bitvector&) const { 55 | return -1;} 56 | 57 | virtual void print(std::ostream& out) const; 58 | virtual void serialSizes(uint64_t&, uint64_t&, uint64_t&) const; 59 | virtual int write(ibis::array_t &, 60 | ibis::array_t &, 61 | ibis::array_t &) const; 62 | virtual int write(const char* name) const; 63 | virtual int read(const char* name); 64 | virtual int read(ibis::fileManager::storage* st); 65 | 66 | virtual long append(const char* dt, const char* df, uint32_t nnew); 67 | 68 | long append(const ibis::direkte& tail); 69 | long append(const array_t& ind); 70 | 71 | void ints(array_t&) const; 72 | int remapKeys(const ibis::array_t&); 73 | array_t* keys(const ibis::bitvector& mask) const; 74 | 75 | /// Time some logical operations and print out their speed. This 76 | /// version does nothing. 77 | virtual void speedTest(std::ostream& out) const {}; 78 | 79 | virtual void binBoundaries(std::vector&) const; 80 | virtual void binWeights(std::vector&) const; 81 | 82 | virtual double getMin() const {return 0.0;} 83 | virtual double getMax() const {return(bits.size()-1.0);} 84 | virtual double getSum() const; 85 | virtual long getCumulativeDistribution 86 | (std::vector& bds, std::vector& cts) const; 87 | virtual long getDistribution 88 | (std::vector& bbs, std::vector& cts) const; 89 | 90 | virtual index* dup() const; 91 | virtual ~direkte() {clear();} 92 | direkte(const direkte &rhs) : index(rhs) {}; 93 | direkte(const ibis::column* c, const char* f = 0); 94 | direkte(const ibis::column* c, ibis::fileManager::storage* st); 95 | direkte(const ibis::column* c, uint32_t popu, uint32_t ntpl=0); 96 | direkte(const ibis::column* c, uint32_t card, array_t& ints); 97 | 98 | protected: 99 | template 100 | int construct(const char* f); 101 | template 102 | int construct0(const char* f); 103 | 104 | void locate(const ibis::qContinuousRange& expr, 105 | uint32_t& hit0, uint32_t& hit1) const; 106 | virtual size_t getSerialSize() const throw(); 107 | 108 | direkte(); 109 | direkte& operator=(const direkte&); 110 | }; // ibis::direkte 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /src/jnatural.h: -------------------------------------------------------------------------------- 1 | // File: $Id$ 2 | // Author: John Wu 3 | // Copyright (c) 2008-2016 the Regents of the University of California 4 | #ifndef IBIS_JNATURAL_H 5 | #define IBIS_JNATURAL_H 6 | /**@file 7 | @brief In-memory Natual Join. 8 | 9 | This is a concrete implementation of the join operation involving two 10 | data partitions that can fit in memory. 11 | */ 12 | #include "quaere.h" // ibis::quaere 13 | 14 | namespace ibis { 15 | class jNatural; // forward definition 16 | } // namespace ibis 17 | 18 | /// In-memory Natual Join. 19 | /// 20 | /// @warning This is an experimental feature of FastBit. The current 21 | /// design is very limited and is likely to go through major revisions 22 | /// frequently. Feel free to express your opinions on the FastBit mailing 23 | /// list fastbit-users@hpcrdm.lbl.gov. 24 | class FASTBIT_CXX_DLLSPEC ibis::jNatural : public ibis::quaere { 25 | public: 26 | jNatural(const ibis::part* partr, const ibis::part* parts, 27 | const char* colname, const char* condr, const char* conds, 28 | const char* sel); 29 | jNatural(const ibis::part* partr, const ibis::part* parts, 30 | const ibis::column* colr, const ibis::column* cols, 31 | const ibis::qExpr* condr, const ibis::qExpr* conds, 32 | const ibis::selectClause* sel, const ibis::fromClause* frm, 33 | const char* desc); 34 | virtual ~jNatural(); 35 | 36 | virtual void roughCount(uint64_t& nmin, uint64_t& nmax) const; 37 | virtual int64_t count() const; 38 | 39 | virtual ibis::table* select() const; 40 | virtual ibis::table* select(const char*) const; 41 | virtual ibis::table* select(const ibis::table::stringArray& colnames) const; 42 | 43 | protected: 44 | std::string desc_; 45 | const ibis::selectClause *sel_; 46 | const ibis::fromClause *frm_; 47 | const ibis::part& R_; 48 | const ibis::part& S_; 49 | const ibis::column& colR_; 50 | const ibis::column& colS_; 51 | ibis::bitvector maskR_; 52 | ibis::bitvector maskS_; 53 | 54 | mutable array_t *orderR_; 55 | mutable array_t *orderS_; 56 | mutable void *valR_; 57 | mutable void *valS_; 58 | mutable int64_t nrows; 59 | 60 | template 61 | static table* 62 | fillResult(size_t nrows, 63 | const std::string &desc, 64 | const ibis::array_t& rjcol, 65 | const ibis::table::typeArray& rtypes, 66 | const ibis::table::bufferArray& rbuff, 67 | const ibis::array_t& sjcol, 68 | const ibis::table::typeArray& stypes, 69 | const ibis::table::bufferArray& sbuff, 70 | const ibis::table::stringArray& cnamet, 71 | const std::vector& cnpos); 72 | static table* 73 | fillResult(size_t nrows, 74 | const std::string &desc, 75 | const std::vector& rjcol, 76 | const ibis::table::typeArray& rtypes, 77 | const ibis::table::bufferArray& rbuff, 78 | const std::vector& sjcol, 79 | const ibis::table::typeArray& stypes, 80 | const ibis::table::bufferArray& sbuff, 81 | const ibis::table::stringArray& cnamet, 82 | const std::vector& cnpos); 83 | 84 | private: 85 | jNatural(const jNatural&); // no copying 86 | jNatural& operator=(const jNatural&); // no assignment 87 | }; // class ibis::jNatural 88 | #endif 89 | -------------------------------------------------------------------------------- /src/jrange.h: -------------------------------------------------------------------------------- 1 | // File: $Id$ 2 | // Author: John Wu 3 | // Copyright (c) 2010-2016 the Regents of the University of California 4 | #ifndef IBIS_JRANGE_H 5 | #define IBIS_JRANGE_H 6 | /**@file 7 | @brief In-memory Range Join. 8 | 9 | This is a concrete implementation of the range join operation involving 10 | two data partitions that can fit in memory. The join range is defined 11 | by fixed contants known internally as delta1 and delta2. 12 | */ 13 | #include "quaere.h" // ibis::quaere 14 | 15 | namespace ibis { 16 | class jRange; // forward definition 17 | } // namespace ibis 18 | 19 | /// In-memory Range Join. A range join is a SQL query of the form 20 | ///@code 21 | /// SELECT count(*) FROM partR, partS WHERE 22 | /// delta1 <= partR.colR - partS.colS <= delta2 23 | /// and conditions-on-partR and conditions-on-partS; 24 | ///@endcode 25 | /// or 26 | ///@code 27 | /// SELECT count(*) FROM partR, partS WHERE partR.colR between 28 | /// partS.colS + delta1 and partS.colS + delta2 and 29 | /// conditions-on-partR and conditions-on-partS; 30 | ///@endcode 31 | /// where delta1 and delta2 are constants. 32 | /// 33 | /// @warning This is an experimental feature of FastBit. The current 34 | /// design is very limited and is likely to go through major revisions 35 | /// frequently. Feel free to express your opinions on the FastBit mailing 36 | /// list fastbit-users@hpcrdm.lbl.gov. 37 | class ibis::jRange : public ibis::quaere { 38 | public: 39 | jRange(const ibis::part& partr, const ibis::part& parts, 40 | const ibis::column& colr, const ibis::column& cols, 41 | double delta1, double delta2, 42 | const ibis::qExpr* condr, const ibis::qExpr* conds, 43 | const ibis::selectClause* sel, const ibis::fromClause* frm, 44 | const char* desc); 45 | virtual ~jRange(); 46 | 47 | virtual void roughCount(uint64_t& nmin, uint64_t& nmax) const; 48 | virtual int64_t count() const; 49 | 50 | virtual ibis::table* select() const; 51 | virtual ibis::table* select(const char*) const; 52 | virtual ibis::table* select(const ibis::table::stringArray& colnames) const; 53 | 54 | protected: 55 | std::string desc_; 56 | const ibis::selectClause *sel_; 57 | const ibis::fromClause *frm_; 58 | const ibis::part& partr_; 59 | const ibis::part& parts_; 60 | const ibis::column& colr_; 61 | const ibis::column& cols_; 62 | ibis::bitvector maskr_; 63 | ibis::bitvector masks_; 64 | const double delta1_; 65 | const double delta2_; 66 | 67 | mutable array_t *orderr_; 68 | mutable array_t *orders_; 69 | mutable void *valr_; 70 | mutable void *vals_; 71 | mutable int64_t nrows; 72 | 73 | template 74 | static table* 75 | fillResult(size_t nrows, double delta1, double delta2, 76 | const std::string &desc, 77 | const ibis::array_t& rjcol, 78 | const ibis::table::typeArray& rtypes, 79 | const ibis::table::bufferArray& rbuff, 80 | const ibis::array_t& sjcol, 81 | const ibis::table::typeArray& stypes, 82 | const ibis::table::bufferArray& sbuff, 83 | const ibis::table::stringArray& cnamet, 84 | const std::vector& cnpos); 85 | 86 | private: 87 | jRange(const jRange&); // no copying 88 | jRange& operator=(const jRange&); // no assignment 89 | }; // class ibis::jRange 90 | #endif 91 | -------------------------------------------------------------------------------- /src/location.hh: -------------------------------------------------------------------------------- 1 | // A Bison parser, made by GNU Bison 3.0.4. 2 | 3 | // Locations for Bison parsers in C++ 4 | 5 | // Copyright (C) 2002-2015 Free Software Foundation, Inc. 6 | 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | 20 | // As a special exception, you may create a larger work that contains 21 | // part or all of the Bison parser skeleton and distribute that work 22 | // under terms of your choice, so long as that work isn't itself a 23 | // parser generator using the skeleton or a modified version thereof 24 | // as a parser skeleton. Alternatively, if you modify or redistribute 25 | // the parser skeleton itself, you may (at your option) remove this 26 | // special exception, which will cause the skeleton and the resulting 27 | // Bison output files to be licensed under the GNU General Public 28 | // License without this special exception. 29 | 30 | // This special exception was added by the Free Software Foundation in 31 | // version 2.2 of Bison. 32 | 33 | /** 34 | ** \file location.hh 35 | ** Define the ibis::location class. 36 | */ 37 | 38 | #ifndef YY_YY_LOCATION_HH_INCLUDED 39 | # define YY_YY_LOCATION_HH_INCLUDED 40 | 41 | # include "position.hh" 42 | 43 | #line 25 "whereParser.yy" // location.cc:296 44 | namespace ibis { 45 | #line 46 "location.hh" // location.cc:296 46 | /// Abstract a location. 47 | class location 48 | { 49 | public: 50 | 51 | /// Construct a location from \a b to \a e. 52 | location (const position& b, const position& e) 53 | : begin (b) 54 | , end (e) 55 | { 56 | } 57 | 58 | /// Construct a 0-width location in \a p. 59 | explicit location (const position& p = position ()) 60 | : begin (p) 61 | , end (p) 62 | { 63 | } 64 | 65 | /// Construct a 0-width location in \a f, \a l, \a c. 66 | explicit location (std::string* f, 67 | unsigned int l = 1u, 68 | unsigned int c = 1u) 69 | : begin (f, l, c) 70 | , end (f, l, c) 71 | { 72 | } 73 | 74 | 75 | /// Initialization. 76 | void initialize (std::string* f = YY_NULLPTR, 77 | unsigned int l = 1u, 78 | unsigned int c = 1u) 79 | { 80 | begin.initialize (f, l, c); 81 | end = begin; 82 | } 83 | 84 | /** \name Line and Column related manipulators 85 | ** \{ */ 86 | public: 87 | /// Reset initial location to final location. 88 | void step () 89 | { 90 | begin = end; 91 | } 92 | 93 | /// Extend the current location to the COUNT next columns. 94 | void columns (int count = 1) 95 | { 96 | end += count; 97 | } 98 | 99 | /// Extend the current location to the COUNT next lines. 100 | void lines (int count = 1) 101 | { 102 | end.lines (count); 103 | } 104 | /** \} */ 105 | 106 | 107 | public: 108 | /// Beginning of the located region. 109 | position begin; 110 | /// End of the located region. 111 | position end; 112 | }; 113 | 114 | /// Join two locations, in place. 115 | inline location& operator+= (location& res, const location& end) 116 | { 117 | res.end = end.end; 118 | return res; 119 | } 120 | 121 | /// Join two locations. 122 | inline location operator+ (location res, const location& end) 123 | { 124 | return res += end; 125 | } 126 | 127 | /// Add \a width columns to the end position, in place. 128 | inline location& operator+= (location& res, int width) 129 | { 130 | res.columns (width); 131 | return res; 132 | } 133 | 134 | /// Add \a width columns to the end position. 135 | inline location operator+ (location res, int width) 136 | { 137 | return res += width; 138 | } 139 | 140 | /// Subtract \a width columns to the end position, in place. 141 | inline location& operator-= (location& res, int width) 142 | { 143 | return res += -width; 144 | } 145 | 146 | /// Subtract \a width columns to the end position. 147 | inline location operator- (location res, int width) 148 | { 149 | return res -= width; 150 | } 151 | 152 | /// Compare two location objects. 153 | inline bool 154 | operator== (const location& loc1, const location& loc2) 155 | { 156 | return loc1.begin == loc2.begin && loc1.end == loc2.end; 157 | } 158 | 159 | /// Compare two location objects. 160 | inline bool 161 | operator!= (const location& loc1, const location& loc2) 162 | { 163 | return !(loc1 == loc2); 164 | } 165 | 166 | /** \brief Intercept output stream redirection. 167 | ** \param ostr the destination output stream 168 | ** \param loc a reference to the location to redirect 169 | ** 170 | ** Avoid duplicate information. 171 | */ 172 | template 173 | inline std::basic_ostream& 174 | operator<< (std::basic_ostream& ostr, const location& loc) 175 | { 176 | unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0; 177 | ostr << loc.begin; 178 | if (loc.end.filename 179 | && (!loc.begin.filename 180 | || *loc.begin.filename != *loc.end.filename)) 181 | ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col; 182 | else if (loc.begin.line < loc.end.line) 183 | ostr << '-' << loc.end.line << '.' << end_col; 184 | else if (loc.begin.column < end_col) 185 | ostr << '-' << end_col; 186 | return ostr; 187 | } 188 | 189 | #line 25 "whereParser.yy" // location.cc:296 190 | } // ibis 191 | #line 192 "location.hh" // location.cc:296 192 | #endif // !YY_YY_LOCATION_HH_INCLUDED 193 | -------------------------------------------------------------------------------- /src/meshQuery.h: -------------------------------------------------------------------------------- 1 | // File: $Id$ 2 | // Author: John Wu 3 | // Lawrence Berkeley National Laboratory 4 | // Copyright (c) 2000-2016 the Regents of the University of California 5 | #ifndef IBIS_MESHQUERY_H 6 | #define IBIS_MESHQUERY_H 7 | ///@file 8 | /// The header file defining an extension of query on mesh data. 9 | /// 10 | #include "query.h" 11 | 12 | namespace ibis { // extend ibis name space 13 | class meshQuery; 14 | } // namespace 15 | 16 | /// The class adds more functionality to ibis::query to handle data from 17 | /// regular meshes. The new functions treats cells of meshes as connected 18 | /// regions in space. 19 | class FASTBIT_CXX_DLLSPEC ibis::meshQuery : public ibis::query { 20 | public: 21 | virtual ~meshQuery(); 22 | /// Constructor for building a new query. 23 | meshQuery(const char* uid, const part* et, const char* pref=0); 24 | /// Constructor for recoverying from crash. 25 | meshQuery(const char* dir, const ibis::partList& tl) : query(dir, tl) {}; 26 | 27 | int getHitsAsLines(std::vector& lines) const { 28 | return getHitsAsLines(lines, partition()->getMeshShape());} 29 | int getHitsAsLines(std::vector& lines, 30 | const std::vector& dim) const; 31 | static int labelLines(uint32_t nd, 32 | const std::vector& lines, 33 | std::vector& labels); 34 | 35 | int getHitsAsBlocks(std::vector< std::vector >& reg, 36 | const bool merge=false) const; 37 | int getHitsAsBlocks(std::vector< std::vector >& reg, 38 | const std::vector& dim, 39 | const bool merge=false) const; 40 | 41 | int getPointsOnBoundary(std::vector< std::vector >& bdy, 42 | const std::vector& dim) const; 43 | int getPointsOnBoundary(std::vector< std::vector >& bdy) const; 44 | 45 | static int bitvectorToCoordinates(const ibis::bitvector& bv, 46 | const std::vector& dim, 47 | std::vector& coords); 48 | static int labelBlocks 49 | (const std::vector< std::vector >& blocks, 50 | std::vector& labels); 51 | 52 | protected: 53 | int linesIn1D(std::vector& lines) const; 54 | int linesIn2D(std::vector& lines, 55 | const std::vector& dim) const; 56 | int linesIn3D(std::vector& lines, 57 | const std::vector& dim) const; 58 | int linesIn4D(std::vector& lines, 59 | const std::vector& dim) const; 60 | int linesInND(std::vector& lines, 61 | const std::vector& dim) const; 62 | 63 | static int labelLines1(const std::vector& lines, 64 | std::vector& labels); 65 | static int labelLines2(const std::vector& lines, 66 | std::vector& labels); 67 | static int labelLines3(const std::vector& lines, 68 | std::vector& labels); 69 | static int labelLines4(const std::vector& lines, 70 | std::vector& labels); 71 | static int labelLinesN(uint32_t nd, 72 | const std::vector& lines, 73 | std::vector& labels); 74 | 75 | int toBlocks1(const ibis::bitvector& bv, 76 | std::vector< std::vector >& reg) const; 77 | int toBlocks2(const ibis::bitvector& bv, 78 | const std::vector& dim, 79 | std::vector< std::vector >& reg) const; 80 | int toBlocks3(const ibis::bitvector& bv, 81 | const std::vector& dim, 82 | std::vector< std::vector >& reg) const; 83 | int toBlocksN(const ibis::bitvector& bv, 84 | const std::vector& dim, 85 | std::vector< std::vector >& reg) const; 86 | void block2d(uint32_t last, const std::vector& dim, 87 | std::vector& block, 88 | std::vector< std::vector >& reg) const; 89 | void block3d(uint32_t last, const uint32_t n2, const uint32_t n3, 90 | const std::vector& dim, 91 | std::vector& block, 92 | std::vector< std::vector >& reg) const; 93 | void blocknd(uint32_t last, 94 | const std::vector& scl, 95 | const std::vector& dim, 96 | std::vector& block, 97 | std::vector< std::vector >& reg) const; 98 | void merge2DBlocks(std::vector< std::vector >& reg) const; 99 | void merge3DBlocks(std::vector< std::vector >& reg) const; 100 | void mergeNDBlocks(std::vector< std::vector >& reg) const; 101 | 102 | int findPointsOnBoundary(const ibis::bitvector& bv, 103 | const std::vector& dim, 104 | std::vector< std::vector >& bdy) const; 105 | void boundary2d(const std::vector& dim, 106 | const std::vector< std::vector >& rang, 107 | std::vector< std::vector >& bdy) const; 108 | void boundary2d1(const std::vector& dim, 109 | const std::vector< std::vector >& rang, 110 | std::vector< std::vector >& bdy) const; 111 | void boundary3d(const std::vector& dim, 112 | const std::vector< std::vector >& rang, 113 | std::vector< std::vector >& bdy) const; 114 | void boundarynd(const std::vector& dim, 115 | const std::vector< std::vector >& rang, 116 | std::vector< std::vector >& bdy) const; 117 | 118 | static uint32_t afind(ibis::array_t& rep, uint32_t s); 119 | static void aset(ibis::array_t& rep, 120 | uint32_t s, uint32_t r); 121 | static uint32_t aflatten(ibis::array_t& rep); 122 | static int label1DBlocks 123 | (const std::vector< std::vector >& blocks, 124 | std::vector& labels); 125 | static int label2DBlocks 126 | (const std::vector< std::vector >& blocks, 127 | std::vector& labels); 128 | static int label3DBlocks 129 | (const std::vector< std::vector >& blocks, 130 | std::vector& labels); 131 | static int label4DBlocks 132 | (const std::vector< std::vector >& blocks, 133 | std::vector& labels); 134 | 135 | private: 136 | meshQuery(); 137 | meshQuery(const meshQuery&); 138 | meshQuery& operator=(const meshQuery&); 139 | }; // class ibis::meshQuery 140 | #endif // IBIS_MESHQUERY_H 141 | -------------------------------------------------------------------------------- /src/position.hh: -------------------------------------------------------------------------------- 1 | // A Bison parser, made by GNU Bison 3.0.4. 2 | 3 | // Positions for Bison parsers in C++ 4 | 5 | // Copyright (C) 2002-2015 Free Software Foundation, Inc. 6 | 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | 20 | // As a special exception, you may create a larger work that contains 21 | // part or all of the Bison parser skeleton and distribute that work 22 | // under terms of your choice, so long as that work isn't itself a 23 | // parser generator using the skeleton or a modified version thereof 24 | // as a parser skeleton. Alternatively, if you modify or redistribute 25 | // the parser skeleton itself, you may (at your option) remove this 26 | // special exception, which will cause the skeleton and the resulting 27 | // Bison output files to be licensed under the GNU General Public 28 | // License without this special exception. 29 | 30 | // This special exception was added by the Free Software Foundation in 31 | // version 2.2 of Bison. 32 | 33 | /** 34 | ** \file position.hh 35 | ** Define the ibis::position class. 36 | */ 37 | 38 | #ifndef YY_YY_POSITION_HH_INCLUDED 39 | # define YY_YY_POSITION_HH_INCLUDED 40 | 41 | # include // std::max 42 | # include 43 | # include 44 | 45 | # ifndef YY_NULLPTR 46 | # if defined __cplusplus && 201103L <= __cplusplus 47 | # define YY_NULLPTR nullptr 48 | # else 49 | # define YY_NULLPTR 0 50 | # endif 51 | # endif 52 | 53 | #line 25 "whereParser.yy" // location.cc:296 54 | namespace ibis { 55 | #line 56 "position.hh" // location.cc:296 56 | /// Abstract a position. 57 | class position 58 | { 59 | public: 60 | /// Construct a position. 61 | explicit position (std::string* f = YY_NULLPTR, 62 | unsigned int l = 1u, 63 | unsigned int c = 1u) 64 | : filename (f) 65 | , line (l) 66 | , column (c) 67 | { 68 | } 69 | 70 | 71 | /// Initialization. 72 | void initialize (std::string* fn = YY_NULLPTR, 73 | unsigned int l = 1u, 74 | unsigned int c = 1u) 75 | { 76 | filename = fn; 77 | line = l; 78 | column = c; 79 | } 80 | 81 | /** \name Line and Column related manipulators 82 | ** \{ */ 83 | /// (line related) Advance to the COUNT next lines. 84 | void lines (int count = 1) 85 | { 86 | if (count) 87 | { 88 | column = 1u; 89 | line = add_ (line, count, 1); 90 | } 91 | } 92 | 93 | /// (column related) Advance to the COUNT next columns. 94 | void columns (int count = 1) 95 | { 96 | column = add_ (column, count, 1); 97 | } 98 | /** \} */ 99 | 100 | /// File name to which this position refers. 101 | std::string* filename; 102 | /// Current line number. 103 | unsigned int line; 104 | /// Current column number. 105 | unsigned int column; 106 | 107 | private: 108 | /// Compute max(min, lhs+rhs) (provided min <= lhs). 109 | static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min) 110 | { 111 | return (0 < rhs || -static_cast(rhs) < lhs 112 | ? rhs + lhs 113 | : min); 114 | } 115 | }; 116 | 117 | /// Add \a width columns, in place. 118 | inline position& 119 | operator+= (position& res, int width) 120 | { 121 | res.columns (width); 122 | return res; 123 | } 124 | 125 | /// Add \a width columns. 126 | inline position 127 | operator+ (position res, int width) 128 | { 129 | return res += width; 130 | } 131 | 132 | /// Subtract \a width columns, in place. 133 | inline position& 134 | operator-= (position& res, int width) 135 | { 136 | return res += -width; 137 | } 138 | 139 | /// Subtract \a width columns. 140 | inline position 141 | operator- (position res, int width) 142 | { 143 | return res -= width; 144 | } 145 | 146 | /// Compare two position objects. 147 | inline bool 148 | operator== (const position& pos1, const position& pos2) 149 | { 150 | return (pos1.line == pos2.line 151 | && pos1.column == pos2.column 152 | && (pos1.filename == pos2.filename 153 | || (pos1.filename && pos2.filename 154 | && *pos1.filename == *pos2.filename))); 155 | } 156 | 157 | /// Compare two position objects. 158 | inline bool 159 | operator!= (const position& pos1, const position& pos2) 160 | { 161 | return !(pos1 == pos2); 162 | } 163 | 164 | /** \brief Intercept output stream redirection. 165 | ** \param ostr the destination output stream 166 | ** \param pos a reference to the position to redirect 167 | */ 168 | template 169 | inline std::basic_ostream& 170 | operator<< (std::basic_ostream& ostr, const position& pos) 171 | { 172 | if (pos.filename) 173 | ostr << *pos.filename << ':'; 174 | return ostr << pos.line << '.' << pos.column; 175 | } 176 | 177 | #line 25 "whereParser.yy" // location.cc:296 178 | } // ibis 179 | #line 180 "position.hh" // location.cc:296 180 | #endif // !YY_YY_POSITION_HH_INCLUDED 181 | -------------------------------------------------------------------------------- /src/quaere.h: -------------------------------------------------------------------------------- 1 | // File: $Id$ 2 | // Author: John Wu 3 | // Copyright (c) 2010-2016 the Regents of the University of California 4 | #ifndef IBIS_QUAERE_H 5 | #define IBIS_QUAERE_H 6 | /**@file 7 | @brief FastBit Quaere Interface. 8 | 9 | This is the public interface to a set of functions that performs query 10 | operations. It is intended to replace query.h. 11 | */ 12 | 13 | #include "part.h" // ibis::part 14 | 15 | namespace ibis { 16 | class quaere; // forward definition 17 | } // namespace ibis 18 | 19 | /// An abstract query interface. It provides three key functions, 20 | /// specifying a query, computing the number of hits, and producing a table 21 | /// to represent the selection. The task of specifying a query is done 22 | /// with the function create. There are two functions to compute the 23 | /// number of results, roughCount and count, where the function roughCount 24 | /// produce a range to indicate the number of hits is between nmin and 25 | /// nmax, and the function count computes the precise number of hits. 26 | /// 27 | /// @warning This is an experimental feature of FastBit. The current 28 | /// design is very limited and is likely to go through major revisions 29 | /// frequently. Feel free to express your opinions about the design of 30 | /// this class on the FastBit mailing list fastbit-users@hpcrdm.lbl.gov. 31 | /// 32 | /// @note The word quaere is the latin equivalent of query. Once the 33 | /// implementation of this class stablizes, we intend to swap the names 34 | /// quaere and query. 35 | class FASTBIT_CXX_DLLSPEC ibis::quaere { 36 | public: 37 | static quaere* create(const char* sel, const char* from, const char* where); 38 | static quaere* create(const char* sel, const char* from, const char* where, 39 | const ibis::partList& prts); 40 | static quaere* create(const ibis::part* partr, const ibis::part* parts, 41 | const char* colname, const char* condr = 0, 42 | const char* conds = 0, const char* sel = 0); 43 | 44 | /// Provide an estimate of the number of hits. It never fails. In 45 | /// the worst case, it will simply set the minimum (nmin) to 0 and the 46 | /// maximum (nmax) to the maximum possible number of results. 47 | virtual void roughCount(uint64_t& nmin, uint64_t& nmax) const = 0; 48 | /// Compute the number of results. This function provides the exact 49 | /// answer. If it fails to do so, it will return a negative number to 50 | /// indicate error. 51 | virtual int64_t count() const = 0; 52 | 53 | /// Produce a projection of the joint table. The select clause 54 | /// associated with the query object is evaluated. If no select clause 55 | /// is provided, it returns a table with no columns. This is different 56 | /// from having a 'count(*)' as the select clause, which produce a 57 | /// table with one row and one column. 58 | /// 59 | /// @note We assume that this query object might be reused later and 60 | /// therefore store partial results associated with the query object. 61 | virtual table* select() const = 0; 62 | /// Produce a project based on the given select clause. The joint 63 | /// data table is defined by the where clause and the from clause given 64 | /// to the constructor of this object. 65 | virtual table* select(const char*) const = 0; 66 | /// Produce a projection of all known data partitions. This function 67 | /// selects all values of the named columns that are not NULL. 68 | /// 69 | /// @note This function assumes that this query object is used only 70 | /// once and therefore does not cache the results. 71 | virtual ibis::table* 72 | select(const ibis::table::stringArray& colnames) const = 0; 73 | 74 | virtual ~quaere() {}; 75 | 76 | protected: 77 | quaere() {} //!< Default constructor. Only used by derived classes. 78 | 79 | private: 80 | quaere(const quaere&); // no copying 81 | quaere& operator=(const quaere&); // no assignment 82 | }; // class ibis::quaere 83 | 84 | namespace ibis { 85 | ibis::part* findDataset(const char*); 86 | ibis::part* findDataset(const char*, const ibis::partList&); 87 | } 88 | #endif 89 | -------------------------------------------------------------------------------- /src/resource.h: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // Author: John Wu 3 | // Lawrence Berkeley National Laboratory 4 | // Copyright (c) 2000-2016 the Regents of the University of California 5 | #ifndef IBIS_RESOURCE_H 6 | #define IBIS_RESOURCE_H 7 | ///@file 8 | /// Defines a class to hold name-value pairs. 9 | #include "util.h" // ibis::util::strnewdup(), std::less 10 | #include // std::ofstream 11 | #include // std::map 12 | 13 | /// A container for name-value pairs. 14 | /// 15 | /// It is mostly used for storing the configuration parameters. The 16 | /// parameters are in a format as follows: 17 | /// @code 18 | /// group:group:...:name=value 19 | /// @endcode 20 | /// where the delimiter can be either '*', ':' or '.' and anything 21 | /// following the first '=' sign is assumed to be part of the value string 22 | /// until the end of line. The leading and trailing spaces are removed from 23 | /// both the name and the value. The specification that appears later in 24 | /// the same configuration file or read later (through a call to read()) 25 | /// will overwrite the parameter with the same name. This include the 26 | /// groups and individual parameters. For example if a parameter named 27 | /// 'abcd' is specified first, but later, the same name is used as a group 28 | /// name, then the previously specified parameter will be removed from the 29 | /// list and the new group will be inserted. If the parameter with name 30 | /// 'abcd' appeared again, then the group 'abcd' will be removed and the 31 | /// named parameter will be inserted. 32 | /// 33 | /// The line length must of no more than MAX_LINE defined in const.h. 34 | /// 35 | /// The top level group name can be any one of the following: all, common, 36 | /// and '*'. When writing out the parameters, the top level name is not 37 | /// written. 38 | class FASTBIT_CXX_DLLSPEC ibis::resource { 39 | public: 40 | /// The name-value pairs are categorized into two types, names that map 41 | /// to simple values (vList) and names that map to groups of name-value 42 | /// pairs (gList). 43 | typedef std::map< const char*, resource*, ibis::lessi > gList; 44 | typedef std::map< const char*, char*, ibis::lessi > vList; 45 | 46 | ~resource() {clear();}; 47 | /// Default constructor. Creates an empty object. 48 | resource() : prefix(0), context(0) {}; 49 | /// Read the content of a parameter file. 50 | explicit resource(const char *fn) : prefix(0), context(0) {(void)read(fn);} 51 | /// Create an empty object with the specified prefix and context. 52 | resource(const resource* ctx, const char* pfx) : 53 | prefix(ibis::util::strnewdup(pfx)), context(ctx) {} 54 | /// Copy constructor. Deep copy. 55 | resource(const resource& rhs) : 56 | groups(rhs.groups), values(rhs.values), 57 | prefix(ibis::util::strnewdup(rhs.prefix)), context(rhs.context) {} 58 | resource& operator=(const resource& rhs); 59 | 60 | /// Locate the named parameter and return its value in raw string form. 61 | const char* operator[](const char *name) const; 62 | /// Locate the named parameter and return its value as a number. 63 | double getNumber(const char* name) const; 64 | /// Locate the named parameter and return its value as true or false. 65 | bool isTrue(const char *name) const; 66 | 67 | int read(const char* fn=0); 68 | void write(const char* fn=0) const; 69 | void add(const char *name, const char *value); 70 | 71 | /// Returns true if there is no name-value pair on record. 72 | bool empty() const {return (values.empty() && groups.empty());} 73 | gList::const_iterator gBegin() const {return groups.begin();} 74 | gList::const_iterator gEnd() const {return groups.end();} 75 | vList::const_iterator vBegin() const {return values.begin();} 76 | vList::const_iterator vEnd() const {return values.end();} 77 | 78 | /// Find a group with the given name. The name is expected to be a 79 | /// simple name without any separators. Any separator in the name will 80 | /// cause it to return a nil pointer. 81 | inline const resource* getGroup(const char* name) const; 82 | /// Find a named parameter. The name is expected to be a simple name 83 | /// without any separators. Any separator in it will cause a nil 84 | /// pointer to be returned. 85 | inline const char* getValue(const char *name) const; 86 | /// Return the name of the full prefix of the resource 87 | inline std::string getPrefix() const; 88 | 89 | /// Clear a vList 90 | static void clear(vList &vl); 91 | /// Parse a string into a name-value list 92 | static void parseNameValuePairs(const char* in, vList& lst); 93 | static bool isStringTrue(const char *val); 94 | 95 | private: 96 | static const char* delimiters; 97 | gList groups; ///!< Names for Groups of values. 98 | vList values; ///!< Name-value pairs. 99 | const char *prefix; 100 | const resource* context; 101 | 102 | void clear(); // clear the memory occupied by the strings 103 | void write(std::ostream& out, const char* ctx=0) const; 104 | }; 105 | 106 | // only search the top level level 107 | inline const ibis::resource* ibis::resource::getGroup(const char* name) const { 108 | const ibis::resource* group = 0; 109 | if (name==0) return group; 110 | if (*name==static_cast(0)) return group; 111 | 112 | gList::const_iterator it = groups.find(name); 113 | if (it != groups.end()) 114 | group = (*it).second; 115 | return group; 116 | } // ibis::resource::getGroup 117 | 118 | // only search the top level 119 | inline const char* ibis::resource::getValue(const char* name) const { 120 | const char* value = 0; 121 | if (name==0) return value; 122 | if (*name==static_cast(0)) return value; 123 | 124 | vList::const_iterator it = values.find(name); 125 | if (it != values.end()) 126 | value = (*it).second; 127 | return value; 128 | } // ibis::resource::getValue 129 | 130 | // get the full prefix of the resource 131 | inline std::string ibis::resource::getPrefix() const { 132 | std::string ret; 133 | if (context != 0) 134 | ret = context->getPrefix(); 135 | if (prefix != 0) { 136 | if (ret.empty()) { 137 | ret = prefix; 138 | } 139 | else { 140 | ret += '.'; 141 | ret += prefix; 142 | } 143 | } 144 | return ret; 145 | } // ibis::resource::getPrefix 146 | 147 | /// Returns @c true is the string value should be interpreted as logical 148 | /// truth. The string values string with 'y', 't', and '1' (the number 149 | /// one), and the string "on" are interpreted as true. All other strings 150 | /// are interpreted as false. 151 | inline bool ibis::resource::isStringTrue(const char *val) { 152 | return(val != 0 && *val != 0 && 153 | ((*val == '1') || (*val == 't') || (*val == 'y') || 154 | (*val == 'T') || (*val == 'Y') || (stricmp(val, "on") == 0))); 155 | } // ibis::resource::isStringTrue 156 | #endif // IBIS_RESOURCE_H 157 | -------------------------------------------------------------------------------- /src/rids.h: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // Copyright (c) 2003-2016 the Regents of the University of California 3 | // Author: John Wu 4 | // Lawrence Berkeley National Laboratory 5 | #ifndef IBIS_RIDS_H 6 | #define IBIS_RIDS_H 7 | #include "utilidor.h" // ibis::RIDSet 8 | ///@file 9 | /// Define simple IO functions for ibis::rid_t. 10 | /// Based on on OidIOHandler by David Malon . 11 | 12 | namespace ibis { 13 | class ridHandler; 14 | } 15 | 16 | /// A class for handling file IO for ibis::rid_t. 17 | class ibis::ridHandler { 18 | public: 19 | ridHandler(const char* dbName, const char* pref="ibis"); 20 | ~ridHandler(); 21 | 22 | // Read a set of rids from a file. 23 | int read(RIDSet& rids, const char* source); 24 | // Write a set of rids to a file. 25 | int write(const RIDSet& rids, const char* destination, 26 | const char* dbName=0); 27 | // Append a set of rids to an existing rid file. 28 | int append(const RIDSet& rids, const char* destination) const; 29 | 30 | protected: 31 | // member variables 32 | char* _dbName; // name of the rid set 33 | char* _prefix; // prefix in the names of the parameters 34 | mutable pthread_mutex_t mutex; // a mutex lock 35 | 36 | // class variables used as internal parameters 37 | static const char *const version; // Internal version number. 38 | 39 | int readDBName(std::istream& _from); 40 | int matchDBName(std::istream& _from) const; 41 | int readVersion(std::istream& _from) const; 42 | int readRidCount(std::istream& _from, int& ic) const; 43 | 44 | private: 45 | ridHandler(const ridHandler&); 46 | ridHandler& operator=(const ridHandler&); 47 | }; 48 | #endif 49 | -------------------------------------------------------------------------------- /src/selectLexer.h: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // Author: John Wu 3 | // Lawrence Berkeley National Laboratory 4 | // Copyright (c) 2007-2016 the Regents of the University of California 5 | #ifndef IBIS_SELECTLEXER_H 6 | #define IBIS_SELECTLEXER_H 7 | /** \file 8 | Declares the name ibis::selectLexer. Defines the tokenizer with two 9 | arguments to satisfy the reentrant parser defined in selectParser.yy. 10 | */ 11 | #ifndef YY_DECL 12 | // the new lex function to satisfy the reentrant parser requirement 13 | #define YY_DECL ibis::selectParser::token_type ibis::selectLexer::lex \ 14 | (ibis::selectParser::semantic_type* yylval, \ 15 | ibis::selectParser::location_type* yylloc) 16 | #endif 17 | #include "selectParser.hh" // class selectParser 18 | 19 | // rename yyFlexLexer to _sLexer 20 | #undef yyFlexLexer 21 | #define yyFlexLexer _sLexer 22 | #include 23 | //#undef yyFlexLexer 24 | 25 | namespace ibis { 26 | /// Defines a new class with the desired lex function for C++ output of 27 | /// bison. 28 | /// 29 | /// @note All names must start with an alphabet or the underscore (_). 30 | /// @note This version of the lexer converts hexadecimal numbers to 31 | /// double precision floating-point numbers, which is not suitble for 32 | /// handling long integers. 33 | class selectLexer : public ::_sLexer { 34 | public: 35 | selectLexer(std::istream* in=0, std::ostream* out=0); 36 | virtual ~selectLexer(); 37 | 38 | // The new lex function. It carries the value of token and its type. 39 | // The value of the token is returned as the first argument and the 40 | // corresponding type is the return value of this function. 41 | virtual selectParser::token_type 42 | lex(selectParser::semantic_type*, selectParser::location_type*); 43 | 44 | void set_debug(bool); 45 | }; // ibis::selectLexer 46 | } // namespace ibis 47 | #endif 48 | -------------------------------------------------------------------------------- /src/selectLexer.ll: -------------------------------------------------------------------------------- 1 | /* $Id$ -*- mode: c++ -*- 2 | 3 | Author: John Wu 4 | Lawrence Berkeley National Laboratory 5 | Copyright (c) 2007-2016 the Regents of the University of California 6 | */ 7 | 8 | %{ /* C++ declarations */ 9 | /** \file Defines the tokenlizer using Flex C++ template. */ 10 | 11 | #include "selectLexer.h" // definition of YY_DECL 12 | #include "selectParser.hh" // class ibis::selectParser 13 | 14 | typedef ibis::selectParser::token token; 15 | typedef ibis::selectParser::token_type token_type; 16 | 17 | #define yyterminate() return token::END 18 | #define YY_USER_ACTION yylloc->columns(yyleng); 19 | %} 20 | 21 | /* Flex declarations and options */ 22 | %option c++ 23 | %option stack 24 | %option nounistd 25 | /*%option noyywrap*/ 26 | %option never-interactive 27 | %option prefix="_selectLexer_" 28 | 29 | /* regular expressions used to shorten the definitions 30 | */ 31 | WS [ \t\v\n] 32 | SEP [ \t\v\n,;] 33 | NAME [_a-zA-Z]((->)?[0-9A-Za-z_:.]+)*(\[[^\]]+\])? 34 | NUMBER ([0-9]+[.]?|[0-9]*[.][0-9]+)([eE][-+]?[0-9]+)? 35 | QUOTED \"([^\"\\]*(\\.[^\"\\]*)*)\"|\'([^\'\\]*(\\.[^\'\\]*)*)\'|\`([^\'\\]*(\\.[^\'\\]*)*)\' 36 | 37 | %% 38 | %{ 39 | yylloc->step(); 40 | %} 41 | /* section defining the tokens */ 42 | "|" {return token::BITOROP;} 43 | "&" {return token::BITANDOP;} 44 | "-" {return token::MINUSOP;} 45 | "^" {return token::EXPOP;} 46 | "+" {return token::ADDOP;} 47 | "*" {return token::MULTOP;} 48 | "/" {return token::DIVOP;} 49 | "%" {return token::REMOP;} 50 | "**" {return token::EXPOP;} 51 | [aA][sS] {return token::ASOP;} 52 | [fF][oO][rR][mM][aA][tT]_[uU][nN][iI][xX][tT][iI][mM][eE]_[gG][mM][tT] {return token::FORMAT_UNIXTIME_GMT;} 53 | [fF][oO][rR][mM][aA][tT]_[uU][nN][iI][xX][tT][iI][mM][eE]_[lL][oO][cC][aA][lL] {return token::FORMAT_UNIXTIME_LOCAL;} 54 | [fF][oO][rR][mM][aA][tT]_[uU][nN][iI][xX][tT][iI][mM][eE] {return token::FORMAT_UNIXTIME_LOCAL;} 55 | 56 | {NAME} { /* a name, unquoted string */ 57 | #if defined(DEBUG) && DEBUG + 0 > 1 58 | LOGGER(ibis::gVerbose >= 0) 59 | << __FILE__ << ":" << __LINE__ << " got a name: " << yytext; 60 | #endif 61 | yylval->stringVal = new std::string(yytext, yyleng); 62 | return token::NOUNSTR; 63 | } 64 | 65 | {QUOTED} { /* a quoted string */ 66 | #if defined(DEBUG) && DEBUG + 0 > 1 67 | LOGGER(ibis::gVerbose >= 0) 68 | << __FILE__ << ":" << __LINE__ << " got a quoted string: " << yytext; 69 | #endif 70 | yylval->stringVal = new std::string(yytext+1, yyleng-2); 71 | return token::STRLIT; 72 | } 73 | 74 | {NUMBER} { /* a number (let parser deal with the sign) */ 75 | #if defined(DEBUG) && DEBUG + 0 > 1 76 | LOGGER(ibis::gVerbose >= 0) 77 | << __FILE__ << ":" << __LINE__ << " got a number: " << yytext; 78 | #endif 79 | yylval->doubleVal = atof(yytext); 80 | return token::NUMBER; 81 | } 82 | 83 | 0[xX][0-9a-fA-F]+ { /* a hexidacimal string */ 84 | #if defined(DEBUG) && DEBUG + 0 > 1 85 | LOGGER(ibis::gVerbose >= 0) 86 | << __FILE__ << ":" << __LINE__ << " got a hexadecimal number: " << yytext; 87 | #endif 88 | (void) sscanf(yytext+2, "%x", &(yylval->integerVal)); 89 | return token::NUMBER; 90 | } 91 | 92 | {WS}+ ; /* do nothing for blank space */ 93 | 94 | . { /* pass the character to the parser as a token */ 95 | return static_cast(*yytext); 96 | } 97 | 98 | %% 99 | /* additional c++ code to complete the definition of class selectLexer */ 100 | ibis::selectLexer::selectLexer(std::istream* in, std::ostream* out) 101 | : ::_sLexer(in, out) { 102 | #if defined(DEBUG) && DEBUG + 0 > 1 103 | yy_flex_debug = true; 104 | #endif 105 | } 106 | 107 | ibis::selectLexer::~selectLexer() { 108 | } 109 | 110 | /* function needed by the super-class of ibis::selectLexer */ 111 | #ifdef yylex 112 | #undef yylex 113 | #endif 114 | 115 | int ::_sLexer::yylex() { 116 | return 0; 117 | } // ::_sLexer::yylex 118 | 119 | int ::_sLexer::yywrap() { 120 | return 1; 121 | } // ::_sLexer::yywrap 122 | -------------------------------------------------------------------------------- /src/stack.hh: -------------------------------------------------------------------------------- 1 | // A Bison parser, made by GNU Bison 3.0.4. 2 | 3 | // Stack handling for Bison parsers in C++ 4 | 5 | // Copyright (C) 2002-2015 Free Software Foundation, Inc. 6 | 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // (at your option) any later version. 11 | 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | 20 | // As a special exception, you may create a larger work that contains 21 | // part or all of the Bison parser skeleton and distribute that work 22 | // under terms of your choice, so long as that work isn't itself a 23 | // parser generator using the skeleton or a modified version thereof 24 | // as a parser skeleton. Alternatively, if you modify or redistribute 25 | // the parser skeleton itself, you may (at your option) remove this 26 | // special exception, which will cause the skeleton and the resulting 27 | // Bison output files to be licensed under the GNU General Public 28 | // License without this special exception. 29 | 30 | // This special exception was added by the Free Software Foundation in 31 | // version 2.2 of Bison. 32 | 33 | /** 34 | ** \file stack.hh 35 | ** Define the ibis::stack class. 36 | */ 37 | 38 | #ifndef YY_YY_STACK_HH_INCLUDED 39 | # define YY_YY_STACK_HH_INCLUDED 40 | 41 | # include 42 | 43 | #line 25 "whereParser.yy" // stack.hh:132 44 | namespace ibis { 45 | #line 46 "stack.hh" // stack.hh:132 46 | template > 47 | class stack 48 | { 49 | public: 50 | // Hide our reversed order. 51 | typedef typename S::reverse_iterator iterator; 52 | typedef typename S::const_reverse_iterator const_iterator; 53 | 54 | stack () 55 | : seq_ () 56 | { 57 | seq_.reserve (200); 58 | } 59 | 60 | stack (unsigned int n) 61 | : seq_ (n) 62 | {} 63 | 64 | inline 65 | T& 66 | operator[] (unsigned int i) 67 | { 68 | return seq_[seq_.size () - 1 - i]; 69 | } 70 | 71 | inline 72 | const T& 73 | operator[] (unsigned int i) const 74 | { 75 | return seq_[seq_.size () - 1 - i]; 76 | } 77 | 78 | /// Steal the contents of \a t. 79 | /// 80 | /// Close to move-semantics. 81 | inline 82 | void 83 | push (T& t) 84 | { 85 | seq_.push_back (T()); 86 | operator[](0).move (t); 87 | } 88 | 89 | inline 90 | void 91 | pop (unsigned int n = 1) 92 | { 93 | for (; n; --n) 94 | seq_.pop_back (); 95 | } 96 | 97 | void 98 | clear () 99 | { 100 | seq_.clear (); 101 | } 102 | 103 | inline 104 | typename S::size_type 105 | size () const 106 | { 107 | return seq_.size (); 108 | } 109 | 110 | inline 111 | const_iterator 112 | begin () const 113 | { 114 | return seq_.rbegin (); 115 | } 116 | 117 | inline 118 | const_iterator 119 | end () const 120 | { 121 | return seq_.rend (); 122 | } 123 | 124 | private: 125 | stack (const stack&); 126 | stack& operator= (const stack&); 127 | /// The wrapped container. 128 | S seq_; 129 | }; 130 | 131 | /// Present a slice of the top of a stack. 132 | template > 133 | class slice 134 | { 135 | public: 136 | slice (const S& stack, unsigned int range) 137 | : stack_ (stack) 138 | , range_ (range) 139 | {} 140 | 141 | inline 142 | const T& 143 | operator [] (unsigned int i) const 144 | { 145 | return stack_[range_ - i]; 146 | } 147 | 148 | private: 149 | const S& stack_; 150 | unsigned int range_; 151 | }; 152 | 153 | #line 25 "whereParser.yy" // stack.hh:132 154 | } // ibis 155 | #line 156 "stack.hh" // stack.hh:132 156 | 157 | #endif // !YY_YY_STACK_HH_INCLUDED 158 | -------------------------------------------------------------------------------- /src/utilidor.h: -------------------------------------------------------------------------------- 1 | // File: $Id$ 2 | // Author: John Wu 3 | // Copyright (c) 2008-2016 the Regents of the University of California 4 | #ifndef IBIS_UTILIDOR_H 5 | #define IBIS_UTILIDOR_H 6 | /**@file 7 | @brief FastBit sorting functions and other utilities. 8 | 9 | This is a collection of sorting function in the name space of 10 | ibis::util. 11 | 12 | @note About the name: I was going to name this utilsort.h, but what is 13 | the fun in that. According to answers.com, utilsort might be a 14 | misspelling of utilidor, which is a civil engineering term describing 15 | an insulated, heated conduit built below the ground surface or supported 16 | above the ground surface to protect the contained water, steam, sewage, 17 | and fire lines from freezing. 18 | */ 19 | #include 20 | #include "array_t.h" // array_t 21 | 22 | namespace ibis { 23 | typedef array_t< rid_t > RIDSet; // RIDSet 24 | 25 | namespace util { 26 | 27 | /// Sort RID lists. None of them are stable. 28 | ///@{ 29 | /// Sort the given list of RIDs with quick sort. 30 | void FASTBIT_CXX_DLLSPEC sortRIDs(ibis::RIDSet&); 31 | /// Sort a portion of the RIDSet with quick sort. 32 | void FASTBIT_CXX_DLLSPEC sortRIDsq(ibis::RIDSet&, uint32_t, uint32_t); 33 | /// Sort a portion of the RIDset with insertion sort. 34 | void FASTBIT_CXX_DLLSPEC sortRIDsi(ibis::RIDSet&, uint32_t, uint32_t); 35 | ///@} 36 | 37 | /// Reorder the array arr according to the indices given in ind. 38 | template 39 | void FASTBIT_CXX_DLLSPEC 40 | reorder(array_t &arr, const array_t &ind); 41 | void FASTBIT_CXX_DLLSPEC 42 | reorder(std::vector &arr, const array_t &ind); 43 | /// Reorder the array arr according to the indices given in ind. 44 | template 45 | void FASTBIT_CXX_DLLSPEC 46 | reorder(array_t &arr, const array_t &ind); 47 | /// Sort two arrays together. Order arr1 in ascending order first, 48 | /// then when arr1 has the same value, order arr2 in ascending 49 | /// order as well. 50 | template 51 | void FASTBIT_CXX_DLLSPEC 52 | sortAll(array_t& arr1, array_t& arr2); 53 | 54 | /// An in-memory sort merge join function with string values. 55 | int64_t FASTBIT_CXX_DLLSPEC 56 | sortMerge(std::vector& valR, array_t& indR, 57 | std::vector& valS, array_t& indS); 58 | /// An in-memory sort merge join function. Sort the input arrays, 59 | /// valR and valS. Count the number of results from join. 60 | template int64_t FASTBIT_CXX_DLLSPEC 61 | sortMerge(array_t& valR, array_t& indR, 62 | array_t& valS, array_t& indS); 63 | /// An in-memory sort merge join function. Sort the input arrays, 64 | /// valR and valS. Count the number of results satisfying 65 | /// ValR-Vals between delta1 and delta2. 66 | template int64_t FASTBIT_CXX_DLLSPEC 67 | sortMerge(array_t& valR, array_t& indR, 68 | array_t& valS, array_t& indS, 69 | double delta1, double delta2); 70 | 71 | /// Sorting function with payload. Sort keys in ascending order, 72 | /// move the vals accordingly. 73 | template 74 | void FASTBIT_CXX_DLLSPEC 75 | sortKeys(array_t& keys, array_t& vals); 76 | /// Sorting function with string as keys and uint32_t as payload. 77 | void FASTBIT_CXX_DLLSPEC 78 | sortStrings(std::vector& keys, array_t& vals); 79 | /// Quicksort for strings. 80 | void FASTBIT_CXX_DLLSPEC 81 | sortStrings(std::vector& keys, array_t& vals, 82 | uint32_t begin, uint32_t end); 83 | /// Sorting function with string as keys and uint32_t as payload. 84 | void FASTBIT_CXX_DLLSPEC 85 | sortStrings(array_t& keys, array_t& vals); 86 | /// Quicksort for strings. 87 | void FASTBIT_CXX_DLLSPEC 88 | sortStrings(array_t& keys, array_t& vals, 89 | uint32_t begin, uint32_t end); 90 | 91 | template size_t 92 | find(const std::vector&, const T&, size_t); 93 | template size_t 94 | find(const array_t&, const T&, size_t); 95 | template uint32_t 96 | find(const array_t&, const array_t&, const T&, uint32_t); 97 | 98 | /// A simple heap based on std::push_heap and std::pop_heap. 99 | template 100 | struct heap { 101 | /// A vector to hold pointers to the underlying data. 102 | std::vector data_; 103 | /// An object of the comparator type. 104 | const C comp_; 105 | 106 | /// The default constructor. It creates an empty vector with 107 | /// the specified type and a comparator object. 108 | heap() : data_(), comp_() {} 109 | 110 | /// Is the heap empty. Returns true if yes. 111 | bool empty() const {return data_.empty();} 112 | 113 | /// The number of elements in the heap. 114 | size_t size() const {return data_.size();} 115 | 116 | /// Reserve space. 117 | void reserve(size_t n) {data_.reserve(n);} 118 | 119 | /// The top element. No error checking! 120 | T* top() const {return data_[0];} 121 | 122 | /// Add a new element to the heap. 123 | void push(T* v) { 124 | data_.push_back(v); 125 | std::push_heap(data_.begin(), data_.end(), comp_); 126 | } 127 | 128 | /// Remove the top element from the heap. 129 | void pop() { 130 | const size_t oldsize = data_.size(); 131 | std::pop_heap(data_.begin(), data_.end(), comp_); 132 | data_.resize(oldsize-1); 133 | } 134 | }; // heap 135 | } // namespace util 136 | } // namespace ibis 137 | #endif 138 | 139 | -------------------------------------------------------------------------------- /src/whereLexer.h: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // Author: John Wu 3 | // Lawrence Berkeley National Laboratory 4 | // Copyright (c) 2007-2016 the Regents of the University of California 5 | #ifndef IBIS_WHERELEXER_H 6 | #define IBIS_WHERELEXER_H 7 | /** \file 8 | Declares the name ibis::whereLexer. Defines the tokenizer with two 9 | arguments to satisfy the reentrant parser defined in whereParser.yy. 10 | */ 11 | #ifndef YY_DECL 12 | // the new lex function to satisfy the reentrant parser requirement 13 | #define YY_DECL ibis::whereParser::token_type ibis::whereLexer::lex \ 14 | (ibis::whereParser::semantic_type* yylval, \ 15 | ibis::whereParser::location_type* yylloc) 16 | #endif 17 | #include "whereParser.hh" // class whereParser 18 | 19 | // rename yyFlexLexer to _wLexer 20 | #undef yyFlexLexer 21 | #define yyFlexLexer _wLexer 22 | #include 23 | //#undef yyFlexLexer 24 | 25 | namespace ibis { 26 | /// Defines a new class with the desired lex function for C++ output of 27 | /// bison. 28 | /// 29 | /// @note This version of the lexer converts hexadecimal numbers to 30 | /// double precision floating-point numbers, which is not suitble for 31 | /// handling long integers. 32 | /// @note This version of the lexer does not distinguish between quoted 33 | /// strings and unquoted strings. In cases where a string literal is 34 | /// needed such as for string matches, the evaluation engine will take 35 | /// one string as the column name and the other as a string literal. 36 | /// To ensure a single string is treated as a string literal, use the 37 | /// expression in the form of 38 | /// @code 39 | /// column_name IN ( string_literal ) 40 | /// @endcode 41 | class whereLexer : public ::_wLexer { 42 | public: 43 | whereLexer(std::istream* in=0, std::ostream* out=0); 44 | virtual ~whereLexer(); 45 | 46 | // The new lex function. It carries the value of token and its type. 47 | // The value of the token is returned as the first argument and the 48 | // corresponding type is the return value of this function. 49 | virtual whereParser::token_type 50 | lex(whereParser::semantic_type*, whereParser::location_type*); 51 | 52 | void set_debug(bool); 53 | }; // ibis::whereLexer 54 | } // namespace ibis 55 | #endif 56 | -------------------------------------------------------------------------------- /tests/README: -------------------------------------------------------------------------------- 1 | This directory contains a set of tests on predefined data records. The 2 | simplest way to run them is to issue 'make check' from either this 3 | directory or the directory above this one. When it passes a test, it 4 | will print 5 | 6 | Passed such-and-such test 7 | 8 | or 9 | 10 | All 40 queries match the expected results 11 | 12 | In case of failure, it will indicate where to find the detailed logs 13 | about the error. Please review the error logs for clues to resolve the 14 | problems. To request for help, please email 15 | . 16 | 17 | A more extensive test option is also available by issuing 'make 18 | more-check' or 'make full-check' from either this directory or the 19 | directory above this one. These options go through larger sets of tests 20 | on a large data set and 'full-check' even runs through a few old 21 | indexing options that have not been used by the developers for a while. 22 | 23 | 24 | About the data: There are two CSV files named test0.csv and test1.csv. 25 | They are converted into the binary format used by FastBit with readcsv 26 | (compiled from readcsv.cpp). Larger test data sets are simply 27 | replicated from these two small data sets. 28 | 29 | About the tests: There are two types of tests, the tests built into 30 | ibis::part class (ibis::part::selfTest) and a set of queries defined in 31 | scripts/query-count.list (parsed by scripts/match-count.pl). All tests 32 | are executed through the executable compiled from ibis.cpp (in directory 33 | ../examples). 34 | 35 | By default, the test data files are created in a subdirectory named tmp 36 | in this directory. This location can be moved by selecting a different 37 | value for TESTDIR. Because the test scripts generate a few files with 38 | the same names as those in this directory, NEVER sets TESTDIR to 39 | the name of this directory! 40 | 41 | On many linux/unix systems, the elapsed time (or real time) reported by 42 | 'time make check' should be about 15s. Under sygwin on MS Windows, it 43 | might be quite a bit longer because the process of launching a shell 44 | script takes significantly longer there. If you are running on a 45 | linux/unix variant and 'time make check' reports significantly more time 46 | than 15s, it is possible there might be something wrong and we would 47 | like to hear about it. 48 | 49 | 50 | ---------- 51 | KNOWN PROBLEMS 52 | 53 | -- The command 'make full-check' and 'make more-check' takes a very long 54 | time on cygwin compared to other systems. If you have any 55 | suggestions on address this problem, please post it to 56 | . 57 | 58 | -- This suite of tests rely on perl and other GNU tools. You will need 59 | these tools in order to run the tests. Suggestions for improving the 60 | portability of test scripts can be sent to 61 | . 62 | -------------------------------------------------------------------------------- /tests/acmpub.v.a: -------------------------------------------------------------------------------- 1 | 0:ICDM 2 | 2:SIGMOD 3 | 3:TODS 4 | 4:VLDB 5 | -------------------------------------------------------------------------------- /tests/acmpub.v.b: -------------------------------------------------------------------------------- 1 | 0 ICDM 2 | 10 SIGMOD 3 | 30 TODS 4 | 20 VLDB 5 | -------------------------------------------------------------------------------- /tests/inRange.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | inRange.cpp: A tester for discrete range queries on in-memory data. 3 | Modified from smatch.cpp, which was originally by Bernd Jaenichen , 2010/4/28. 5 | 6 | usage: 7 | inRange [where_1 [where_2 ...]] 8 | 9 | The datadir argument must be provided. If the user provides addition 10 | arguments, they will be treated as where clauses to be evaluated one at 11 | a time. This program was originally provided by Bernd to reveal a bug 12 | in the string search function ibis::text::stringSearch. 13 | */ 14 | #include "ibis.h" 15 | #include // std::auto_ptr 16 | 17 | /// Encapsulate the testing functions. 18 | class tester { 19 | public: 20 | tester(); 21 | ~tester(); 22 | void load(const char *datadir); 23 | void query(const char *datadir, const char *where); 24 | 25 | private: 26 | void builtindata(const char* datadir); 27 | }; 28 | 29 | tester::tester() { 30 | #if defined(_DEBUG) 31 | ibis::util::setVerboseLevel(5); 32 | #elif defined(DEBUG) 33 | ibis::util::setVerboseLevel(7); 34 | #endif 35 | } 36 | 37 | tester::~tester() { 38 | } 39 | 40 | /// Generate some records. Use ibis::tablex interface and 41 | /// ibis::table::row. The integer records go from 1 to 16, with the value 42 | /// J repeated J times. 43 | void tester::builtindata(const char *datadir) { 44 | ibis::table::row irow; 45 | std::auto_ptr ta(ibis::tablex::create()); 46 | 47 | ta->addColumn("l", ibis::LONG); 48 | 49 | irow.longsnames.push_back("l"); 50 | irow.longsvalues.resize(1); 51 | for (int j = 1; j < 16; ++ j) { 52 | irow.longsvalues.back() = j; 53 | for (int i = 0; i < j; ++ i) 54 | ta->appendRow(irow); 55 | } 56 | 57 | ta->write(datadir); 58 | LOGGER(ibis::gVerbose > 0) 59 | << "generated " << ta->mRows() << " rows in directory " << datadir; 60 | } 61 | 62 | /// Load the data in the specified directory. If the directory contains 63 | /// nothing it will generate some records using the function builtindata. 64 | /// If some data records are found, it will run a minimal test that counts 65 | /// the number of records. 66 | void tester::load(const char *datadir) { 67 | if (datadir == 0 || *datadir == 0) return; 68 | 69 | try { // use existing data records 70 | std::auto_ptr table(ibis::table::create(datadir)); 71 | if (table.get() == 0) { 72 | LOGGER(ibis::gVerbose >= 0) 73 | << "failed to load table from " << datadir; 74 | return; 75 | } 76 | if (table->nRows() == 0 || table->nColumns() == 0) { 77 | // empty or non-existent directory, create new data 78 | builtindata(datadir); 79 | table->addPartition(datadir); 80 | } 81 | 82 | std::auto_ptr select(table->select("", "1=1")); 83 | if (select.get() == 0) { 84 | LOGGER(ibis::gVerbose >= 0) 85 | << "failed to select all rows from table " << table->name(); 86 | return; 87 | } 88 | 89 | LOGGER(select->nRows() != table->nRows() && ibis::gVerbose >= 0) 90 | << "expected to select " << table->nRows() << " row" 91 | << (table->nRows()>1?"s":"") << ", but got " << select->nRows(); 92 | } 93 | catch (...) { // generate hard-coded data records 94 | builtindata(datadir); 95 | } 96 | } // tester::load 97 | 98 | /// Evaluate the query condition where on the data records in directory 99 | /// datadir. Make use of the ibis::table interface. It retrieves the 100 | /// values of the first column as strings after evaluating the query 101 | /// conditions. 102 | void tester::query(const char *datadir, const char *where) { 103 | if (datadir == 0 || where == 0 || *datadir == 0 || *where == 0) return; 104 | 105 | std::auto_ptr table(ibis::table::create(datadir)); 106 | if (table.get() == 0) { 107 | LOGGER(ibis::gVerbose >= 0) 108 | << "failed to load table from " << datadir; 109 | return; 110 | } 111 | if (table->name() == 0 || *(table->name()) == 0) { 112 | LOGGER(ibis::gVerbose >= 0) 113 | << "failed to find any data records in directory " << datadir; 114 | return; 115 | } 116 | if (table->nColumns() == 0) { 117 | LOGGER(ibis::gVerbose >= 0) 118 | << "Table " << table->name() << " in " << datadir << " is empty"; 119 | return; 120 | } 121 | 122 | ibis::table::stringArray cnames = table->columnNames(); 123 | if (cnames.empty()) { 124 | LOGGER(ibis::gVerbose >= 0) 125 | << "failed to retrieve column names from table " << table->name() 126 | << " in " << datadir; 127 | return; 128 | } 129 | 130 | std::string selall = cnames.front(); 131 | for (unsigned j = 1; j < cnames.size(); ++ j) { 132 | selall += ", "; 133 | selall += cnames[j]; 134 | } 135 | // create in-memory table to process where 136 | std::auto_ptr inmemory(table->select(selall.c_str(), "1=1")); 137 | if (inmemory.get() == 0) { 138 | LOGGER(ibis::gVerbose >= 0) 139 | << "failed to select all rows from table " << table->name(); 140 | return; 141 | } 142 | if (ibis::gVerbose > 0) { // an extra test with group-by 143 | std::auto_ptr groupby(inmemory->groupby(cnames.front())); 144 | if (groupby.get() == 0) { 145 | LOGGER(ibis::gVerbose > 0) 146 | << "failed to evaluate groupby(" << cnames.front() 147 | << " on table " << inmemory->name(); 148 | } 149 | else { 150 | std::cout << "\nThe result of groupby(" << cnames.front() << ")\n"; 151 | groupby->dump(std::cout); 152 | std::cout << std::endl; 153 | } 154 | } 155 | 156 | std::string sel1 = cnames.front(); 157 | sel1 += ", count(*)"; 158 | std::auto_ptr select(inmemory->select(sel1.c_str(), where)); 159 | if (select.get() == 0) { 160 | LOGGER(ibis::gVerbose >= 0) 161 | << "failed to select \"" << where << "\" on table" 162 | << inmemory->name(); 163 | return; 164 | } 165 | 166 | std::cout << "Number of rows produced by \"SELECT " << sel1 167 | << " WHERE " << where << "\": " 168 | << select->nRows() << std::endl; 169 | select->dump(std::cout); 170 | } // tester::query 171 | 172 | int main(int argc, char** argv) { 173 | if (argc < 2) { 174 | printf("\nUsage:\n%s [where_clause1] [where_clause2...]\n\n", 175 | *argv); 176 | return 0; 177 | } 178 | 179 | char *datadir = argv[1]; 180 | tester test0r; 181 | test0r.load(datadir); 182 | //ibis::gVerbose = 6; 183 | if (argc == 2) { // try some built-in tests 184 | test0r.query(datadir, "l IN (1,2)"); 185 | test0r.query(datadir, "l IN (1)"); 186 | test0r.query(datadir, "l IN (3)"); 187 | test0r.query(datadir, "l IN (1,3)"); 188 | } 189 | for (int iarg = 2; iarg < argc; ++ iarg) 190 | test0r.query(datadir, argv[iarg]); 191 | 192 | return 0; 193 | } // main 194 | -------------------------------------------------------------------------------- /tests/js2.csv: -------------------------------------------------------------------------------- 1 | 7085, 1, 1303808516 2 | 7033, 1, 1303851767 3 | 7166, 5, 1303855235 4 | 7124, 5, 1303880477 5 | 7045, 5, 1303880556 6 | 7190, 16, 1303808411 7 | 7066, 16, 1303808535 8 | 7052, 16, 1303873349 9 | 7100, 20, 1301615999 10 | 7101, 20, 1301616000 11 | 7102, 20, 1301616001 12 | 7202, 22, 1301641199 13 | 7202, 22, 1301641200 14 | 7202, 22, 1301641201 15 | -------------------------------------------------------------------------------- /tests/m4/ltsugar.m4: -------------------------------------------------------------------------------- 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 4 | # Written by Gary V. Vaughan, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # serial 6 ltsugar.m4 11 | 12 | # This is to help aclocal find these macros, as it can't see m4_define. 13 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 14 | 15 | 16 | # lt_join(SEP, ARG1, [ARG2...]) 17 | # ----------------------------- 18 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 19 | # associated separator. 20 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 21 | # versions in m4sugar had bugs. 22 | m4_define([lt_join], 23 | [m4_if([$#], [1], [], 24 | [$#], [2], [[$2]], 25 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 26 | m4_define([_lt_join], 27 | [m4_if([$#$2], [2], [], 28 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 29 | 30 | 31 | # lt_car(LIST) 32 | # lt_cdr(LIST) 33 | # ------------ 34 | # Manipulate m4 lists. 35 | # These macros are necessary as long as will still need to support 36 | # Autoconf-2.59 which quotes differently. 37 | m4_define([lt_car], [[$1]]) 38 | m4_define([lt_cdr], 39 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 40 | [$#], 1, [], 41 | [m4_dquote(m4_shift($@))])]) 42 | m4_define([lt_unquote], $1) 43 | 44 | 45 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 46 | # ------------------------------------------ 47 | # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. 48 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 49 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 50 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 51 | # than defined and empty). 52 | # 53 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 54 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 55 | m4_define([lt_append], 56 | [m4_define([$1], 57 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 58 | 59 | 60 | 61 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 62 | # ---------------------------------------------------------- 63 | # Produce a SEP delimited list of all paired combinations of elements of 64 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 65 | # has the form PREFIXmINFIXSUFFIXn. 66 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 67 | m4_define([lt_combine], 68 | [m4_if(m4_eval([$# > 3]), [1], 69 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 70 | [[m4_foreach([_Lt_prefix], [$2], 71 | [m4_foreach([_Lt_suffix], 72 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 73 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 74 | 75 | 76 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 77 | # ----------------------------------------------------------------------- 78 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 79 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 80 | m4_define([lt_if_append_uniq], 81 | [m4_ifdef([$1], 82 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 83 | [lt_append([$1], [$2], [$3])$4], 84 | [$5])], 85 | [lt_append([$1], [$2], [$3])$4])]) 86 | 87 | 88 | # lt_dict_add(DICT, KEY, VALUE) 89 | # ----------------------------- 90 | m4_define([lt_dict_add], 91 | [m4_define([$1($2)], [$3])]) 92 | 93 | 94 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 95 | # -------------------------------------------- 96 | m4_define([lt_dict_add_subkey], 97 | [m4_define([$1($2:$3)], [$4])]) 98 | 99 | 100 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 101 | # ---------------------------------- 102 | m4_define([lt_dict_fetch], 103 | [m4_ifval([$3], 104 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 105 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 106 | 107 | 108 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 109 | # ----------------------------------------------------------------- 110 | m4_define([lt_if_dict_fetch], 111 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 112 | [$5], 113 | [$6])]) 114 | 115 | 116 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 117 | # -------------------------------------------------------------- 118 | m4_define([lt_dict_filter], 119 | [m4_if([$5], [], [], 120 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 121 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 122 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 123 | ]) 124 | -------------------------------------------------------------------------------- /tests/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /tests/m4/lt~obsolete.m4: -------------------------------------------------------------------------------- 1 | # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004. 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # serial 5 lt~obsolete.m4 11 | 12 | # These exist entirely to fool aclocal when bootstrapping libtool. 13 | # 14 | # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) 15 | # which have later been changed to m4_define as they aren't part of the 16 | # exported API, or moved to Autoconf or Automake where they belong. 17 | # 18 | # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN 19 | # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us 20 | # using a macro with the same name in our local m4/libtool.m4 it'll 21 | # pull the old libtool.m4 in (it doesn't see our shiny new m4_define 22 | # and doesn't know about Autoconf macros at all.) 23 | # 24 | # So we provide this file, which has a silly filename so it's always 25 | # included after everything else. This provides aclocal with the 26 | # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything 27 | # because those macros already exist, or will be overwritten later. 28 | # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 29 | # 30 | # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. 31 | # Yes, that means every name once taken will need to remain here until 32 | # we give up compatibility with versions before 1.7, at which point 33 | # we need to keep only those names which we still refer to. 34 | 35 | # This is to help aclocal find these macros, as it can't see m4_define. 36 | AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) 37 | 38 | m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) 39 | m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) 40 | m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) 41 | m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) 42 | m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) 43 | m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) 44 | m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) 45 | m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) 46 | m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) 47 | m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) 48 | m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) 49 | m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) 50 | m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) 51 | m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) 52 | m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) 53 | m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) 54 | m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) 55 | m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) 56 | m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) 57 | m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) 58 | m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) 59 | m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) 60 | m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) 61 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) 62 | m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) 63 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) 64 | m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) 65 | m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) 66 | m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) 67 | m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) 68 | m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) 69 | m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) 70 | m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) 71 | m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) 72 | m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) 73 | m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) 74 | m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) 75 | m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) 76 | m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) 77 | m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) 78 | m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) 79 | m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) 80 | m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) 81 | m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) 82 | m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) 83 | m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) 84 | m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) 85 | m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) 86 | m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) 87 | m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) 88 | m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) 89 | m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) 90 | m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) 91 | m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) 92 | m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) 93 | m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) 94 | m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) 95 | m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) 96 | m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) 97 | m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) 98 | m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) 99 | -------------------------------------------------------------------------------- /tests/scripts/fastbit-config.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Initially written by John Wu on Jun 1 2009 4 | # Copyright (c) 2009-2015 the Regents of the University of California 5 | # 6 | # This file is part of FastBit project distributed under the terms of 7 | # LGPL. By continuing to use, modify, or distribute this file you 8 | # indicate that you have read the license and understand and accept it 9 | # fully. 10 | 11 | prefix=@prefix@ 12 | includedir=@includedir@ 13 | libdir=@prefix@@libdir@ 14 | 15 | usage() 16 | { 17 | cat < in C++ code 30 | Note: include in C code 31 | EOF 32 | exit $1 33 | } 34 | 35 | if test $# -eq 0 ; then 36 | usage 1 1>&2 37 | fi 38 | 39 | while test $# -gt 0 ; do 40 | case $1 in 41 | --prefix) 42 | echo_prefix=yes 43 | ;; 44 | --version) 45 | echo_fb_version=yes 46 | ;; 47 | --cflags) 48 | echo_cflags=yes 49 | ;; 50 | --cxxflags) 51 | echo_cxxflags=yes 52 | ;; 53 | --cxxextra) 54 | echo_cxxextra=yes 55 | ;; 56 | --libs) 57 | echo_libs=yes 58 | ;; 59 | *) 60 | usage 1 1>&2 61 | ;; 62 | esac 63 | shift 64 | done 65 | 66 | if test "$echo_prefix" = "yes" ; then 67 | echo $prefix 68 | fi 69 | 70 | if test "$echo_exec_prefix" = "yes" ; then 71 | echo $exec_prefix 72 | fi 73 | 74 | if test "$echo_fb_version" = "yes" ; then 75 | echo "@PACKAGE_STRING@" 76 | fi 77 | 78 | if test "$echo_cflags" = "yes" ; then 79 | cflags="@DEFS@ @AM_CPPFLAGS@ @PTHREAD_CFLAGS@" 80 | if test "$includedir" != "/usr/include" ; then 81 | echo $cflags -I$includedir 82 | else 83 | echo $cflags 84 | fi 85 | fi 86 | 87 | if test "$echo_cxxflags" = "yes" ; then 88 | cxxflags="@DEFS@ @AM_CPPFLAGS@ @EXTRA_CXXFLAGS@ @PTHREAD_CFLAGS@" 89 | if test "$includedir" != "/usr/include" ; then 90 | echo $cxxflags -I$includedir 91 | else 92 | echo $cxxflags 93 | fi 94 | fi 95 | 96 | if test "$echo_cxxextra" = "yes" ; then 97 | echo "@EXTRA_CXXFLAGS@" 98 | fi 99 | 100 | if test "$echo_libs" = "yes" ; then 101 | libs="-lfastbit @LIBS@ @PTHREAD_LIBS@" 102 | if test "$libdir" != "/usr/lib" && test "$libdir" != "/usr/lib64"; then 103 | echo -L$libdir $libs 104 | else 105 | echo $libs 106 | fi 107 | fi 108 | 109 | # EOF 110 | -------------------------------------------------------------------------------- /tests/scripts/hcompare.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Compare two histogram files and report the maximum relative 4 | # difference. The input files are assumed to be coma-separated values 5 | # (CSV) with the last column (or the second to the last column when a 6 | # third argument is provided) to be numerical values that can be 7 | # slightly off. The columns in front of the last one are treated as 8 | # keys for comparing the last value. If there is any key that are 9 | # different, the relative difference is reported as one and the keys are 10 | # printed. This script is written for comparing output from 11 | # check-marksdb, in which case we expect one single line of output 12 | # containing the word "acceptable." 13 | if ($#ARGV < 1) { 14 | print "hcompare.pl expects two file names on the command line.\n ", 15 | "If a third argument is present, the data files are exected to ", 16 | "contain counts as the last column\n"; 17 | die; 18 | } 19 | # 20 | open FileA, "$ARGV[0]" or die $!; 21 | open FileB, "$ARGV[1]" or die $!; 22 | # 23 | if ($#ARGV >= 2) { # the input file contains counts as the last column 24 | while () { 25 | #print "DEBUG: processing -- $_"; 26 | if (/(([^,]+,\s*)+)(\d+(.\d*)?([e|E][-+]?\d+)?),\s*(\d+)\s*$/) { 27 | #print "DEBUG: split to -- $1, $3, $6\n"; 28 | my $k = $1, $v = $3, $c = $6; 29 | $k =~ s/\s//g; 30 | $k =~ s/,$//; 31 | #print "DEBUG: split to -- $k, $v, $c\n"; 32 | $sumA{$k} += $v * $c; 33 | $cntA{$k} += $c; 34 | } 35 | else { 36 | print "Reject the following from $ARGV[0]: $_\n"; 37 | } 38 | } 39 | while () { 40 | if (/(([^,]+,\s*)+)(\d+(.\d*)?([e|E][-+]?\d+)?),\s*(\d+)\s*$/) { 41 | #print "DEBUG: split to -- $1, $3, $6\n"; 42 | my $k = $1, $v = $3, $c = $6; 43 | $k =~ s/\s//g; 44 | $k =~ s/,$//; 45 | #print "DEBUG: split to -- $k, $v, $c\n"; 46 | $sumB{$k} += $v * $c; 47 | $cntB{$k} += $c; 48 | } 49 | else { 50 | print "Reject the following from $ARGV[1]: $_\n"; 51 | } 52 | } 53 | } 54 | else { 55 | while () { 56 | if (/(([^,]+,\s*)+)(\d+(.\d*)?([e|E][-+]?\d+)?)\s*$/) { 57 | #print "DEBUG: $1 $3\n"; 58 | my $k = $1, $v = $3; 59 | $k =~ s/\s//g; 60 | $k =~ s/,$//; 61 | $sumA{$k} += $v; 62 | ++ $cntA{$k}; 63 | } 64 | else { 65 | print "Reject the following from $ARGV[0]: $_\n"; 66 | } 67 | } 68 | while () { 69 | if (/(([^,]+,\s*)+)(\d+(.\d*)?([e|E][-+]?\d+)?)\s*$/) { 70 | my $k = $1, $v = $3; 71 | $k =~ s/\s//g; 72 | $k =~ s/,$//; 73 | $sumB{$k} += $v; 74 | ++ $cntB{$k}; 75 | } 76 | else { 77 | print "Reject the following from $ARGV[1]: $_\n"; 78 | } 79 | } 80 | } 81 | close FileA; 82 | close FileB; 83 | # 84 | # the maximum relative difference observed so far 85 | $rd = 0; 86 | # number of warnings issued 87 | $nerrs = 0; 88 | # attempt to match all records in A with those of B 89 | foreach $k (sort keys %cntA) { 90 | if ($cntB{$k}) { 91 | if ($cntA{$k} == $cntB{$k}) { 92 | my $vA = $sumA{$k}; 93 | my $vB = $sumB{$k}; 94 | if ($vA != 0 || $vB != 0) { 95 | my $d = abs($vA - $vB) / 96 | (abs($vA) >= abs($vB) ? abs($vA) : abs($vB)); 97 | if ($d > $rd) { 98 | $rd = $d; 99 | } 100 | } 101 | } 102 | else { 103 | print "The counts for key \"$k\" are different: $ARGV[0] has $cntA{$k}, $ARGV[1] has $cntB{$k}\n"; 104 | ++ $nerrs; 105 | if ($cntA{$k} > 0 && $cntB{$k} > 0) { 106 | my $vA = $sumA{$k} / $cntA{$k}; 107 | my $vB = $sumB{$k} / $cntB{$k}; 108 | if ($vA != 0 || $vB != 0) { 109 | my $d = abs($vA - $vB) / 110 | (abs($vA) >= abs($vB) ? abs($vA) : abs($vB)); 111 | if ($d > $rd) { 112 | $rd = $d; 113 | } 114 | } 115 | } 116 | } 117 | } 118 | else { 119 | print "The key \"$k\" appears in $ARGV[0] with count $cntA{$k}, but does NOT appear in $ARGV[1]\n"; 120 | $rd += 1.0; 121 | ++ $nerrs; 122 | } 123 | } 124 | foreach $k (sort keys %cntB) { 125 | if (! $cntA{$k}) { 126 | print "The key \"$k\" appears in $ARGV[1] with count $cntB{$k}, but does NOT appear in $ARGV[0]\n"; 127 | $rd += 1.0; 128 | ++ $nerrs; 129 | } 130 | } 131 | if ($nerrs > 0) { 132 | print "\nComparing histograms in $ARGV[0] and $ARGV[1] produced $nerrs error", ($nerrs > 1 ? "s" : ""), "\n"; 133 | } 134 | elsif ($rd < 1e-12) { 135 | print "The relative difference between the histograms in $ARGV[0] and $ARGV[1] is $rd, an acceptable level\n"; 136 | } 137 | elsif ($rd < 1e-6) { 138 | print "The relative difference between the histograms in $ARGV[0] and $ARGV[1] is $rd, this different should be considered high\n"; 139 | } 140 | else { 141 | print "The relative difference between the histograms in $ARGV[0] and $ARGV[1] is $rd, please examine the files for details\n"; 142 | } 143 | -------------------------------------------------------------------------------- /tests/scripts/jrf-check.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # This is a perl script to run through a number of tests to verify the 3 | # functionality of FastBit keyword index. 4 | # It expects two arguments: 5 | # ibis executable 6 | # jrf test data 7 | @K1=("Good", "Not so good", "FiftyFifty", "Run Away"); 8 | @K2=("Strong", "Very Strong", "Extremely Strong", "More Vulnerable", 9 | "Less Vulnerable", "Adequate", "Currently Highly Vulnerable", 10 | "Currently Vulnerable", "Failed"); 11 | @K3=("A", "A-", "A+", "AA", "AA-", "AA+", "AAA", "B", "B-", "B+", "BB", "BB-", 12 | "BB+", "BBB", "BBB-", "BBB+", "C", "CC", "CCC", "D"); 13 | if ($#ARGV < 1) { 14 | print "Tests based on suggestion from Justo Ruiz Ferrer\n\nusage:\n", $0, " ibis-path jrf-data-dir\n"; 15 | exit; 16 | } 17 | $IBIS = $ARGV[0]; 18 | $JRFDIR = $ARGV[1]; 19 | $nerr1 = 0; 20 | for ($j = 0; $j <= $#K1; ++ $j) { 21 | $mesg = `$ARGV[0] -d $ARGV[1] -q "where k1 = \'$K1[$j]\'" 2>&1`; 22 | if ($mesg =~ /produced (\d+) hit/) { 23 | $nh1 = $1; 24 | } 25 | else { 26 | print "Warning -- failed to process $ARGV[0] -d $ARGV[1] -q \"where k1 = \'$K1[$j]\'\"\n"; 27 | $nh1 = -1; 28 | ++ $nerr1; 29 | } 30 | $mesg = `$ARGV[0] -d $ARGV[1] -q "where jc CONTAINS \'$K1[$j]\'" 2>&1`; 31 | if ($mesg =~ /produced (\d+) hit/) { 32 | $nhc = $1; 33 | } 34 | else { 35 | print "Warning -- failed to process $ARGV[0] -d $ARGV[1] -q \"where jc CONTAINS \'$K1[$j]\'\"\n"; 36 | $nhc = -2; 37 | ++ $nerr1; 38 | } 39 | $mesg = `$ARGV[0] -d $ARGV[1] -q "where js CONTAINS \'$K1[$j]\'" 2>&1`; 40 | if ($mesg =~ /produced (\d+) hit/) { 41 | $nhs = $1; 42 | } 43 | else { 44 | print "Warning -- failed to process $ARGV[0] -d $ARGV[1] -q \"where js CONTAINS \'$K1[$j]\'\"\n"; 45 | $nhs = -3; 46 | ++ $nerr1; 47 | } 48 | print "$K1[$j]\t--> $nh1, $nhc, $nhs\n"; 49 | if ($nh1 != $nhc) { 50 | print "Warning -- nh1 ($nh1) does not match nhc ($nhc)\n"; 51 | ++ $nerr1; 52 | } 53 | if ($nh1 != $nhs) { 54 | print "Warning -- nh1 ($nh1) does not match nhs ($nhs)\n"; 55 | ++ $nerr1; 56 | } 57 | if ($nhs != $nhc) { 58 | print "Warning -- nhs ($nhs) does not match nhc ($nhc)\n"; 59 | ++ $nerr1; 60 | } 61 | } 62 | if ($nerr1 == 0) { 63 | print "Successfully passed ", 1+$#K1, " test cases involving K1\n\n"; 64 | } 65 | else { 66 | print "Failed tests involving K1, nerr1 = $nerr1\n\n"; 67 | } 68 | $nerr2 = 0; 69 | for ($j = 0; $j <= $#K2; ++ $j) { 70 | $mesg = `$ARGV[0] -d $ARGV[1] -q "where k2 = \'$K2[$j]\'" 2>&1`; 71 | if ($mesg =~ /produced (\d+) hit/) { 72 | $nh2 = $1; 73 | } 74 | else { 75 | print "Warning -- failed to process $ARGV[0] -d $ARGV[1] -q \"where k2 = \'$K2[$j]\'\"\n"; 76 | $nh2 = -1; 77 | ++ $nerr2; 78 | } 79 | $mesg = `$ARGV[0] -d $ARGV[1] -q "where jc CONTAINS \'$K2[$j]\'" 2>&1`; 80 | if ($mesg =~ /produced (\d+) hit/) { 81 | $nhc = $1; 82 | } 83 | else { 84 | print "Warning -- failed to process $ARGV[0] -d $ARGV[1] -q \"where jc CONTAINS \'$K2[$j]\'\"\n"; 85 | $nhc = -2; 86 | ++ $nerr2; 87 | } 88 | $mesg = `$ARGV[0] -d $ARGV[1] -q "where js CONTAINS \'$K2[$j]\'" 2>&1`; 89 | if ($mesg =~ /produced (\d+) hit/) { 90 | $nhs = $1; 91 | } 92 | else { 93 | print "Warning -- failed to process $ARGV[0] -d $ARGV[1] -q \"where js CONTAINS \'$K2[$j]\'\"\n"; 94 | $nhs = -3; 95 | ++ $nerr2; 96 | } 97 | print "$K2[$j]\t--> $nh2, $nhc, $nhs\n"; 98 | if ($nh2 != $nhc) { 99 | print "Warning -- nh2 ($nh2) does not match nhc ($nhc)\n"; 100 | ++ $nerr2; 101 | } 102 | if ($nh2 != $nhs) { 103 | print "Warning -- nh2 ($nh2) does not match nhs ($nhs)\n"; 104 | ++ $nerr2; 105 | } 106 | if ($nhs != $nhc) { 107 | print "Warning -- nhs ($nhs) does not match nhc ($nhc)\n"; 108 | ++ $nerr2; 109 | } 110 | } 111 | if ($nerr2 == 0) { 112 | print "Successfully passed ", 1+$#K2, " test cases involving K2\n\n"; 113 | } 114 | else { 115 | print "Failed tests involving K2, nerr2 = $nerr2\n\n"; 116 | } 117 | $nerr3 = 0; 118 | for ($j = 0; $j <= $#K3; ++ $j) { 119 | $mesg = `$ARGV[0] -d $ARGV[1] -q "where k3 = \'$K3[$j]\'" 2>&1`; 120 | if ($mesg =~ /produced (\d+) hit/) { 121 | $nh3 = $1; 122 | } 123 | else { 124 | print "Warning -- failed to process $ARGV[0] -d $ARGV[1] -q \"where k3 = \'$K3[$j]\'\"\n"; 125 | $nh3 = -1; 126 | ++ $nerr3; 127 | } 128 | $mesg = `$ARGV[0] -d $ARGV[1] -q "where jc CONTAINS \'$K3[$j]\'" 2>&1`; 129 | if ($mesg =~ /produced (\d+) hit/) { 130 | $nhc = $1; 131 | } 132 | else { 133 | print "Warning -- failed to process $ARGV[0] -d $ARGV[1] -q \"where jc CONTAINS \'$K3[$j]\'\"\n"; 134 | $nhc = -2; 135 | ++ $nerr3; 136 | } 137 | $mesg = `$ARGV[0] -d $ARGV[1] -q "where js CONTAINS \'$K3[$j]\'" 2>&1`; 138 | if ($mesg =~ /produced (\d+) hit/) { 139 | $nhs = $1; 140 | } 141 | else { 142 | print "Warning -- failed to process $ARGV[0] -d $ARGV[1] -q \"where js CONTAINS \'$K3[$j]\'\"\n"; 143 | $nhs = -3; 144 | ++ $nerr3; 145 | } 146 | print "$K3[$j]\t--> $nh3, $nhc, $nhs\n"; 147 | if ($nh3 != $nhc) { 148 | print "Warning -- nh3 ($nh3) does not match nhc ($nhc)\n"; 149 | ++ $nerr3; 150 | } 151 | if ($nh3 != $nhs) { 152 | print "Warning -- nh3 ($nh3) does not match nhs ($nhs)\n"; 153 | ++ $nerr3; 154 | } 155 | if ($nhs != $nhc) { 156 | print "Warning -- nhs ($nhs) does not match nhc ($nhc)\n"; 157 | ++ $nerr3; 158 | } 159 | } 160 | if ($nerr3 == 0) { 161 | print "Successfully passed ", 1+$#K3, " test cases involving K3\n"; 162 | } 163 | else { 164 | print "Failed tests involving K3, nerr3 = $nerr3\n"; 165 | } 166 | -------------------------------------------------------------------------------- /tests/scripts/matchCounts.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # This script takes three arguments: 3 | # command-to-run query-hits-list tmp-filename 4 | # The query-hits-list is a file with a string and a number on each line 5 | # (separated by a coma). This script passes the string as the query 6 | # string to the command-to-run. It then check for a string matches 7 | # the pattern ' ==> xxx ', where 'xxx' is the number following the string. 8 | # 9 | $OUTPUT_AUTOFLUSH=STDOUT; 10 | #$OUTPUT_AUTOFLUSH=STDERR; 11 | if ($#ARGV < 1) { 12 | print "\nusage:\n", $0, " executable-path query-hits-file [temp-filename]\nThe first two arguments are mandatory.\nCurrently there are $#ARGV arguments\n"; 13 | exit; 14 | } 15 | if ($#ARGV > 1) { 16 | $tmp = "$ARGV[2]/matchCounts-output$$"; 17 | } 18 | else { 19 | $tmp = "matchCounts-output$$"; 20 | } 21 | 22 | unless (open QH, $ARGV[1]) { 23 | die "failed to open file ", $ARGV[1], "\n"; 24 | } 25 | 26 | while () { 27 | next if /^#/; # skip comment lines 28 | next if /^$/; # skip blank lines 29 | chop; # remove the end-of-line character 30 | @ln = split /;/; # split a line into query and hits 31 | next if (@ln < 2); 32 | 33 | ++ $nlines; 34 | $cond = $ln[0]; 35 | $hits = $ln[1]; 36 | $rc = 0xffff & system("$ARGV[0] -q \"$cond\" > $tmp 2>&1"); 37 | #print "\"$ARGV[0] -q $cond > $tmp\" returned with code ", $rc, "\n"; 38 | $bak = $cond; 39 | $bak =~ s/\W/_/g; 40 | $bak = "$tmp-$bak"; 41 | #print "\$bak=$bak\n"; 42 | if ($rc == 0) { 43 | $match = `fgrep "==> $hits " $tmp | wc -l`; 44 | if ($match) { 45 | ++$nmatches; 46 | if (`egrep "Error|Warning|warning" $tmp | wc -l` > 0) { 47 | system("cp", $tmp, "$bak"); 48 | print "Query \"$cond\" completed with errors, output file saved to $bak\n"; 49 | } 50 | } 51 | else { 52 | system("cp", $tmp, "$bak"); 53 | print "Query \"$cond\" failed to match expected number of hits, output file saved to $bak\n"; 54 | } 55 | } 56 | elsif ($rc == 0xff00) { 57 | system("cp", $tmp, "$bak"); 58 | print "\"$ARGV[0] -q $cond > $tmp\" failed: $!\n"; 59 | } 60 | elsif (($rc & 0xff) > 0) { 61 | system("cp", $tmp, "$bak"); 62 | if ($rc & 0x80) { 63 | $rc &= ~0x80; 64 | print "\"$ARGV[0] -q $cond > $tmp\" core dumped with signal $rc\n"; 65 | } 66 | else { 67 | print "\"$ARGV[0] -q $cond > $tmp\" received signal $rc\n"; 68 | } 69 | } 70 | else { 71 | system("cp", $tmp, "$bak"); 72 | print "\"$ARGV[0] -q $cond > $tmp\" received an unexpected return code $rc\n"; 73 | } 74 | } 75 | # 76 | unlink $tmp; # no longer need the tmp file 77 | if ($nlines == $nmatches) { 78 | print "All $nlines queries match the expected results\n"; 79 | exit 0; 80 | } 81 | elsif ($nmatches) { 82 | print "$nmatches out of $nlines matche the expected results\n"; 83 | exit -1; 84 | } 85 | else { 86 | print "None of $nlines matche the expected results\n"; 87 | exit -2; 88 | } 89 | -------------------------------------------------------------------------------- /tests/scripts/printWarning.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # a simple script to print Warning messages along with some selected 3 | # information 4 | while (<>) { 5 | if (/^index =/) { 6 | $last = $_; 7 | } 8 | elsif (/^Warning /) { 9 | if ($last) { 10 | print "\n", $last; 11 | undef $last; # to allow consecutive warnings to be printed together 12 | } 13 | print $_; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/scripts/query-count.list: -------------------------------------------------------------------------------- 1 | # the separator between query and hist (;) can not appear in the query expressions 2 | from test0 where sqrt(i0)*sqrt(i0) > 70 and i1 > 20; 29 3 | from test0 where (i2 < 0 OR i2 > 70) and i1 < 20; 20 4 | from test0 where (i0 < 0 OR i0 > 70) and (i1 > 100 OR i1 < 80); 9 5 | from test0 where i2 > 70 and i1 > 20; 8 6 | from test0 where i2 > 71 and i1 > 23; 4 7 | from test0 where (i2 < 0 OR i2 > 70) and i1 > 30; 0 8 | from test0 where i2 = 70 and i1 > 20; 1 9 | from test0 where i2 = 50 and i1 = 49; 1 10 | from test0 where i0 = 30 and i1 = 49; 0 11 | from test0 where 13 <= sqrt((i0*i0+i1*i1)/2) < 30 and 15 <= i1 < 49; 15 12 | from test0 where 13 <= i0 < 31 and 15 <= i1 < 49; 16 13 | from test0 where 13 <= i0 < 32 and 15 <= i1 < 49; 17 14 | from test0 where 13 <= i0 < 30 and 15 <= i2 < 70; 0 15 | from test0 where 13 <= i2 < 31 and 15 <= i1 < 69; 0 16 | from test0 where 13 <= i2 < 32 and 15 <= i1 < 69; 1 17 | from test0 where (i0 = 50 || i0 = 49) and (i1 = 50 || i1 = 49); 2 18 | from test0 where (i2 = 50 || i2 = 49) and (i1 = 50 || i1 = 49); 2 19 | from test0 where i2 > 90; 9 20 | from test0 where 0 <= 10 ** log10(i0) < 99; 99 21 | from test0 where -1 <= exp(log(i1)) < 99; 99 22 | from test0 where -2 <= i2 < 99; 99 23 | from test0 where -3 < i0 < 99; 98 24 | from test0 where -4 < i1 < 99; 98 25 | from test0 where -5 < i2 < 99; 98 26 | from test1 where sqrt(c4z0)<100; 1000 27 | from test1 where c2z0<99; 991 28 | from test1 where c2z0>0; 991 29 | from test1 where c2z0 in (8 10 12 14 16 18 20 22 24 26 28 29 30 31 32 33 34); 183 30 | from test1 where c2z0 in (71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99); 280 31 | from test1 where c2z1>50; 133 32 | from test1 where c2z2>70; 3 33 | from test1 where c4z0>7000; 300 34 | from test1 where c4z1>50; 565 35 | from test1 where c4z2>70; 12 36 | from test1 where z0=0; 1000 37 | from test1 where z1=0; 0 38 | from test1 where c6z0<2000; 2 39 | from test1 where c2z2 > 50 && c6z0 > 2000; 7 40 | from test1 where c2z1 == 50 && c6z0 == 522316; 1 41 | from test1 where c2z2 == 4 && z1 = 1 && z0 < 1; 19 42 | -------------------------------------------------------------------------------- /tests/scripts/star2002.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # A simple script to excercise the sample dataset star2002. 3 | if [ $# -gt 0 ]; then BIN="$1"; else BIN="../examples"; fi; 4 | if [ ! -x ${BIN}/ibis ]; then 5 | echo $0 failed to locate command line tool ibis in ${BIN}; 6 | exit -1; 7 | fi 8 | if [ $# -gt 1 ]; then 9 | DATADIR=$2; 10 | else 11 | DATADIR="http://sdm.lbl.gov/fastbit/data"; 12 | fi 13 | if [ ! -f star2002-1.csv ]; then 14 | if [ ! -f star2002-1.csv.gz ]; then 15 | wget ${DATADIR}/star2002-1.csv.gz 16 | if [ ! -f star2002-1.csv.gz ]; then 17 | echo $0 failed to retrieve star2002-1.csv.gz; 18 | exit -1; 19 | fi 20 | fi 21 | gunzip -v star2002-1.csv.gz 22 | fi 23 | # 24 | if [ ! -f star2002-2.csv ]; then 25 | if [ ! -f star2002-2.csv.gz ]; then 26 | wget ${DATADIR}/star2002-2.csv.gz 27 | if [ ! -f star2002-2.csv.gz ]; then 28 | echo $0 failed to retrieve star2002-2.csv.gz; 29 | exit -1; 30 | fi 31 | fi 32 | gunzip -v star2002-2.csv.gz 33 | fi 34 | # 35 | if [ ! -f star2002-3.csv ]; then 36 | if [ ! -f star2002-3.csv.gz ]; then 37 | wget ${DATADIR}/star2002-3.csv.gz 38 | if [ ! -f star2002-3.csv.gz ]; then 39 | echo $0 failed to retrieve star2002-3.csv.gz; 40 | exit -1; 41 | fi 42 | fi 43 | gunzip -v star2002-3.csv.gz 44 | fi 45 | ${BIN}/ardea -d star2002 -m "antiNucleus:int, eventFile:int, eventNumber:int, eventTime:double, histFile:int, multiplicity:int, NaboveLb:int, NbelowLb:int, NLb:int, primaryTracks:int, prodTime:double, Pt:float, runNumber:int, vertexX:float, vertexY:float, vertexZ:float" -t star2002-1.csv -t star2002-2.csv -t star2002-3.csv -v 46 | ${BIN}/ibis -d star2002 -t 2 -v 2 47 | echo "\n$0 ... DONE" 48 | # 49 | -------------------------------------------------------------------------------- /tests/test0.csv: -------------------------------------------------------------------------------- 1 | #"i0", "i1", "i2" 2 | 0, 0.0, 99 3 | 1, 1.0, 98 4 | 2, 2.0, 97 5 | 3, 3.0, 96 6 | 4, 4.0, 95 7 | 5, 5.0, 94 8 | 6, 6.0, 93 9 | 7, 7.0, 92 10 | 8, 8.0, 91 11 | 9, 9.0, 90 12 | 10, 10, 89 13 | 11, 11, 88 14 | 12, 12, 87 15 | 13, 13, 86 16 | 14, 14, 85 17 | 15, 15, 84 18 | 16, 16, 83 19 | 17, 17, 82 20 | 18, 18, 81 21 | 19, 19, 80 22 | 20, 20, 79 23 | 21, 21, 78 24 | 22, 22, 77 25 | 23, 23, 76 26 | 24, 24, 75 27 | 25, 25, 74 28 | 26, 26, 73 29 | 27, 27, 72 30 | 28, 28, 71 31 | 29, 29, 70 32 | 30, 30, 69 33 | 31, 31, 68 34 | 32, 32, 67 35 | 33, 33, 66 36 | 34, 34, 65 37 | 35, 35, 64 38 | 36, 36, 63 39 | 37, 37, 62 40 | 38, 38, 61 41 | 39, 39, 60 42 | 40, 40, 59 43 | 41, 41, 58 44 | 42, 42, 57 45 | 43, 43, 56 46 | 44, 44, 55 47 | 45, 45, 54 48 | 46, 46, 53 49 | 47, 47, 52 50 | 48, 48, 51 51 | 49, 49, 50 52 | 50, 50, 49 53 | 51, 51, 48 54 | 52, 52, 47 55 | 53, 53, 46 56 | 54, 54, 45 57 | 55, 55, 44 58 | 56, 56, 43 59 | 57, 57, 42 60 | 58, 58, 41 61 | 59, 59, 40 62 | 60, 60, 39 63 | 61, 61, 38 64 | 62, 62, 37 65 | 63, 63, 36 66 | 64, 64, 35 67 | 65, 65, 34 68 | 66, 66, 33 69 | 67, 67, 32 70 | 68, 68, 31 71 | 69, 69, 30 72 | 70, 70, 29 73 | 71, 71, 28 74 | 72, 72, 27 75 | 73, 73, 26 76 | 74, 74, 25 77 | 75, 75, 24 78 | 76, 76, 23 79 | 77, 77, 22 80 | 78, 78, 21 81 | 79, 79, 20 82 | 80, 80, 19 83 | 81, 81, 18 84 | 82, 82, 17 85 | 83, 83, 16 86 | 84, 84, 15 87 | 85, 85, 14 88 | 86, 86, 13 89 | 87, 87, 12 90 | 88, 88, 11 91 | 89, 89, 10 92 | 90, 90, 9 93 | 91, 91, 8 94 | 92, 92, 7 95 | 93, 93, 6 96 | 94, 94, 5 97 | 95, 95, 4 98 | 96, 96, 3 99 | 97, 97, 2 100 | 98, 98, 1 101 | 99, , 0 102 | -------------------------------------------------------------------------------- /tests/vault/acmpub-0: -------------------------------------------------------------------------------- 1 | "SIGMOD", 520 2 | "VLDB", 843 3 | -------------------------------------------------------------------------------- /tests/vault/acmpub-1: -------------------------------------------------------------------------------- 1 | "SIGMOD" 2 | "ICDM" 3 | -------------------------------------------------------------------------------- /tests/vault/acmpub-2: -------------------------------------------------------------------------------- 1 | c 2 | 2 3 | -------------------------------------------------------------------------------- /tests/vault/hist0: -------------------------------------------------------------------------------- 1 | 2 | Column c 3 | c: (USHORT) [0, 99], actual range <0, 99> 4 | Histogram [19] under the condition of "c>80" 5 | (bounds, # records in bin) 6 | [81, 82) 2 7 | [82, 83) 2 8 | [83, 84) 2 9 | [84, 85) 2 10 | [85, 86) 2 11 | [86, 87) 2 12 | [87, 88) 2 13 | [88, 89) 2 14 | [89, 90) 2 15 | [90, 91) 2 16 | [91, 92) 2 17 | [92, 93) 2 18 | [93, 94) 2 19 | [94, 95) 2 20 | [95, 96) 2 21 | [96, 97) 2 22 | [97, 98) 2 23 | [98, 99) 2 24 | [99, 100) 2 25 | total count = 38, tbl.nRows() = 200 26 | -------------------------------------------------------------------------------- /tests/vault/hist1: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2D-Joint distribution of a and b from table t1 subject to the condition c>50 with 625 bins on 25 x 25 cells 4 | 0 [0, 4) [0, 4) 8 5 | 26 [4, 8) [4, 8) 8 6 | 52 [8, 12) [8, 12) 8 7 | 78 [12, 16) [12, 16) 8 8 | 104 [16, 20) [16, 20) 8 9 | 130 [20, 24) [20, 24) 8 10 | 156 [24, 28) [24, 28) 8 11 | 182 [28, 32) [28, 32) 8 12 | 208 [32, 36) [32, 36) 8 13 | 234 [36, 40) [36, 40) 8 14 | 260 [40, 44) [40, 44) 8 15 | 286 [44, 48) [44, 48) 8 16 | 312 [48, 52) [48, 52) 2 17 | Number of occupied cells = 13, total count = 98, number of rows in t1 = 200 18 | 19 | -------------------------------------------------------------------------------- /tests/vault/hist2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3D-Joint distribution of c, a, and b from table t1 subject to the condition c>50 with 1728 bins on 12 x 12 x 12 cells 4 | 916 [49.875, 58.1875) [33.25, 41.5625) [34, 42.5) 2 5 | 928 [49.875, 58.1875) [41.5625, 49.875) [34, 42.5) 2 6 | 929 [49.875, 58.1875) [41.5625, 49.875) [42.5, 51) 12 7 | 1047 [58.1875, 66.5) [24.9375, 33.25) [25.5, 34) 2 8 | 1060 [58.1875, 66.5) [33.25, 41.5625) [34, 42.5) 14 9 | 1190 [66.5, 74.8125) [24.9375, 33.25) [17, 25.5) 2 10 | 1191 [66.5, 74.8125) [24.9375, 33.25) [25.5, 34) 14 11 | 1309 [74.8125, 83.125) [8.3125, 16.625) [8.5, 17) 2 12 | 1322 [74.8125, 83.125) [16.625, 24.9375) [17, 25.5) 16 13 | 1440 [83.125, 91.4375) [0, 8.3125) [0, 8.5) 2 14 | 1453 [83.125, 91.4375) [8.3125, 16.625) [8.5, 17) 14 15 | 1584 [91.4375, 99.75) [0, 8.3125) [0, 8.5) 16 16 | Number of occupied cells = 12, total count = 98, number of rows in t1 = 200 17 | 18 | -------------------------------------------------------------------------------- /tests/vault/hist3: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1D-Weighted distribution of a from table t1 subject to the condition c > 80 with 100 bins 4 | 1 [1, 2) 2 5 | 2 [2, 3) 4 6 | 3 [3, 4) 6 7 | 4 [4, 5) 8 8 | 5 [5, 6) 10 9 | 6 [6, 7) 12 10 | 7 [7, 8) 14 11 | 8 [8, 9) 16 12 | 9 [9, 10) 18 13 | 10 [10, 11) 20 14 | 11 [11, 12) 22 15 | 12 [12, 13) 24 16 | 13 [13, 14) 26 17 | 14 [14, 15) 28 18 | 15 [15, 16) 30 19 | 16 [16, 17) 32 20 | 17 [17, 18) 34 21 | 18 [18, 19) 36 22 | Number of occupied cells = 18, total weight = 342, number of rows in t1 = 200 23 | 24 | -------------------------------------------------------------------------------- /tests/vault/hist4: -------------------------------------------------------------------------------- 1 | 0, 94.5, 7 2 | 1, 84.5, 7 3 | 2, 77, 7 4 | -------------------------------------------------------------------------------- /tests/vault/hist5: -------------------------------------------------------------------------------- 1 | 70, 94.5, 10, 0 2 | 70, 84.5, 10, 1 3 | 35, 77, 5, 2 4 | -------------------------------------------------------------------------------- /tests/vault/hist6: -------------------------------------------------------------------------------- 1 | 13, 56, 7, 8, 2 2 | 14, 42, 21, 2, 0 3 | 14, 154, 28, 5.5, 1 4 | 15, 0, 7, 0, 0 5 | -------------------------------------------------------------------------------- /tests/vault/inRange-1: -------------------------------------------------------------------------------- 1 | Number of rows produced by "SELECT l, count(*) WHERE l IN (1,2)": 2 2 | 1, 1 3 | 2, 2 4 | Number of rows produced by "SELECT l, count(*) WHERE l IN (1)": 1 5 | 1, 1 6 | Number of rows produced by "SELECT l, count(*) WHERE l IN (3)": 1 7 | 3, 3 8 | Number of rows produced by "SELECT l, count(*) WHERE l IN (1,3)": 2 9 | 1, 1 10 | 3, 3 11 | -------------------------------------------------------------------------------- /tests/vault/join-1: -------------------------------------------------------------------------------- 1 | 6 2 | 7 3 | 8 4 | 9 5 | -------------------------------------------------------------------------------- /tests/vault/join-2: -------------------------------------------------------------------------------- 1 | 6 2 | 6 3 | 7 4 | 7 5 | 8 6 | 8 7 | 9 8 | 9 9 | -------------------------------------------------------------------------------- /tests/vault/join-3: -------------------------------------------------------------------------------- 1 | 0, 24.75 2 | 0, 24.75 3 | 0, 24.75 4 | 0, 24.75 5 | 1, 25.5 6 | 1, 25.5 7 | 1, 25.5 8 | 1, 25.5 9 | 2, 26.25 10 | 2, 26.25 11 | 2, 26.25 12 | 2, 26.25 13 | 3, 27 14 | 3, 27 15 | 3, 27 16 | 3, 27 17 | 4, 27.75 18 | 4, 27.75 19 | 4, 27.75 20 | 4, 27.75 21 | -------------------------------------------------------------------------------- /tests/vault/join-4: -------------------------------------------------------------------------------- 1 | 24, 0, 4 2 | 25, 1, 4 3 | 26, 2, 4 4 | 27, 3.5, 8 5 | -------------------------------------------------------------------------------- /tests/vault/join-5: -------------------------------------------------------------------------------- 1 | 6, 6 2 | 7, 6 3 | 7, 7 4 | 8, 7 5 | 8, 8 6 | 9, 8 7 | 9, 9 8 | -------------------------------------------------------------------------------- /tests/vault/join-6: -------------------------------------------------------------------------------- 1 | -1, 0.5 2 | 0, 0.5 3 | -------------------------------------------------------------------------------- /tests/vault/join-7: -------------------------------------------------------------------------------- 1 | 0, 24.75 2 | 0, 24.75 3 | 0, 24.75 4 | 0, 24.75 5 | 1, 24.5 6 | 1, 24.5 7 | 1, 24.5 8 | 1, 24.5 9 | 1, 25.5 10 | 1, 25.5 11 | 1, 25.5 12 | 1, 25.5 13 | 2, 25.25 14 | 2, 25.25 15 | 2, 25.25 16 | 2, 25.25 17 | 2, 26.25 18 | 2, 26.25 19 | 2, 26.25 20 | 2, 26.25 21 | 3, 26 22 | 3, 26 23 | 3, 26 24 | 3, 26 25 | 3, 27 26 | 3, 27 27 | 3, 27 28 | 3, 27 29 | 4, 26.75 30 | 4, 26.75 31 | 4, 26.75 32 | 4, 26.75 33 | 4, 27.75 34 | 4, 27.75 35 | 4, 27.75 36 | 4, 27.75 37 | -------------------------------------------------------------------------------- /tests/vault/join-8: -------------------------------------------------------------------------------- 1 | 24, 8 2 | 25, 28 3 | 26, 28 4 | -------------------------------------------------------------------------------- /tests/vault/marksdb-1: -------------------------------------------------------------------------------- 1 | -10, 112, 0 2 | -10, 112, 0 3 | -10, 112, 0 4 | -10, 112, 0 5 | -10, 112, 0 6 | -10, 112, 0 7 | -10, 112, 0 8 | -10, 112, 0 9 | -10, 112, 0 10 | -10, 112, 0 11 | -10, 112, 0 12 | -10, 112, 0 13 | -10, 112, 0 14 | -10, 112, 0 15 | -10, 112, 0 16 | -10, 112, 0 17 | -10, 112, 0 18 | -10, 112, 0 19 | -10, 112, 0 20 | -10, 112, 0 21 | -10, 112, 0 22 | -10, 112, 0 23 | -10, 112, 0 24 | -10, 112, 0 25 | -10, 112, 0 26 | -10, 112, 0 27 | -10, 112, 0 28 | -10, 112, 0 29 | -10, 112, 0 30 | -10, 112, 0 31 | -10, 112.125, 8.47437635059235 32 | -10, 112.125, 8.47437635059235 33 | -10, 112.125, 8.47437635059235 34 | -10, 112.125, 8.47437635059235 35 | -10, 112.125, 8.47437635059235 36 | -10, 112.125, 8.47437635059235 37 | -10, 112.125, 8.47437635059235 38 | -10, 112.125, 8.47437635059235 39 | -10, 112.125, 8.47437635059235 40 | -10, 112.125, 8.47437635059235 41 | -10, 112.125, 8.47437635059235 42 | -10, 112.125, 8.47437635059235 43 | -10, 112.125, 8.47437635059235 44 | -10, 112.125, 8.47437635059235 45 | -10, 112.125, 8.47437635059235 46 | -10, 112.125, 8.47437635059235 47 | -10, 112.125, 8.47437635059235 48 | -10, 112.125, 8.47437635059235 49 | -10, 112.125, 8.47437635059235 50 | -10, 112.125, 8.47437635059235 51 | -10, 112.125, 8.47437635059235 52 | -10, 112.125, 8.47437635059235 53 | -10, 112.125, 8.47437635059235 54 | -10, 112.125, 8.47437635059235 55 | -10, 112.125, 8.47437635059235 56 | -10, 112.125, 8.47437635059235 57 | -10, 112.125, 8.47437635059235 58 | -10, 112.125, 8.47437635059235 59 | -10, 112.125, 8.47437635059235 60 | -10, 112.125, 8.47437635059235 61 | -10, 111.875, 8.47437635059427 62 | -10, 111.875, 8.47437635059427 63 | -10, 111.875, 8.47437635059427 64 | -10, 111.875, 8.47437635059427 65 | -10, 111.875, 8.47437635059427 66 | -10, 111.875, 8.47437635059427 67 | -10, 111.875, 8.47437635059427 68 | -10, 111.875, 8.47437635059427 69 | -10, 111.875, 8.47437635059427 70 | -10, 111.875, 8.47437635059427 71 | -10, 111.875, 8.47437635059427 72 | -10, 111.875, 8.47437635059427 73 | -10, 111.875, 8.47437635059427 74 | -10, 111.875, 8.47437635059427 75 | -10, 111.875, 8.47437635059427 76 | -10, 111.875, 8.47437635059427 77 | -10, 111.875, 8.47437635059427 78 | -10, 111.875, 8.47437635059427 79 | -10, 111.875, 8.47437635059427 80 | -10, 111.875, 8.47437635059427 81 | -10, 111.875, 8.47437635059427 82 | -10, 111.875, 8.47437635059427 83 | -10, 111.875, 8.47437635059427 84 | -10, 111.875, 8.47437635059427 85 | -10, 111.875, 8.47437635059427 86 | -10, 111.875, 8.47437635059427 87 | -10, 111.875, 8.47437635059427 88 | -10, 111.875, 8.47437635059427 89 | -10, 111.875, 8.47437635059427 90 | -10, 111.875, 8.47437635059427 91 | -10.125, 112, 8.6043 92 | -10.125, 112, 8.6043 93 | -10.125, 112, 8.6043 94 | -10.125, 112, 8.6043 95 | -10.125, 112, 8.6043 96 | -10.125, 112, 8.6043 97 | -10.125, 112, 8.6043 98 | -10.125, 112, 8.6043 99 | -10.125, 112, 8.6043 100 | -10.125, 112, 8.6043 101 | -10.125, 112, 8.6043 102 | -10.125, 112, 8.6043 103 | -10.125, 112, 8.6043 104 | -10.125, 112, 8.6043 105 | -10.125, 112, 8.6043 106 | -10.125, 112, 8.6043 107 | -10.125, 112, 8.6043 108 | -10.125, 112, 8.6043 109 | -10.125, 112, 8.6043 110 | -10.125, 112, 8.6043 111 | -10.125, 112, 8.6043 112 | -10.125, 112, 8.6043 113 | -10.125, 112, 8.6043 114 | -10.125, 112, 8.6043 115 | -10.125, 112, 8.6043 116 | -10.125, 112, 8.6043 117 | -10.125, 112, 8.6043 118 | -10.125, 112, 8.6043 119 | -10.125, 112, 8.6043 120 | -10.125, 112, 8.6043 121 | -------------------------------------------------------------------------------- /tests/vault/marksdb-3: -------------------------------------------------------------------------------- 1 | -10, 112.125 2 | -10, 112.125 3 | -10, 112.125 4 | -10, 112.125 5 | -10, 112.125 6 | -10, 112.125 7 | -10, 112.125 8 | -10, 112.125 9 | -10, 112.125 10 | -10, 112.125 11 | -10, 112.125 12 | -10, 112.125 13 | -10, 112.125 14 | -10, 112.125 15 | -10, 112.125 16 | -10, 112.125 17 | -10, 112.125 18 | -10, 112.125 19 | -10, 112.125 20 | -10, 112.125 21 | -10, 112.125 22 | -10, 112.125 23 | -10, 112.125 24 | -10, 112.125 25 | -10, 112.125 26 | -10, 112.125 27 | -10, 112.125 28 | -10, 112.125 29 | -10, 112.125 30 | -10, 112.125 31 | -10, 112 32 | -10, 112 33 | -10, 112 34 | -10, 112 35 | -10, 112 36 | -10, 112 37 | -10, 112 38 | -10, 112 39 | -10, 112 40 | -10, 112 41 | -10, 112 42 | -10, 112 43 | -10, 112 44 | -10, 112 45 | -10, 112 46 | -10, 112 47 | -10, 112 48 | -10, 112 49 | -10, 112 50 | -10, 112 51 | -10, 112 52 | -10, 112 53 | -10, 112 54 | -10, 112 55 | -10, 112 56 | -10, 112 57 | -10, 112 58 | -10, 112 59 | -10, 112 60 | -10, 112 61 | -10, 111.875 62 | -10, 111.875 63 | -10, 111.875 64 | -10, 111.875 65 | -10, 111.875 66 | -10, 111.875 67 | -10, 111.875 68 | -10, 111.875 69 | -10, 111.875 70 | -10, 111.875 71 | -10, 111.875 72 | -10, 111.875 73 | -10, 111.875 74 | -10, 111.875 75 | -10, 111.875 76 | -10, 111.875 77 | -10, 111.875 78 | -10, 111.875 79 | -10, 111.875 80 | -10, 111.875 81 | -10, 111.875 82 | -10, 111.875 83 | -10, 111.875 84 | -10, 111.875 85 | -10, 111.875 86 | -10, 111.875 87 | -10, 111.875 88 | -10, 111.875 89 | -10, 111.875 90 | -10, 111.875 91 | -10.125, 112.125 92 | -10.125, 112.125 93 | -10.125, 112.125 94 | -10.125, 112.125 95 | -10.125, 112.125 96 | -10.125, 112.125 97 | -10.125, 112.125 98 | -10.125, 112.125 99 | -10.125, 112.125 100 | -10.125, 112.125 101 | -10.125, 112.125 102 | -10.125, 112.125 103 | -10.125, 112.125 104 | -10.125, 112.125 105 | -10.125, 112.125 106 | -10.125, 112.125 107 | -10.125, 112.125 108 | -10.125, 112.125 109 | -10.125, 112.125 110 | -10.125, 112.125 111 | -10.125, 112.125 112 | -10.125, 112.125 113 | -10.125, 112.125 114 | -10.125, 112.125 115 | -10.125, 112.125 116 | -10.125, 112.125 117 | -10.125, 112.125 118 | -10.125, 112.125 119 | -10.125, 112.125 120 | -10.125, 112.125 121 | -10.125, 112 122 | -10.125, 112 123 | -10.125, 112 124 | -10.125, 112 125 | -10.125, 112 126 | -10.125, 112 127 | -10.125, 112 128 | -10.125, 112 129 | -10.125, 112 130 | -10.125, 112 131 | -10.125, 112 132 | -10.125, 112 133 | -10.125, 112 134 | -10.125, 112 135 | -10.125, 112 136 | -10.125, 112 137 | -10.125, 112 138 | -10.125, 112 139 | -10.125, 112 140 | -10.125, 112 141 | -10.125, 112 142 | -10.125, 112 143 | -10.125, 112 144 | -10.125, 112 145 | -10.125, 112 146 | -10.125, 112 147 | -10.125, 112 148 | -10.125, 112 149 | -10.125, 112 150 | -10.125, 112 151 | -10.125, 111.875 152 | -10.125, 111.875 153 | -10.125, 111.875 154 | -10.125, 111.875 155 | -10.125, 111.875 156 | -10.125, 111.875 157 | -10.125, 111.875 158 | -10.125, 111.875 159 | -10.125, 111.875 160 | -10.125, 111.875 161 | -10.125, 111.875 162 | -10.125, 111.875 163 | -10.125, 111.875 164 | -10.125, 111.875 165 | -10.125, 111.875 166 | -10.125, 111.875 167 | -10.125, 111.875 168 | -10.125, 111.875 169 | -10.125, 111.875 170 | -10.125, 111.875 171 | -10.125, 111.875 172 | -10.125, 111.875 173 | -10.125, 111.875 174 | -10.125, 111.875 175 | -10.125, 111.875 176 | -10.125, 111.875 177 | -10.125, 111.875 178 | -10.125, 111.875 179 | -10.125, 111.875 180 | -10.125, 111.875 181 | -------------------------------------------------------------------------------- /tests/vault/marksdb-4: -------------------------------------------------------------------------------- 1 | -11, 111, 15.5402474629071, 60 2 | -11, 112, 13.228264975271, 90 3 | -10, 111, 12.7115643756979, 60 4 | -10, 112, 8.47437625046462, 90 5 | -------------------------------------------------------------------------------- /tests/vault/small-1: -------------------------------------------------------------------------------- 1 | 1, 1.1 2 | -------------------------------------------------------------------------------- /tests/vault/small-10: -------------------------------------------------------------------------------- 1 | 105, 1.00001, 4 2 | 105, 1.0001, 2 3 | -------------------------------------------------------------------------------- /tests/vault/small-11: -------------------------------------------------------------------------------- 1 | 0.25, 3, 3 2 | 0.4, 3, 3 3 | 0.5, 3, 3 4 | 1, 1, 1 5 | -------------------------------------------------------------------------------- /tests/vault/small-12: -------------------------------------------------------------------------------- 1 | 1.00001, 0, 1, 6 2 | 1.0001, 0, 1, 3 3 | -------------------------------------------------------------------------------- /tests/vault/small-2: -------------------------------------------------------------------------------- 1 | 1, 1.001 2 | -------------------------------------------------------------------------------- /tests/vault/small-3: -------------------------------------------------------------------------------- 1 | 1, 1.00001 2 | 1, 1.0001 3 | -------------------------------------------------------------------------------- /tests/vault/small-4: -------------------------------------------------------------------------------- 1 | 1, 5.2e-05, 3 2 | -------------------------------------------------------------------------------- /tests/vault/small-5: -------------------------------------------------------------------------------- 1 | 1, 0, 1 2 | -------------------------------------------------------------------------------- /tests/vault/small-6: -------------------------------------------------------------------------------- 1 | 1, 0, 3 2 | -------------------------------------------------------------------------------- /tests/vault/small-7: -------------------------------------------------------------------------------- 1 | 1, 15713, 2 2 | -------------------------------------------------------------------------------- /tests/vault/smatch-1: -------------------------------------------------------------------------------- 1 | Number of rows satisfying "s='tr100'": 2 2 | s[0] = tr100 3 | s[1] = tr100 4 | Number of rows satisfying "s='tr1000'": 2 5 | s[0] = tr1000 6 | s[1] = tr1000 7 | Number of rows satisfying "s='tr10000'": 2 8 | s[0] = tr10000 9 | s[1] = tr10000 10 | Number of rows satisfying "s='tr111110000'": 2 11 | s[0] = tr111110000 12 | s[1] = tr111110000 13 | -------------------------------------------------------------------------------- /tests/vault/tcapi-3: -------------------------------------------------------------------------------- 1 | a[10]=260 263 266 269 272 275 278 281 284 287 2 | -------------------------------------------------------------------------------- /tests/vault/text-0: -------------------------------------------------------------------------------- 1 | 1, 9, -4, 98, 98 2 | 1, 8, -2, 88, 88 3 | 1, 7, -1, 78, 78 4 | 1, 2, 6, 28, 28 5 | 7, 2, 7, 27, 24 6 | 1, 2, 8, 20, 20 7 | 6, 1, 8, 19, 16.5 8 | 4, 1, 9, 13, 11.5 9 | 3, 0, 9, 9, 8 10 | 7, 0, 10, 6, 3 11 | -------------------------------------------------------------------------------- /tests/vault/thula-0: -------------------------------------------------------------------------------- 1 | 1, 1, 1 2 | -------------------------------------------------------------------------------- /tests/vault/thula-1: -------------------------------------------------------------------------------- 1 | 31, 31, 31, 0.5 2 | 32, 32, 32, 0.5 3 | 33, 33, 33, 0.5 4 | 34, 34, 34, 0.5 5 | 35, 35, 35, 0.5 6 | 36, 36, 36, 0.5 7 | 37, 37, 37, 0.5 8 | 38, 38, 38, 0.5 9 | 39, 39, 39, 0.5 10 | 40, 40, 40, 0.5 11 | 41, 41, 41, 0.5 12 | 42, 42, 42, 0.5 13 | 43, 43, 43, 0.5 14 | 44, 44, 44, 0.5 15 | 45, 45, 45, 0.5 16 | 46, 46, 46, 0.5 17 | 47, 47, 47, 0.5 18 | 48, 48, 48, 0.5 19 | 49, 49, 49, 0.5 20 | -------------------------------------------------------------------------------- /win/ibis.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 2013 3 | VisualStudioVersion = 12.0.31101.0 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ibis", "ibis.vcxproj", "{360DF97D-FEAB-4A6F-B84F-E348FCA7AB0F}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thula", "thula.vcxproj", "{360DF97D-FEAB-4A6F-B84F-E348FCA7AB0E}" 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rara", "rara.vcxproj", "{360DF97D-FEAB-4A6F-B84F-E348FCA7AB0B}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ardea", "ardea.vcxproj", "{360DF97D-FEAB-4A6F-B84F-E348FCA7AB0D}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tcapi", "tcapi.vcxproj", "{360DF97D-FEAB-4A6F-B84F-E348FCA7AB0C}" 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "java", "java.vcxproj", "{C5EE61F0-0EF6-431A-90C1-3F6FF3F5B614}" 16 | EndProject 17 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dll", "dll.vcxproj", "{1BF44EB1-E02B-4F85-BC0F-33AAC503BA13}" 18 | EndProject 19 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "setqgen", "setqgen.vcxproj", "{360DF97D-FEAB-4A6F-B84F-E348FCA7BAE0}" 20 | EndProject 21 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "trydll", "trydll.vcxproj", "{8B00104E-D878-4579-9E4D-801860997AB3}" 22 | EndProject 23 | Global 24 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 25 | Debug|Win32 = Debug|Win32 26 | Release|Win32 = Release|Win32 27 | EndGlobalSection 28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 29 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0F}.Debug|Win32.ActiveCfg = Debug|Win32 30 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0F}.Debug|Win32.Build.0 = Debug|Win32 31 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0F}.Release|Win32.ActiveCfg = Release|Win32 32 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0F}.Release|Win32.Build.0 = Release|Win32 33 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0E}.Debug|Win32.ActiveCfg = Debug|Win32 34 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0E}.Debug|Win32.Build.0 = Debug|Win32 35 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0E}.Release|Win32.ActiveCfg = Release|Win32 36 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0E}.Release|Win32.Build.0 = Release|Win32 37 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0B}.Debug|Win32.ActiveCfg = Debug|Win32 38 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0B}.Debug|Win32.Build.0 = Debug|Win32 39 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0B}.Release|Win32.ActiveCfg = Release|Win32 40 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0B}.Release|Win32.Build.0 = Release|Win32 41 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0D}.Debug|Win32.ActiveCfg = Debug|Win32 42 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0D}.Debug|Win32.Build.0 = Debug|Win32 43 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0D}.Release|Win32.ActiveCfg = Release|Win32 44 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0D}.Release|Win32.Build.0 = Release|Win32 45 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0C}.Debug|Win32.ActiveCfg = Debug|Win32 46 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0C}.Debug|Win32.Build.0 = Debug|Win32 47 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0C}.Release|Win32.ActiveCfg = Release|Win32 48 | {360DF97D-FEAB-4A6F-B84F-E348FCA7AB0C}.Release|Win32.Build.0 = Release|Win32 49 | {C5EE61F0-0EF6-431A-90C1-3F6FF3F5B614}.Debug|Win32.ActiveCfg = Debug|Win32 50 | {C5EE61F0-0EF6-431A-90C1-3F6FF3F5B614}.Release|Win32.ActiveCfg = Release|Win32 51 | {1BF44EB1-E02B-4F85-BC0F-33AAC503BA13}.Debug|Win32.ActiveCfg = Debug|Win32 52 | {1BF44EB1-E02B-4F85-BC0F-33AAC503BA13}.Debug|Win32.Build.0 = Debug|Win32 53 | {1BF44EB1-E02B-4F85-BC0F-33AAC503BA13}.Release|Win32.ActiveCfg = Release|Win32 54 | {1BF44EB1-E02B-4F85-BC0F-33AAC503BA13}.Release|Win32.Build.0 = Release|Win32 55 | {360DF97D-FEAB-4A6F-B84F-E348FCA7BAE0}.Debug|Win32.ActiveCfg = Debug|Win32 56 | {360DF97D-FEAB-4A6F-B84F-E348FCA7BAE0}.Debug|Win32.Build.0 = Debug|Win32 57 | {360DF97D-FEAB-4A6F-B84F-E348FCA7BAE0}.Release|Win32.ActiveCfg = Release|Win32 58 | {360DF97D-FEAB-4A6F-B84F-E348FCA7BAE0}.Release|Win32.Build.0 = Release|Win32 59 | {8B00104E-D878-4579-9E4D-801860997AB3}.Debug|Win32.ActiveCfg = Debug|Win32 60 | {8B00104E-D878-4579-9E4D-801860997AB3}.Release|Win32.ActiveCfg = Release|Win32 61 | EndGlobalSection 62 | GlobalSection(SolutionProperties) = preSolution 63 | HideSolutionNode = FALSE 64 | EndGlobalSection 65 | EndGlobal 66 | -------------------------------------------------------------------------------- /win/static_pthread.patch: -------------------------------------------------------------------------------- 1 | --- pthreads/source/build_w64.sh.org 2012-03-05 12:27:56.063799694 -0500 2 | +++ pthreads/source/build_w64.sh 2012-03-05 12:30:26.533904302 -0500 3 | @@ -1,5 +1,7 @@ 4 | #!/bin/sh 5 | 6 | +cd "`dirname "$0"`" 7 | + 8 | THISDIR=`pwd` 9 | TARGET="x86_64-w64-mingw32" 10 | 11 | @@ -19,7 +21,7 @@ 12 | -e 's/pthreadGCE\$(DLL_VER)/&-w64/g' \ 13 | < GNUmakefile.bak > GNUmakefile 14 | 15 | -make CROSS="$TARGET-" clean GC || exit 1 16 | +make CROSS="$TARGET-" clean GC-static || exit 1 17 | 18 | mkdir -p bin 19 | mkdir -p $TARGET/include 20 | @@ -27,14 +29,11 @@ 21 | mkdir -p share/doc/pthreads-win32 22 | 23 | cp -p pthread.h sched.h semaphore.h pthreads_win32_config.h ./$TARGET/include || exit 1 24 | -cp -p pthreadGC2-w64.dll ./bin || exit 1 25 | cp -p libpthreadGC2-w64.a ./$TARGET/lib/libpthread.a || exit 1 26 | for i in ANNOUNCE BUGS CONTRIBUTORS COPYING COPYING.LIB FAQ MAINTAINERS NEWS PROGRESS README README.CV README.NONPORTABLE README.WinCE TODO ; 27 | do cp -p ${i} ./share/doc/pthreads-win32 ; 28 | done 29 | 30 | -$TARGET-strip ./bin/pthreadGC2-w64.dll 31 | - 32 | zip -9 -r -q pthreads-w64.zip bin $TARGET share || exit 1 33 | 34 | cd .. 35 | --- pthreads/source/build_w32.sh.org 2012-03-05 12:27:50.694831642 -0500 36 | +++ pthreads/source/build_w32.sh 2012-03-05 12:30:51.628754971 -0500 37 | @@ -1,5 +1,7 @@ 38 | #!/bin/sh 39 | 40 | +cd "`dirname "$0"`" 41 | + 42 | THISDIR=`pwd` 43 | TARGET="i686-w64-mingw32" 44 | 45 | @@ -19,7 +21,7 @@ 46 | -e 's/pthreadGCE\$(DLL_VER)/&-w32/g' \ 47 | < GNUmakefile.bak > GNUmakefile 48 | 49 | -make CROSS="$TARGET-" clean GC || exit 1 50 | +make CROSS="$TARGET-" clean GC-static || exit 1 51 | 52 | mkdir -p bin 53 | mkdir -p $TARGET/include 54 | @@ -27,14 +29,11 @@ 55 | mkdir -p share/doc/pthreads-win32 56 | 57 | cp -p pthread.h sched.h semaphore.h pthreads_win32_config.h ./$TARGET/include || exit 1 58 | -cp -p pthreadGC2-w32.dll ./bin || exit 1 59 | cp -p libpthreadGC2-w32.a ./$TARGET/lib/libpthread.a || exit 1 60 | for i in ANNOUNCE BUGS CONTRIBUTORS COPYING COPYING.LIB FAQ MAINTAINERS NEWS PROGRESS README README.CV README.NONPORTABLE README.WinCE TODO ; 61 | do cp -p ${i} ./share/doc/pthreads-win32 ; 62 | done 63 | 64 | -$TARGET-strip ./bin/pthreadGC2-w32.dll 65 | - 66 | zip -9 -r -q pthreads-w32.zip bin $TARGET share || exit 1 67 | 68 | cd .. 69 | -------------------------------------------------------------------------------- /win/static_pthread_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Initialy from dll.c (Pthreads-win32) with PTW32_STATIC_LIB test removed 3 | * 4 | * Description: 5 | * This translation unit implements DLL initialisation. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | 39 | #ifdef _MSC_VER 40 | /* 41 | * lpvReserved yields an unreferenced formal parameter; 42 | * ignore it 43 | */ 44 | #pragma warning( disable : 4100 ) 45 | #endif 46 | 47 | #ifdef __cplusplus 48 | /* 49 | * Dear c++: Please don't mangle this name. -thanks 50 | */ 51 | extern "C" 52 | #endif /* __cplusplus */ 53 | BOOL WINAPI 54 | DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) 55 | { 56 | BOOL result = PTW32_TRUE; 57 | 58 | switch (fdwReason) 59 | { 60 | 61 | case DLL_PROCESS_ATTACH: 62 | result = pthread_win32_process_attach_np (); 63 | break; 64 | 65 | case DLL_THREAD_ATTACH: 66 | /* 67 | * A thread is being created 68 | */ 69 | result = pthread_win32_thread_attach_np (); 70 | break; 71 | 72 | case DLL_THREAD_DETACH: 73 | /* 74 | * A thread is exiting cleanly 75 | */ 76 | result = pthread_win32_thread_detach_np (); 77 | break; 78 | 79 | case DLL_PROCESS_DETACH: 80 | (void) pthread_win32_thread_detach_np (); 81 | result = pthread_win32_process_detach_np (); 82 | break; 83 | } 84 | 85 | return (result); 86 | 87 | } /* DllMain */ 88 | -------------------------------------------------------------------------------- /win/trydll.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 27 | 30 | 33 | 36 | 39 | 42 | 55 | 58 | 61 | 64 | 79 | 82 | 85 | 88 | 91 | 94 | 97 | 100 | 101 | 110 | 113 | 116 | 119 | 122 | 125 | 136 | 139 | 142 | 145 | 161 | 164 | 167 | 170 | 173 | 176 | 179 | 182 | 183 | 184 | 185 | 189 | 190 | 191 | 196 | 199 | 200 | 201 | 206 | 209 | 210 | 211 | 216 | 217 | 218 | 219 | 220 | 221 | --------------------------------------------------------------------------------