database-stream-processor icon indicating copy to clipboard operation
database-stream-processor copied to clipboard

[JIT]: position of error

Open mihaibudiu opened this issue 2 years ago • 2 comments

When validation of JSON fails the errors positions displayed are shown at the end of the document.

mihaibudiu avatar Apr 01 '23 01:04 mihaibudiu

With the latest validation code the errors are still not very precise. This is an example:

Running `target/debug/dataflow-jit /home/mbudiu/git/sql-to-dbsp-compiler/SQL-compiler/./out5365544670932359703.json`
json validation error at `/nodes/138`: {"Map":{"input":79,"layout":2,"map_fn":{"args":[{"flags":"input","id":1,"layout":1},{"flags":"output","id":2,"layout":2}],"blocks":{"1":{"body":[[3,{"Load":{"column":4,"column_type":"I32","source":1,"source_layout":3}}],[4,{"IsNull":{"column":4,"target":1,"target_layout":3}}],[5,{"Constant":{"I32":10}}],[6,{"Constant":{"Bool":false}}],[7,{"BinOp":{"kind":"GreaterThan","lhs":3,"operand_ty":"I32","rhs":5}}],[8,{"BinOp":{"kind":"Or","lhs":4,"operand_ty":"Bool","rhs":6}}],[9,{"Load":{"column":2,"column_type":"Bool","source":1,"source_layout":3}}],[10,{"Constant":{"Bool":false}}],[11,{"UnaryOp":{"kind":"Not","value":9,"value_ty":"Bool"}}],[12,{"Constant":{"Bool":true}}],[13,{"Select":{"cond":10,"if_false":11,"if_true":12}}],[14,{"Constant":{"Bool":false}}],[15,{"UnaryOp":{"kind":"Not","value":7,"value_ty":"Bool"}}],[16,{"Select":{"cond":10,"if_false":14,"if_true":15}}],[17,{"Select":{"cond":8,"if_false":16,"if_true":13}}],[18,{"BinOp":{"kind":"And","lhs":7,"operand_ty":"Bool","rhs":9}}],[19,{"Select":{"cond":10,"if_false":18,"if_true":7}}],[20,{"Select":{"cond":8,"if_false":19,"if_true":9}}],[21,{}],[22,{"Store":{"column":0,"target":2,"target_layout":2,"value":{"Expr":20},"value_type":"Bool"}}],[23,{"SetNull":{"column":0,"is_null":{"Expr":21},"target":2,"target_layout":2}}]],"id":1,"terminator":{"Return":{"value":{"Imm":"Unit"}}}}},"entry_block":1,"ret":"Unit"}}} is not valid under any of the given schemas
encountered 1 error while validating json, exiting

It is not clear where the error is; the toplevel node Map where the error is signaled seems to have the correct schema itself.

mihaibudiu avatar Apr 14 '23 20:04 mihaibudiu

The problem is most likely 21 which is an empty instruction, but the error does not point there.

mihaibudiu avatar Apr 14 '23 20:04 mihaibudiu