dev
Bill 2 years ago
parent 10e93f28c6
commit 826c156d9f

@ -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)
## Docker (Recommended):
`## Docker (Recommended):
- 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.
- 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
- For Visual Studio:
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. Clone AQuery repo from [Github](https://github.com/sunyinqi0508/AQuery2)
3. 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.
1. Install python3.6 or above from [official website](https://www.python.org/downloads/windows/) or Microsoft Store.
2. Install Microsoft Visual Studio 2022 or later with **Desktop development with C++** selected.
3. Clone AQuery repo from [Github](https://github.com/sunyinqi0508/AQuery2)
4. Install python requirements with pip `python3 -m pip install -r requirements.txt`
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:
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 '):
print(og_q[5:].lstrip())
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'):
qs = re.split(r'[ \t]', q)
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:
qs = file.readline()
from engine.utils import _Counter
lst_tell = -1
while(qs):
while(not ws.sub('', qs) or qs.strip().startswith('#')):
qs = file.readline()
if lst_tell == file.tell():
break
else:
lst_tell = file.tell()
cnt = _Counter(1)
prompt(lambda : cnt.inc(-1) > 0, lambda:qs.strip(), state)
qs = file.readline()
continue
elif q.startswith('save2'):
filename = re.split(r'[ \t]', q)
if (len(filename) > 1):

@ -882,10 +882,11 @@ class drop(ast_node):
for a in tbl_obj.alias:
self.context.tables_byname.pop(a, None)
# TODO: delete in postproc engine
self.context.tables_byname.pop(tbl_name)
self.context.tables.remove(tbl_obj)
self.context.tables_byname.pop(tbl_name, None)
self.context.tables.discard(tbl_obj)
self.sql += 'TABLE IF EXISTS ' + tbl_name
return
elif 'if_exists' not in node or not node['if_exists']:
print(f'Error: table {tbl_name} not found.')
self.sql = ''

@ -307,9 +307,15 @@ class expr(ast_node):
self.opname = node
if type(node) is int:
if (node >= 2**63 - 1 or node <= -2**63):
self.type = HgeT
elif (node >= 2**31 - 1 or node <= -2**31):
self.type = LongT
else:
elif node >= 2**15 - 1 or node <= -2**15:
self.type = IntT
elif node >= 2**7 - 1 or node <= -2**7:
self.type = ShortT
else:
self.type = ByteT
elif type(node) is float:
self.type = DoubleT

@ -67,7 +67,8 @@ class TableInfo:
self.order = [] # assumptions
cxt.tables_byname[self.table_name] = self # construct reverse map
cxt.tables.add(self)
def add_cols(self, cols, new = True):
for c in enlist(cols):
self.add_col(c, new)
@ -137,7 +138,7 @@ class Context:
def __init__(self):
self.tables_byname = dict()
self.col_byname = dict()
self.tables : List[TableInfo] = []
self.tables : Set[TableInfo] = set()
self.cols = []
self.datasource = None
self.module_stubs = ''
@ -166,7 +167,7 @@ class Context:
self.ccode += c + '\n'
def add_table(self, table_name, cols):
tbl = TableInfo(table_name, cols, self)
self.tables.append(tbl)
self.tables.add(tbl)
return tbl
def remove_scan(self, scan, str_scan):
self.emitc(str_scan)

@ -21,7 +21,27 @@ template <class T>
struct is_vector_impl : std::false_type {};
template <class T>
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 {
enum Type_t {
AINT32, AFLOAT, ASTR, ADOUBLE, ALDOUBLE, AINT64, AINT128, AINT16, ADATE, ATIME, AINT8,
@ -124,17 +144,17 @@ namespace types {
f(short, AINT16) \
f(date_t, ADATE) \
f(time_t, ATIME) \
f(unsigned char, AINT8) \
f(unsigned char, AUINT8) \
f(char, AINT8) \
f(unsigned int, AUINT32) \
f(unsigned long, AUINT64) \
f(unsigned short, AUINT16) \
f(unsigned char, AUINT8) \
f(bool, ABOOL) \
f(timestamp_t, ATIMESTAMP) \
F_INT128(f)
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)
if constexpr (is_vector_type<T>)
return VECTOR;
@ -144,7 +164,6 @@ namespace types {
};
#define ATypeSize(t, at) sizeof(t),
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 Same(x, y) (std::is_same_v<x, y>)
#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;
template <class T>
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>
struct instance_of_impl : std::false_type {};

Loading…
Cancel
Save