updated documentation

dev
Bill 2 years ago
parent 34a9fe105c
commit ce2dd054e3

1
.gitignore vendored

@ -1,6 +1,7 @@
tests/datagen_jose/histgen tests/datagen_jose/histgen
tests/datagen_jose/tickgen tests/datagen_jose/tickgen
datagen datagen
tests/private
*.dSYM *.dSYM
testmain.lib testmain.lib
testmain.exp testmain.exp

@ -97,6 +97,6 @@ docker:
docker build -t aquery . docker build -t aquery .
clean: clean:
rm *.shm *.o dll.so server.so server.bin -rf 2> $(NULL_DEVICE) || true rm *.shm *.o dll.so server.so server.bin libaquery.a libaquery.lib -rf 2> $(NULL_DEVICE) || true

@ -38,18 +38,21 @@ AQuery++ Database is a cross-platform, In-Memory Column-Store Database that inco
- [x] Selection/Order by push-down - [x] Selection/Order by push-down
- [x] Join Optimization (Only in Hybrid Engine) - [x] Join Optimization (Only in Hybrid Engine)
## TODO: ## Known Issues:
- [x] User Module load syntax parsing (fn definition/registration)
- [x] User Module initialize location
- [x] User Module test - [x] User Module test
-> Interval based triggers - [ ] Interval based triggers
- [x] Optimize Compilation Process, using static libraries, hot reloading server binary - [x] Hot reloading server binary
- [x] Bug fixes: type deduction misaligned in Hybrid Engine - [x] Bug fixes: type deduction misaligned in Hybrid Engine
-> Investigation: Using postproc only for q1 in Hybrid Engine (make is_special always on) - [ ] Investigation: Using postproc only for q1 in Hybrid Engine (make is_special always on)
- [x] Limitation: putting ColRefs back to monetdb. - [x] Limitation: putting ColRefs back to monetdb. (Comparison)
- [ ] C++ Meta-Programming: Eliminate template recursions as much as possible. - [ ] C++ Meta-Programming: Eliminate template recursions as much as possible.
- [x] Limitation: Date and Time, String operations, Funcs in groupby agg. - [x] Limitation: Date and Time, String operations, Funcs in groupby agg.
- [ ] Functionality: Basic helper functions in aquery
- [ ] Improvement: More DDLs, e.g. drop table, update table, etc.
- [ ] Bug: Join-Aware Column management
- [ ] Bug: Order By after Group By
# Installation # Installation
## Requirements ## Requirements
@ -67,16 +70,23 @@ AQuery++ Database is a cross-platform, In-Memory Column-Store Database that inco
## Usage ## Usage
`python3 prompt.py` will launch the interactive command prompt. The server binary will be autometically rebuilt and started. `python3 prompt.py` will launch the interactive command prompt. The server binary will be autometically rebuilt and started.
#### Commands: #### Commands:
- `<sql statement>`: parse sql statement - `<sql statement>`: parse AQuery statement
- `f <filename>`: parse all sql statements in file - `f <filename>`: parse all AQuery statements in file
- `dbg` start debugging session - `dbg` start debugging session
- `print`: printout parsed sql statements - `print`: printout parsed AQuery statements
- `exec`: execute last parsed statement(s) with AQuery Execution Engine. AQuery Execution Engine executes query by compiling it to C++ code and then executing it.
- `xexec`: execute last parsed statement(s) with Hybrid Execution Engine. Hybrid Execution Engine decouples the query into two parts. The sql-compliant part is executed by an Embedded version of Monetdb and everything else is executed by a post-process module which is generated by AQuery++ Compiler in C++ and then compiled and executed. - `xexec`: execute last parsed statement(s) with Hybrid Execution Engine. Hybrid Execution Engine decouples the query into two parts. The standard SQL (MonetDB dialect) part is executed by an Embedded version of Monetdb and everything else is executed by a post-process module which is generated by AQuery++ Compiler in C++ and then compiled and executed.
- `r`: run the last generated code snippet
- `save <OPTIONAL: filename>`: save current code snippet. will use random filename if not specified. - `save <OPTIONAL: filename>`: save current code snippet. will use random filename if not specified.
- `exit`: quit the prompt - `exit`: quit the prompt
#### Example: - `exec`: execute last parsed statement(s) with AQuery Execution Engine (Old). AQuery Execution Engine executes query by compiling it to C++ code and then executing it.
- `r`: run the last generated code snippet
### Example:
`f moving_avg.a` <br> `f moving_avg.a` <br>
`xexec` `xexec`
See ./tests/ for more examples.
## Notes for arm64 macOS users
- In theory, AQuery++ could work on both native arm64 and x86_64 through Rosetta. But for maximum performance, running native is preferred.
- However, they can't be mixed up, i.e. make sure every component, `python` binary, `C++ compiler`, `monetdb` library and system commandline utilities such as `uname` should have the same architecture.
- Because I can't get access to an arm-based mac to fully test this setup, there might still be issues. Please open an issue if you encounter any problems.

