Open ggww opened 3 days ago
when i used the clickhouse function to implement complex calculations,the function get error message: DB::Exception: Function 'code_line_count_v2': wrong result, expected 1 row(s), actual 0: While processing code_line_count_v2('111'). (UNSUPPORTED_METHOD) (version 22.8.17.17 (official build))
and i can not get the reference valid answers in issues.
This error means that CH sent 1 row to the UDF, so it expected to get one row back, but it got 0 rows back.
Please make sure your function returns exactly one row of output per one row of input. Empty rows cannot be ignored.
Company or project name
No response
Question
when i used the clickhouse function to implement complex calculations,the function get error message: DB::Exception: Function 'code_line_count_v2': wrong result, expected 1 row(s), actual 0: While processing code_line_count_v2('111'). (UNSUPPORTED_METHOD) (version 22.8.17.17 (official build))
and i can not get the reference valid answers in issues.
the below is related code:
the function implements with java language:
public static void main(String[] args) { try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); CodeLineCountV2 codeLineCountV2 = new CodeLineCountV2(); String markdown; while (!(markdown = in.readLine()).isEmpty()) { JSONObject jsonObject = JSON.parseObject(markdown); Integer result = codeLineCountV2.evaluate(jsonObject.getString("markdown")); JSONObject object = new JSONObject(); object.put("result", result); System.out.print(object.toJSONString()); System.out.flush(); } } catch (Exception e) { e.getStackTrace(); } }
function script: code_line_count_v2_function.xml `
`
the command instruction in the script can run anywhere the server. the below sql script is successful to execute in clickhouse:
SYSTEM RELOAD FUNCTIONS; SELECT * FROM system.functions WHERE name = 'code_line_count_v2';