menu

weld

Using and developing Weld, a runtime for data analytics

Channels
Team

An IR which returns a wrong answer.

January 22, 2021 at 1:44am

An IR which returns a wrong answer.

January 22, 2021 at 1:44am
I construct a test which uses a vector containing struct. But the length of result is 0. When I change the input data to i32 vector, the length of result is correct. Blow is the code.
//Multi Column Test let code = "|v: vec[{i32,i32,i32}] | let sorted_vec = sort( result( for( v, appender[{i32,i32,i32}], |b:appender[{i32,i32,i32}],i:i64,n:{i32,i32,i32}| if(n.$1 == 1,merge(b,n),b) )), |x:{i32,i32,i32},y:{i32,i32,i32}| compare(x.$2,y.$2)); len(slice(sorted_vec,0L,3L))"; let neid = OmniCodeGen::compile(code); let id = vec![1,2,3,4,5,6]; let course = vec![7,8,9,10,11,12]; let score= vec![80,81,82,83,84,85]; let data = vec![id,course,score]; let result = OmniCodeGen::execute(neid,data).expect("OmniCache Native execute failed!"); println!("result {:?}", result); let data = result.data() as const i64; let result = unsafe { (data).clone() }; println!("result----- {:?}",result)
impl OmniCodeGen { pub fn compile(code: &str) -> u64 { let conf = WeldConf::new(); let module = WeldModule::compile(code,&conf).expect("OmniCache code gen failed!"); let mut s = DefaultHasher::new(); code.hash(&mut s); let key= s.finish(); CACHE.insert(key,module); return key; } pub unsafe fn execute(nativeExecId: u64, data: Vec) -> WeldResult { let module = CACHE.get(&nativeExecId).expect("Not find execution native code,please code compile first!");
#[allow(deadcode)] struct Args { v: WeldVec, } let ref input_data = Args{ v: WeldVec::from(&data), }; let ref input_value = WeldValue::new_from_data(input_data as * const as Data); let ref conf = WeldConf::new(); let ref mut context = WeldContext::new(&conf).unwrap(); return module.run(context,input_value); } }
No messages yet