@ -28,7 +28,7 @@ namespace types {
}; };
static constexpr const char* printf_str[] = { "%d", "%f", "%s", "%lf", "%Lf", "%ld", "%d", "%hi", "%s", "%s", "%c", static constexpr const char* printf_str[] = { "%d", "%f", "%s", "%lf", "%Lf", "%ld", "%d", "%hi", "%s", "%s", "%c",
"%u", "%lu", "%s", "%hu", "%hhu", "%s", "%s", "Vector<%s>", "%s", "NULL", "ERROR" }; "%u", "%lu", "%s", "%hu", "%hhu", "%s", "%s", "Vector<%s>", "%s", "NULL", "ERROR" };
static constexpr const char* SQL_Type[] = { "INT", "REAL", "VARCHAR(15)", "DOUBLE", "DOUBLE", "BIGINT", "HUGEINT", "SMALLINT", "DATE", "TIME", "TINYINT", static constexpr const char* SQL_Type[] = { "INT", "REAL", "TEXT", "DOUBLE", "DOUBLE", "BIGINT", "HUGEINT", "SMALLINT", "DATE", "TIME", "TINYINT",
"INT", "BIGINT", "HUGEINT", "SMALLINT", "TINYINT", "BIGINT", "BOOL", "BIGINT", "TIMESTAMP", "NULL", "ERROR"}; "INT", "BIGINT", "HUGEINT", "SMALLINT", "TINYINT", "BIGINT", "BOOL", "BIGINT", "TIMESTAMP", "NULL", "ERROR"};

@ -1,79 +0,0 @@
#include <sys/types.h>
#include <time.h>
#include <iostream>
#include "cal.H"
using namespace std;
Calendar::Calendar(void)
{
time_t clk = time(0);
struct tm *now = localtime(&clk);
_currdate = asJulianNumber(now->tm_mon+1, now->tm_mday, now->tm_year+1900);
}
Calendar::~Calendar()
{}
// year_ in yyyy format
unsigned int Calendar::asJulianNumber(int month_,int day_,int year_)
{
unsigned long c,ya;
if (month_>2) month_-=3;
else { month_+=9; year_--; }
c=year_/100;
ya=year_-100*c;
return ((146097*c)>>2)+((1461*ya)>>2)+(153*month_+2)/5+day_+1721119;
}
void Calendar::split(int& month_,int& day_,int& year_)
{
unsigned long d;
unsigned long j=_currdate-1721119;
year_=(int) (((j<<2)-1)/146097);
j=(j<<2)-1-146097*year_;
d=(j>>2);
j=((d<<2)+3)/1461;
d=(d<<2)+3-1461*j;
d=(d+4)>>2;
month_=(int)(5*d-3)/153;
d=5*d-3-153*month_;
day_=(int)((d+5)/5);
year_=(int)(100*year_+j);
if (month_<10) month_+=3;
else { month_-=9; year_++; }
}
int Calendar::dayInWeek(void)
{
return ((((_currdate+1)%7)+6)%7)+1;
}
Calendar &Calendar::nextWeekday(void)
{
(*this) += 1;
while (!isWeekday()) (*this)+= 1;
return *this;
}
int Calendar::isWeekday(void)
{
return (dayInWeek()<6)?1:0;
}
Calendar &Calendar::operator+= (int incr_)
{
_currdate += incr_;
return *this;
}
ostream &operator<< (ostream &os_, Calendar &that_)
{
int mo, day, year;
that_.split(mo,day,year);
os_ << year << "-" << mo << "-" << day;
// the below is a pain for monetdb
//os_ << mo << "/" << day << "/" << year;
return os_;
}

@ -2,7 +2,8 @@
#include <time.h> #include <time.h>
#include <iostream> #include <iostream>
#include "cal.H" #include "cal.hpp"
using namespace std;
Calendar::Calendar(void) Calendar::Calendar(void)
{ {
@ -71,6 +72,8 @@ ostream &operator<< (ostream &os_, Calendar &that_)
{ {
int mo, day, year; int mo, day, year;
that_.split(mo,day,year); that_.split(mo,day,year);
os_ << mo << "/" << day << "/" << year; os_ << year << "-" << mo << "-" << day;
// the below is a pain for monetdb
//os_ << mo << "/" << day << "/" << year;
return os_; return os_;
} }

@ -4,7 +4,7 @@
#define genIMPLEMENTATION #define genIMPLEMENTATION
#include <iostream.h> #include <iostream.h>
#include "RandGen.H" #include "RandGen.hpp"
int num[6]; int num[6];
int nelems=0; int nelems=0;

@ -10,8 +10,8 @@
#include <fstream> #include <fstream>
#include <sys/time.h> #include <sys/time.h>
#include "RandGen.H" #include "RandGen.hpp"
#include "cal.H" #include "cal.hpp"
using namespace std; using namespace std;
inline int max(int a, int b) inline int max(int a, int b)
{ {

@ -5,16 +5,16 @@ all: histgen tickgen
clean: clean:
rm -rf *.o histgen tickgen rm -rf *.o histgen tickgen
%.o: %.C %.o: %.cpp
g++-12 -Ofast -march=native -g -c $< $(CXX) -Ofast -march=native -g -c $<
tickgen: cal.o Time.o tickgen.o tickgen: cal.o Time.o tickgen.o
g++-12 -lstdc++ -Ofast -march=native -flto -o tickgen cal.o Time.o tickgen.o $(CXX) -lstdc++ -Ofast -march=native -flto -o tickgen cal.o Time.o tickgen.o
histgen: cal.o histgen.o histgen: cal.o histgen.o
g++-12 -lstdc++ -Ofast -flto -march=native -o histgen cal.o histgen.o $(CXX) -lstdc++ -Ofast -flto -march=native -o histgen cal.o histgen.o
timetest: Time.o timetest.o timetest: Time.o timetest.o
g++-12 -lstdc++ -g -o timetest Time.o timetest.o $(CXX) -lstdc++ -g -o timetest Time.o timetest.o

@ -10,9 +10,9 @@
#include <fstream> #include <fstream>
#include <sys/time.h> #include <sys/time.h>
#include "RandGen.H" #include "RandGen.hpp"
#include "cal.H" #include "cal.hpp"
#include "Time.H" #include "Time.hpp"
using namespace std; using namespace std;
Loading…
Cancel
Save