diff --git a/engine/types.py b/engine/types.py index cbc0933..05197e9 100644 --- a/engine/types.py +++ b/engine/types.py @@ -85,7 +85,7 @@ class TypeCollection: self.all_types.append(ty) type_table = dict() -AnyT = Types(0) +AnyT = Types(-1) LazyT = Types(240, name = 'Lazy', cname = '', sqlname = '', ctype_name = '') DoubleT = Types(17, name = 'double', cname='double', sqlname = 'DOUBLE', is_fp = True) LDoubleT = Types(18, name = 'long double', cname='long double', sqlname = 'LDOUBLE', is_fp = True) @@ -94,6 +94,7 @@ FloatT = Types(16, name = 'float', cname = 'float', sqlname = 'REAL', HgeT = Types(9, name = 'int128',cname='__int128_t', sqlname = 'HUGEINT', fp_type = DoubleT) UHgeT = Types(10, name = 'uint128', cname='__uint128_t', sqlname = 'HUGEINT', fp_type = DoubleT) LongT = Types(4, name = 'int64', sqlname = 'BIGINT', fp_type = DoubleT) +BoolT = Types(0, name = 'bool', sqlname = 'BOOL', long_type=LongT, fp_type=FloatT) ByteT = Types(1, name = 'int8', sqlname = 'TINYINT', long_type=LongT, fp_type=FloatT) ShortT = Types(2, name = 'int16', sqlname='SMALLINT', long_type=LongT, fp_type=FloatT) IntT = Types(3, name = 'int', cname = 'int', long_type=LongT, fp_type=FloatT) @@ -176,8 +177,8 @@ class OperatorBase: def __call__(self, c_code = False, *args) -> str: return self.call(self, c_code, *args) - def get_return_type(self, inputs): - return self.return_type(inputs) + def get_return_type(self, *inputs): + return self.return_type(*inputs) def __repr__(self) -> str: return self.name diff --git a/prompt.py b/prompt.py index bf765ce..70d2714 100644 --- a/prompt.py +++ b/prompt.py @@ -330,14 +330,18 @@ def prompt(running = lambda:True, next = input, state = None): while state.get_ready(): time.sleep(.00001) print("> ", end="") - q = next().lower() + og_q : str = next() + q = og_q.lower().strip() if q == 'exec': # generate build and run (AQuery Engine) state.cfg.backend_type = Backend_Type.BACKEND_AQuery.value cxt = engine.exec(state.stmts, cxt, keep) if subprocess.call(['make', 'snippet'], stdout = nullstream) == 0: state.set_ready() continue - if q.startswith('help'): + elif q.startswith('echo '): + print(og_q[5:].lstrip()) + continue + elif q.startswith('help'): qs = re.split(r'[ \t]', q) if len(qs) > 1 and qs[1].startswith('c'): print(help_message) @@ -426,7 +430,7 @@ def prompt(running = lambda:True, next = input, state = None): while(not ws.sub('', qs) or qs.strip().startswith('#')): qs = file.readline() cnt = _Counter(1) - main(lambda : cnt.inc(-1) > 0, lambda:qs.strip(), state) + prompt(lambda : cnt.inc(-1) > 0, lambda:qs.strip(), state) qs = file.readline() elif q.startswith('save2'): filename = re.split(r'[ \t]', q) diff --git a/reconstruct/ast.py b/reconstruct/ast.py index 2eedc2b..11aba6f 100644 --- a/reconstruct/ast.py +++ b/reconstruct/ast.py @@ -673,6 +673,7 @@ class load(ast_node): s3 = ' USING DELIMITERS ' import os p = os.path.abspath(node['file']['literal']).replace('\\', '/') + self.sql = f'{s1} \'{p}\' {s2} ' if 'term' in node: self.sql += f' {s3} \'{node["term"]["literal"]}\'' diff --git a/reconstruct/expr.py b/reconstruct/expr.py index 14d7478..caa5f3a 100644 --- a/reconstruct/expr.py +++ b/reconstruct/expr.py @@ -201,7 +201,7 @@ class expr(ast_node): if self.c_code and self.datasource is not None: self.sql = f'{{y(\"{self.sql}\")}}' elif type(node) is bool: - self.type = IntT + self.type = ByteT if self.c_code: self.sql = '1' if node else '0' else: @@ -209,7 +209,10 @@ class expr(ast_node): else: self.sql = f'{node}' if type(node) is int: - self.type = LongT + if (node >= 2**63 - 1 or node <= -2**63): + self.type = LongT + else: + self.type = IntT elif type(node) is float: self.type = DoubleT diff --git a/sdk/aquery.h b/sdk/aquery.h index 31fe785..14a91ca 100644 --- a/sdk/aquery.h +++ b/sdk/aquery.h @@ -14,4 +14,3 @@ struct Session{ }; void* memory_map; }; -#define EXPORT __DLLEXPORT__ \ No newline at end of file diff --git a/server/threading.cpp b/server/threading.cpp index 7d7ca22..eb2784e 100644 --- a/server/threading.cpp +++ b/server/threading.cpp @@ -152,6 +152,10 @@ bool ThreadPool::busy(){ return true; } +Trigger::Trigger(ThreadPool* tp){ + +} + void IntervalBasedTrigger::timer::reset(){ time_remaining = interval; } diff --git a/test.aquery b/test.aquery index 746eab0..1c4b847 100644 --- a/test.aquery +++ b/test.aquery @@ -1,23 +1,30 @@ #!aquery +echo Testing Insert, Filters and Nested Aggregation f stock.a xexec +echo Testing Incremental Group by Aggregation f moving_avg.a xexec +echo Testing Standard SQL f q1.sql xexec +echo Testing Joins f joins.a xexec +echo Testing Complex UDF with f udf3.a xexec +echo Testing Data Types f strings.a xexec +echo Testing UDF with calls to other UDFs f funcs.a xexec