dev
Bill 2 years ago
parent 3884558c3d
commit 3a56c19e2e

@ -85,7 +85,7 @@ class TypeCollection:
self.all_types.append(ty) self.all_types.append(ty)
type_table = dict() type_table = dict()
AnyT = Types(0) AnyT = Types(-1)
LazyT = Types(240, name = 'Lazy', cname = '', sqlname = '', ctype_name = '') LazyT = Types(240, name = 'Lazy', cname = '', sqlname = '', ctype_name = '')
DoubleT = Types(17, name = 'double', cname='double', sqlname = 'DOUBLE', is_fp = True) 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) 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) 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) UHgeT = Types(10, name = 'uint128', cname='__uint128_t', sqlname = 'HUGEINT', fp_type = DoubleT)
LongT = Types(4, name = 'int64', sqlname = 'BIGINT', 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) 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) 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) 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: def __call__(self, c_code = False, *args) -> str:
return self.call(self, c_code, *args) return self.call(self, c_code, *args)
def get_return_type(self, inputs): def get_return_type(self, *inputs):
return self.return_type(inputs) return self.return_type(*inputs)
def __repr__(self) -> str: def __repr__(self) -> str:
return self.name return self.name

@ -330,14 +330,18 @@ def prompt(running = lambda:True, next = input, state = None):
while state.get_ready(): while state.get_ready():
time.sleep(.00001) time.sleep(.00001)
print("> ", end="") print("> ", end="")
q = next().lower() og_q : str = next()
q = og_q.lower().strip()
if q == 'exec': # generate build and run (AQuery Engine) if q == 'exec': # generate build and run (AQuery Engine)
state.cfg.backend_type = Backend_Type.BACKEND_AQuery.value state.cfg.backend_type = Backend_Type.BACKEND_AQuery.value
cxt = engine.exec(state.stmts, cxt, keep) cxt = engine.exec(state.stmts, cxt, keep)
if subprocess.call(['make', 'snippet'], stdout = nullstream) == 0: if subprocess.call(['make', 'snippet'], stdout = nullstream) == 0:
state.set_ready() state.set_ready()
continue 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) qs = re.split(r'[ \t]', q)
if len(qs) > 1 and qs[1].startswith('c'): if len(qs) > 1 and qs[1].startswith('c'):
print(help_message) 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('#')): while(not ws.sub('', qs) or qs.strip().startswith('#')):
qs = file.readline() qs = file.readline()
cnt = _Counter(1) 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() qs = file.readline()
elif q.startswith('save2'): elif q.startswith('save2'):
filename = re.split(r'[ \t]', q) filename = re.split(r'[ \t]', q)

@ -673,6 +673,7 @@ class load(ast_node):
s3 = ' USING DELIMITERS ' s3 = ' USING DELIMITERS '
import os import os
p = os.path.abspath(node['file']['literal']).replace('\\', '/') p = os.path.abspath(node['file']['literal']).replace('\\', '/')
self.sql = f'{s1} \'{p}\' {s2} ' self.sql = f'{s1} \'{p}\' {s2} '
if 'term' in node: if 'term' in node:
self.sql += f' {s3} \'{node["term"]["literal"]}\'' self.sql += f' {s3} \'{node["term"]["literal"]}\''

@ -201,7 +201,7 @@ class expr(ast_node):
if self.c_code and self.datasource is not None: if self.c_code and self.datasource is not None:
self.sql = f'{{y(\"{self.sql}\")}}' self.sql = f'{{y(\"{self.sql}\")}}'
elif type(node) is bool: elif type(node) is bool:
self.type = IntT self.type = ByteT
if self.c_code: if self.c_code:
self.sql = '1' if node else '0' self.sql = '1' if node else '0'
else: else:
@ -209,7 +209,10 @@ class expr(ast_node):
else: else:
self.sql = f'{node}' self.sql = f'{node}'
if type(node) is int: 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: elif type(node) is float:
self.type = DoubleT self.type = DoubleT

@ -14,4 +14,3 @@ struct Session{
}; };
void* memory_map; void* memory_map;
}; };
#define EXPORT __DLLEXPORT__

@ -152,6 +152,10 @@ bool ThreadPool::busy(){
return true; return true;
} }
Trigger::Trigger(ThreadPool* tp){
}
void IntervalBasedTrigger::timer::reset(){ void IntervalBasedTrigger::timer::reset(){
time_remaining = interval; time_remaining = interval;
} }

@ -1,23 +1,30 @@
#!aquery #!aquery
echo Testing Insert, Filters and Nested Aggregation
f stock.a f stock.a
xexec xexec
echo Testing Incremental Group by Aggregation
f moving_avg.a f moving_avg.a
xexec xexec
echo Testing Standard SQL
f q1.sql f q1.sql
xexec xexec
echo Testing Joins
f joins.a f joins.a
xexec xexec
echo Testing Complex UDF with
f udf3.a f udf3.a
xexec xexec
echo Testing Data Types
f strings.a f strings.a
xexec xexec
echo Testing UDF with calls to other UDFs
f funcs.a f funcs.a
xexec xexec

Loading…
Cancel
Save