bug fixes
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
AQuery++ Database is a cross-platform, In-Memory Column-Store Database that incorporates compiled query execution. (**Note**: If you encounter any problems, feel free to contact me via ys3540@nyu.edu)
|
AQuery++ Database is a cross-platform, In-Memory Column-Store Database that incorporates compiled query execution. (**Note**: If you encounter any problems, feel free to contact me via ys3540@nyu.edu)
|
||||||
|
|
||||||
## Docker (Recommended):
|
`## Docker (Recommended):
|
||||||
- See installation instructions from [docker.com](https://www.docker.com). Run **docker desktop** to start docker engine.
|
- See installation instructions from [docker.com](https://www.docker.com). Run **docker desktop** to start docker engine.
|
||||||
- In AQuery root directory, type `make docker` to build the docker image from scratch.
|
- In AQuery root directory, type `make docker` to build the docker image from scratch.
|
||||||
- For Arm-based Mac users, you would have to build and run the **x86_64** docker image because MonetDB doesn't offer official binaries for arm64 Linux. (Run `docker buildx build --platform=linux/amd64 -t aquery .` instead of `make docker`)
|
- For Arm-based Mac users, you would have to build and run the **x86_64** docker image because MonetDB doesn't offer official binaries for arm64 Linux. (Run `docker buildx build --platform=linux/amd64 -t aquery .` instead of `make docker`)
|
||||||
@@ -57,12 +57,11 @@ There're multiple options to run AQuery on Windows. But for better consistency I
|
|||||||
- Copy or link `mingw64/libexec/gcc/<arch>/<version>/liblto-plugin.dll` to `mingw64/lib/bfd-plugins/` For Link time optimization support on gcc-ar and gcc-ranlib
|
- Copy or link `mingw64/libexec/gcc/<arch>/<version>/liblto-plugin.dll` to `mingw64/lib/bfd-plugins/` For Link time optimization support on gcc-ar and gcc-ranlib
|
||||||
|
|
||||||
- For Visual Studio:
|
- For Visual Studio:
|
||||||
1. Install python3.6 or above from [official website](https://www.python.org/downloads/windows/) or Microsoft Store.
|
1. Install python3.6 or above from [official website](https://www.python.org/downloads/windows/) or Microsoft Store.
|
||||||
1. Install Microsoft Visual Studio 2022 or later with **Desktop development with C++** selected.
|
2. Install Microsoft Visual Studio 2022 or later with **Desktop development with C++** selected.
|
||||||
2. Clone AQuery repo from [Github](https://github.com/sunyinqi0508/AQuery2)
|
3. Clone AQuery repo from [Github](https://github.com/sunyinqi0508/AQuery2)
|
||||||
3. Install python requirements with pip `python3 -m pip install -r requirements.txt`
|
4. Install python requirements with pip `python3 -m pip install -r requirements.txt`
|
||||||
4. Change the build_driver variable in aquery_config.py to "MSBuild"
|
5. The libraries and headers for Monetdb are already included in msc-plugins, however you can also choose to download them from [Monetdb Easy Setup](https://www.monetdb.org/easy-setup/) and put them in the same place.
|
||||||
5. The libraries and headers for Monetdb are already included in msc-plugins, however you can also choose to download them from [Monetdb Easy Setup](https://www.monetdb.org/easy-setup/) and put them in the same place.
|
|
||||||
|
|
||||||
- For CygWin/MinGW:
|
- For CygWin/MinGW:
|
||||||
1. Install gcc and python3 using its **builtin package manager** instead of the one from python.org or windows store. (For Msys2, `pacman -S gcc python3`). Otherwise, ABI breakage may happen.
|
1. Install gcc and python3 using its **builtin package manager** instead of the one from python.org or windows store. (For Msys2, `pacman -S gcc python3`). Otherwise, ABI breakage may happen.
|
||||||
|
|||||||
@@ -401,6 +401,15 @@ def prompt(running = lambda:True, next = lambda:input('> '), state = None):
|
|||||||
elif q.startswith('echo '):
|
elif q.startswith('echo '):
|
||||||
print(og_q[5:].lstrip())
|
print(og_q[5:].lstrip())
|
||||||
continue
|
continue
|
||||||
|
elif q.startswith('list '):
|
||||||
|
qs = re.split(r'[ \t]', q)
|
||||||
|
if len(qs) > 1 and qs[1].startswith('table'):
|
||||||
|
for t in cxt.tables:
|
||||||
|
lst_cols = []
|
||||||
|
for c in t.columns:
|
||||||
|
lst_cols.append(f'{c.name} : {c.type}')
|
||||||
|
print(f'{t.table_name} ({", ".join(lst_cols)})')
|
||||||
|
continue
|
||||||
elif q.startswith('help'):
|
elif q.startswith('help'):
|
||||||
qs = re.split(r'[ \t]', q)
|
qs = re.split(r'[ \t]', q)
|
||||||
if len(qs) > 1 and qs[1].startswith('c'):
|
if len(qs) > 1 and qs[1].startswith('c'):
|
||||||
@@ -511,12 +520,18 @@ def prompt(running = lambda:True, next = lambda:input('> '), state = None):
|
|||||||
with open(qs) as file:
|
with open(qs) as file:
|
||||||
qs = file.readline()
|
qs = file.readline()
|
||||||
from engine.utils import _Counter
|
from engine.utils import _Counter
|
||||||
|
lst_tell = -1
|
||||||
while(qs):
|
while(qs):
|
||||||
while(not ws.sub('', qs) or qs.strip().startswith('#')):
|
while(not ws.sub('', qs) or qs.strip().startswith('#')):
|
||||||
qs = file.readline()
|
qs = file.readline()
|
||||||
|
if lst_tell == file.tell():
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
lst_tell = file.tell()
|
||||||
cnt = _Counter(1)
|
cnt = _Counter(1)
|
||||||
prompt(lambda : cnt.inc(-1) > 0, lambda:qs.strip(), state)
|
prompt(lambda : cnt.inc(-1) > 0, lambda:qs.strip(), state)
|
||||||
qs = file.readline()
|
qs = file.readline()
|
||||||
|
continue
|
||||||
elif q.startswith('save2'):
|
elif q.startswith('save2'):
|
||||||
filename = re.split(r'[ \t]', q)
|
filename = re.split(r'[ \t]', q)
|
||||||
if (len(filename) > 1):
|
if (len(filename) > 1):
|
||||||
|
|||||||
+3
-2
@@ -882,10 +882,11 @@ class drop(ast_node):
|
|||||||
for a in tbl_obj.alias:
|
for a in tbl_obj.alias:
|
||||||
self.context.tables_byname.pop(a, None)
|
self.context.tables_byname.pop(a, None)
|
||||||
# TODO: delete in postproc engine
|
# TODO: delete in postproc engine
|
||||||
self.context.tables_byname.pop(tbl_name)
|
self.context.tables_byname.pop(tbl_name, None)
|
||||||
self.context.tables.remove(tbl_obj)
|
self.context.tables.discard(tbl_obj)
|
||||||
self.sql += 'TABLE IF EXISTS ' + tbl_name
|
self.sql += 'TABLE IF EXISTS ' + tbl_name
|
||||||
return
|
return
|
||||||
|
|
||||||
elif 'if_exists' not in node or not node['if_exists']:
|
elif 'if_exists' not in node or not node['if_exists']:
|
||||||
print(f'Error: table {tbl_name} not found.')
|
print(f'Error: table {tbl_name} not found.')
|
||||||
self.sql = ''
|
self.sql = ''
|
||||||
|
|||||||
+7
-1
@@ -307,9 +307,15 @@ class expr(ast_node):
|
|||||||
self.opname = node
|
self.opname = node
|
||||||
if type(node) is int:
|
if type(node) is int:
|
||||||
if (node >= 2**63 - 1 or node <= -2**63):
|
if (node >= 2**63 - 1 or node <= -2**63):
|
||||||
|
self.type = HgeT
|
||||||
|
elif (node >= 2**31 - 1 or node <= -2**31):
|
||||||
self.type = LongT
|
self.type = LongT
|
||||||
else:
|
elif node >= 2**15 - 1 or node <= -2**15:
|
||||||
self.type = IntT
|
self.type = IntT
|
||||||
|
elif node >= 2**7 - 1 or node <= -2**7:
|
||||||
|
self.type = ShortT
|
||||||
|
else:
|
||||||
|
self.type = ByteT
|
||||||
elif type(node) is float:
|
elif type(node) is float:
|
||||||
self.type = DoubleT
|
self.type = DoubleT
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ class TableInfo:
|
|||||||
self.order = [] # assumptions
|
self.order = [] # assumptions
|
||||||
|
|
||||||
cxt.tables_byname[self.table_name] = self # construct reverse map
|
cxt.tables_byname[self.table_name] = self # construct reverse map
|
||||||
|
cxt.tables.add(self)
|
||||||
|
|
||||||
def add_cols(self, cols, new = True):
|
def add_cols(self, cols, new = True):
|
||||||
for c in enlist(cols):
|
for c in enlist(cols):
|
||||||
@@ -137,7 +138,7 @@ class Context:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.tables_byname = dict()
|
self.tables_byname = dict()
|
||||||
self.col_byname = dict()
|
self.col_byname = dict()
|
||||||
self.tables : List[TableInfo] = []
|
self.tables : Set[TableInfo] = set()
|
||||||
self.cols = []
|
self.cols = []
|
||||||
self.datasource = None
|
self.datasource = None
|
||||||
self.module_stubs = ''
|
self.module_stubs = ''
|
||||||
@@ -166,7 +167,7 @@ class Context:
|
|||||||
self.ccode += c + '\n'
|
self.ccode += c + '\n'
|
||||||
def add_table(self, table_name, cols):
|
def add_table(self, table_name, cols):
|
||||||
tbl = TableInfo(table_name, cols, self)
|
tbl = TableInfo(table_name, cols, self)
|
||||||
self.tables.append(tbl)
|
self.tables.add(tbl)
|
||||||
return tbl
|
return tbl
|
||||||
def remove_scan(self, scan, str_scan):
|
def remove_scan(self, scan, str_scan):
|
||||||
self.emitc(str_scan)
|
self.emitc(str_scan)
|
||||||
|
|||||||
+23
-23
@@ -21,7 +21,27 @@ template <class T>
|
|||||||
struct is_vector_impl : std::false_type {};
|
struct is_vector_impl : std::false_type {};
|
||||||
template <class T>
|
template <class T>
|
||||||
constexpr static bool is_vector_type = is_vector_impl<T>::value;
|
constexpr static bool is_vector_type = is_vector_impl<T>::value;
|
||||||
|
#define Cond(c, x, y) typename std::conditional<c, x, y>::type
|
||||||
|
template <class T1, class T2>
|
||||||
|
struct aqis_same_impl {
|
||||||
|
constexpr static bool value =
|
||||||
|
std::conditional_t<
|
||||||
|
std::is_signed_v<T1> == std::is_signed_v<T2>,
|
||||||
|
Cond(
|
||||||
|
std::is_floating_point_v<T1> == std::is_floating_point_v<T2>,
|
||||||
|
Cond(
|
||||||
|
sizeof(T1) == sizeof(T2),
|
||||||
|
std::true_type,
|
||||||
|
std::false_type
|
||||||
|
),
|
||||||
|
std::false_type
|
||||||
|
),
|
||||||
|
std::false_type
|
||||||
|
>::value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T1, class T2>
|
||||||
|
constexpr bool aqis_same = aqis_same_impl<T1, T2>::value;
|
||||||
namespace types {
|
namespace types {
|
||||||
enum Type_t {
|
enum Type_t {
|
||||||
AINT32, AFLOAT, ASTR, ADOUBLE, ALDOUBLE, AINT64, AINT128, AINT16, ADATE, ATIME, AINT8,
|
AINT32, AFLOAT, ASTR, ADOUBLE, ALDOUBLE, AINT64, AINT128, AINT16, ADATE, ATIME, AINT8,
|
||||||
@@ -124,17 +144,17 @@ namespace types {
|
|||||||
f(short, AINT16) \
|
f(short, AINT16) \
|
||||||
f(date_t, ADATE) \
|
f(date_t, ADATE) \
|
||||||
f(time_t, ATIME) \
|
f(time_t, ATIME) \
|
||||||
f(unsigned char, AINT8) \
|
f(unsigned char, AUINT8) \
|
||||||
|
f(char, AINT8) \
|
||||||
f(unsigned int, AUINT32) \
|
f(unsigned int, AUINT32) \
|
||||||
f(unsigned long, AUINT64) \
|
f(unsigned long, AUINT64) \
|
||||||
f(unsigned short, AUINT16) \
|
f(unsigned short, AUINT16) \
|
||||||
f(unsigned char, AUINT8) \
|
|
||||||
f(bool, ABOOL) \
|
f(bool, ABOOL) \
|
||||||
f(timestamp_t, ATIMESTAMP) \
|
f(timestamp_t, ATIMESTAMP) \
|
||||||
F_INT128(f)
|
F_INT128(f)
|
||||||
|
|
||||||
inline constexpr static Type_t getType() {
|
inline constexpr static Type_t getType() {
|
||||||
#define TypeConnect(x, y) if constexpr(std::is_same<x, T>::value) return y; else
|
#define TypeConnect(x, y) if constexpr(aqis_same<x, T>) return y; else
|
||||||
ConnectTypes(TypeConnect)
|
ConnectTypes(TypeConnect)
|
||||||
if constexpr (is_vector_type<T>)
|
if constexpr (is_vector_type<T>)
|
||||||
return VECTOR;
|
return VECTOR;
|
||||||
@@ -144,7 +164,6 @@ namespace types {
|
|||||||
};
|
};
|
||||||
#define ATypeSize(t, at) sizeof(t),
|
#define ATypeSize(t, at) sizeof(t),
|
||||||
static constexpr size_t AType_sizes[] = { ConnectTypes(ATypeSize) 1 };
|
static constexpr size_t AType_sizes[] = { ConnectTypes(ATypeSize) 1 };
|
||||||
#define Cond(c, x, y) typename std::conditional<c, x, y>::type
|
|
||||||
#define Comp(o) (sizeof(T1) o sizeof(T2))
|
#define Comp(o) (sizeof(T1) o sizeof(T2))
|
||||||
#define Same(x, y) (std::is_same_v<x, y>)
|
#define Same(x, y) (std::is_same_v<x, y>)
|
||||||
#define __U(x) std::is_unsigned<x>::value
|
#define __U(x) std::is_unsigned<x>::value
|
||||||
@@ -297,26 +316,7 @@ template <class T>
|
|||||||
using decays = typename decayS<typename std::decay<T>::type>::type;
|
using decays = typename decayS<typename std::decay<T>::type>::type;
|
||||||
template <class T>
|
template <class T>
|
||||||
using decay_inner = typename decayS<T>::type;
|
using decay_inner = typename decayS<T>::type;
|
||||||
template <class T1, class T2>
|
|
||||||
struct aqis_same_impl {
|
|
||||||
constexpr static bool value =
|
|
||||||
std::conditional_t<
|
|
||||||
std::is_signed_v<T1> == std::is_signed_v<T2>,
|
|
||||||
Cond(
|
|
||||||
std::is_floating_point_v<T1> == std::is_floating_point_v<T2>,
|
|
||||||
Cond(
|
|
||||||
sizeof(T1) == sizeof(T2),
|
|
||||||
std::true_type,
|
|
||||||
std::false_type
|
|
||||||
),
|
|
||||||
std::false_type
|
|
||||||
),
|
|
||||||
std::false_type
|
|
||||||
>::value;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T1, class T2>
|
|
||||||
constexpr bool aqis_same = aqis_same_impl<T1, T2>::value;
|
|
||||||
|
|
||||||
template <class, template <class...> class T>
|
template <class, template <class...> class T>
|
||||||
struct instance_of_impl : std::false_type {};
|
struct instance_of_impl : std::false_type {};
|
||||||
|
|||||||
Reference in New Issue
Block a user