add paper
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[submodule "paper"]
|
||||
path = paper
|
||||
url = https://github.com/sunyinqi0508/AQueryPaper
|
||||
Submodule
+1
Submodule paper added at fa4e3f5a06
@@ -26,6 +26,7 @@ def process(f : str):
|
||||
with open(filename, 'rb') as ifile:
|
||||
icontents = ifile.read()
|
||||
with open(ofilename, 'wb') as ofile:
|
||||
ofile.write(b'\n')
|
||||
for l in icontents.splitlines():
|
||||
fields = l.strip().split(b' ')
|
||||
subfields = fields[:-1]
|
||||
|
||||
+14
-9
@@ -1,22 +1,26 @@
|
||||
#include "DecisionTree.h"
|
||||
#include "RF.h"
|
||||
|
||||
// __AQ_NO_SESSION__
|
||||
#include "../server/table.h"
|
||||
#include "aquery.h"
|
||||
|
||||
DecisionTree *dt = nullptr;
|
||||
RandomForest *rf = nullptr;
|
||||
|
||||
__AQEXPORT__(bool)
|
||||
newtree(int height, long f, ColRef<int> sparse, double forget, long maxf, long noclasses, Evaluation e, long r, long rb)
|
||||
newtree(int height, long f, ColRef<int> X, double forget, long maxf, long noclasses, Evaluation e, long r, long rb)
|
||||
{
|
||||
if (sparse.size != f)
|
||||
if (X.size != f)
|
||||
return false;
|
||||
int *issparse = (int *)malloc(f * sizeof(int));
|
||||
for (long i = 0; i < f; i++)
|
||||
issparse[i] = sparse.container[i];
|
||||
int *X_cpy = (int *)malloc(f * sizeof(int));
|
||||
|
||||
memcpy(X_cpy, X.container, f);
|
||||
|
||||
if (maxf < 0)
|
||||
maxf = f;
|
||||
dt = new DecisionTree(f, issparse, forget, maxf, noclasses, e);
|
||||
dt = new DecisionTree(f, X_cpy, forget, maxf, noclasses, e);
|
||||
rf = new RandomForest(height, f, X_cpy, forget, noclasses, e)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -44,7 +48,8 @@ fit(vector_type<vector_type<double>> v, vector_type<long> res)
|
||||
double **data = (double **)malloc(v.size * sizeof(double *));
|
||||
for (int i = 0; i < v.size; ++i)
|
||||
data[i] = v.container[i].container;
|
||||
dt->fit(data, res.container, v.size);
|
||||
// dt->fit(data, res.container, v.size);
|
||||
rf->fit(data, res.container, v.size);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -54,8 +59,8 @@ predict(vector_type<vector_type<double>> v)
|
||||
int *result = (int *)malloc(v.size * sizeof(int));
|
||||
|
||||
for (long i = 0; i < v.size; i++)
|
||||
result[i] = dt->Test(v.container[i].container, dt->DTree);
|
||||
|
||||
//result[i] = dt->Test(v.container[i].container, dt->DTree);
|
||||
result[i] = rf->Test(v.container, rf->DTrees);
|
||||
auto container = (vector_type<int> *)malloc(sizeof(vector_type<int>));
|
||||
container->size = v.size;
|
||||
container->capacity = 0;
|
||||
|
||||
@@ -281,15 +281,15 @@ inline const char* str(const bool& v) {
|
||||
return v ? "true" : "false";
|
||||
}
|
||||
|
||||
class A{
|
||||
class A {
|
||||
public:
|
||||
std::chrono::high_resolution_clock::time_point tp;
|
||||
A(){
|
||||
tp = std::chrono::high_resolution_clock::now();
|
||||
printf("A %llx created.\n", tp.time_since_epoch().count());
|
||||
printf("A %llu created.\n", tp.time_since_epoch().count());
|
||||
}
|
||||
~A() {
|
||||
printf("A %llx died after %lldns.\n", tp.time_since_epoch().count(),
|
||||
printf("A %llu died after %lldns.\n", tp.time_since_epoch().count(),
|
||||
(std::chrono::high_resolution_clock::now() - tp).count());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
struct Context;
|
||||
|
||||
struct Server{
|
||||
MYSQL *server = 0;
|
||||
Context *cxt = 0;
|
||||
bool status = 0;
|
||||
MYSQL *server = nullptr;
|
||||
Context *cxt = nullptr;
|
||||
bool status = false;
|
||||
bool has_error = false;
|
||||
char* query = 0;
|
||||
char* query = nullptr;
|
||||
int type = 0;
|
||||
|
||||
void connect(Context* cxt, const char* host = "bill.local",
|
||||
const char* user = "root", const char* passwd = "0508",
|
||||
const char* db_name = "db", const unsigned int port = 3306,
|
||||
const char* unix_socket = 0, const unsigned long client_flag = 0
|
||||
const char* unix_socket = nullptr, const unsigned long client_flag = 0
|
||||
);
|
||||
void exec(const char* q);
|
||||
void close();
|
||||
|
||||
+11
-5
@@ -18,8 +18,12 @@
|
||||
#include <atomic>
|
||||
#endif // _WIN32
|
||||
|
||||
#undef ERROR
|
||||
#undef static_assert
|
||||
#ifdef ERROR
|
||||
#undef ERROR
|
||||
#endif
|
||||
#ifdef static_assert
|
||||
#undef static_assert
|
||||
#endif
|
||||
|
||||
constexpr const char* monetdbe_type_str[] = {
|
||||
"monetdbe_bool", "monetdbe_int8_t", "monetdbe_int16_t", "monetdbe_int32_t", "monetdbe_int64_t",
|
||||
@@ -86,7 +90,7 @@ void Server::connect(Context *cxt){
|
||||
char c[50];
|
||||
std::cin.getline(c, 49);
|
||||
for(int i = 0; i < 50; ++i) {
|
||||
if (!c[i] || c[i] == 'y' || c[i] == 'Y'){
|
||||
if (!c[i] || c[i] == 'y' || c[i] == 'Y') {
|
||||
monetdbe_close(*server);
|
||||
free(*server);
|
||||
this->server = nullptr;
|
||||
@@ -120,7 +124,7 @@ void Server::exec(const char* q){
|
||||
auto _res = static_cast<monetdbe_result*>(this->res);
|
||||
monetdbe_cnt _cnt = 0;
|
||||
auto qresult = monetdbe_query(*server, const_cast<char*>(q), &_res, &_cnt);
|
||||
if (_res != 0){
|
||||
if (_res != nullptr){
|
||||
this->cnt = _res->nrows;
|
||||
this->res = _res;
|
||||
}
|
||||
@@ -162,6 +166,8 @@ void Server::print_results(const char* sep, const char* end){
|
||||
col_data[i] = static_cast<char *>(cols[i]->data);
|
||||
szs [i] = monetdbe_type_szs[cols[i]->type];
|
||||
header_string = header_string + cols[i]->name + sep + '|' + sep;
|
||||
if (err_msg) [[unlikely]]
|
||||
puts(err_msg);
|
||||
}
|
||||
if (const size_t l_sep = strlen(sep) + 1; header_string.size() >= l_sep)
|
||||
header_string.resize(header_string.size() - l_sep);
|
||||
@@ -183,7 +189,7 @@ void Server::print_results(const char* sep, const char* end){
|
||||
void Server::close(){
|
||||
if(this->server){
|
||||
auto server = static_cast<monetdbe_database*>(this->server);
|
||||
monetdbe_close(*(server));
|
||||
monetdbe_close(*server);
|
||||
free(server);
|
||||
this->server = nullptr;
|
||||
}
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
struct Context;
|
||||
|
||||
struct Server{
|
||||
void *server = 0;
|
||||
Context *cxt = 0;
|
||||
bool status = 0;
|
||||
char* query = 0;
|
||||
void *server = nullptr;
|
||||
Context *cxt = nullptr;
|
||||
bool status = false;
|
||||
char* query = nullptr;
|
||||
int type = 1;
|
||||
|
||||
void* res = 0;
|
||||
void* ret_col = 0;
|
||||
void* res = nullptr;
|
||||
void* ret_col = nullptr;
|
||||
long long cnt = 0;
|
||||
char* last_error = 0;
|
||||
char* last_error = nullptr;
|
||||
|
||||
Server(Context* cxt = nullptr);
|
||||
explicit Server(Context* cxt = nullptr);
|
||||
void connect(Context* cxt);
|
||||
void exec(const char* q);
|
||||
void *getCol(int col_idx);
|
||||
|
||||
@@ -77,7 +77,7 @@ monetdbe_get_size(monetdbe_database dbhdl, const char *table_name)
|
||||
}
|
||||
|
||||
void*
|
||||
monetdbe_get_col(monetdbe_database dbhdl, const char *table_name, uint32_t col_id) {
|
||||
monetdbe_get_col(monetdbe_database dbhdl, const char *table_name, uint32_t col_id) {
|
||||
monetdbe_database_internal* hdl = (monetdbe_database_internal*)dbhdl;
|
||||
backend* be = ((backend *)(((monetdbe_database_internal*)dbhdl)->c->sqlcontext));
|
||||
mvc *m = be->mvc;
|
||||
|
||||
@@ -6,7 +6,7 @@ template <class Comparator, typename T = uint32_t>
|
||||
class priority_vector : public vector_type<T> {
|
||||
const Comparator comp;
|
||||
public:
|
||||
priority_vector(Comparator comp = std::less<T>{}) :
|
||||
explicit priority_vector(Comparator comp = std::less<T>{}) :
|
||||
comp(comp), vector_type<T>(0) {}
|
||||
void emplace_back(T val) {
|
||||
vector_type<T>::emplace_back(val);
|
||||
|
||||
@@ -6,6 +6,8 @@ LOAD MODULE FROM "./libirf.so"
|
||||
);
|
||||
|
||||
create table source(x1 double, x2 double, x3 double, x4 double, x5 int64);
|
||||
-- Create trigger 1 ~~ to predict whenever sz(source > ?)
|
||||
-- Create trigger 2 ~~ to auto feed ~
|
||||
load data infile "data/benchmark" into table source fields terminated by ",";
|
||||
|
||||
create table sparse(x int);
|
||||
|
||||
Reference in New Issue
Block a user