Closed yihanlii closed 10 months ago
Benchmark
在benchmark测试含有返回数组的方法时,应该有返回值的测试样例全部返回了空数组,但我在数据库和bootrun对同样测试样例进行测试,都能得到正确结果。之后我又进行了测试,发现benchmark测试时数据库查询得到的返回值里调用.next的值为false,也就是没有查询结果,但正常情况下应该有查询结果 List<String> temp=new ArrayList<>(); String sql2= "select c.videoBV, count(videoBV) as cnt\n" + "from (\n" + " select a.videoBV\n" + " from user_view_video a\n" + " inner join (select usermid,videobv from user_view_video where videoBV= ?) b\n" + " on a.usermid=b.userMid and a.videobv!=b.videobv) c\n" + "group by c.videobv\n" + "order by cnt desc,c.videoBV\n" + "limit 5;"; try (Connection conn = dataSource.getConnection(); PreparedStatement stmt2 = conn.prepareStatement(sql2); ) { stmt2.setString(1,bv); ResultSet rs2 = stmt2.executeQuery(); while (rs2.next()){ temp.add(rs2.getString("videoBV")); } } catch (SQLException e) { throw new RuntimeException(e); } return temp; 注:上面只是rec video 的代码(不含判断corner case)其他方法的代码和这个类似
List<String> temp=new ArrayList<>(); String sql2= "select c.videoBV, count(videoBV) as cnt\n" + "from (\n" + " select a.videoBV\n" + " from user_view_video a\n" + " inner join (select usermid,videobv from user_view_video where videoBV= ?) b\n" + " on a.usermid=b.userMid and a.videobv!=b.videobv) c\n" + "group by c.videobv\n" + "order by cnt desc,c.videoBV\n" + "limit 5;"; try (Connection conn = dataSource.getConnection(); PreparedStatement stmt2 = conn.prepareStatement(sql2); ) { stmt2.setString(1,bv); ResultSet rs2 = stmt2.executeQuery(); while (rs2.next()){ temp.add(rs2.getString("videoBV")); } } catch (SQLException e) { throw new RuntimeException(e); } return temp;
No response
@yihanlii This bug may be caused by asynchronous operations. You can discuss this problem in Discussion #83.
Related module
Benchmark
What happened
在benchmark测试含有返回数组的方法时,应该有返回值的测试样例全部返回了空数组,但我在数据库和bootrun对同样测试样例进行测试,都能得到正确结果。之后我又进行了测试,发现benchmark测试时数据库查询得到的返回值里调用.next的值为false,也就是没有查询结果,但正常情况下应该有查询结果
List<String> temp=new ArrayList<>(); String sql2= "select c.videoBV, count(videoBV) as cnt\n" + "from (\n" + " select a.videoBV\n" + " from user_view_video a\n" + " inner join (select usermid,videobv from user_view_video where videoBV= ?) b\n" + " on a.usermid=b.userMid and a.videobv!=b.videobv) c\n" + "group by c.videobv\n" + "order by cnt desc,c.videoBV\n" + "limit 5;"; try (Connection conn = dataSource.getConnection(); PreparedStatement stmt2 = conn.prepareStatement(sql2); ) { stmt2.setString(1,bv); ResultSet rs2 = stmt2.executeQuery(); while (rs2.next()){ temp.add(rs2.getString("videoBV")); } } catch (SQLException e) { throw new RuntimeException(e); } return temp;
注:上面只是rec video 的代码(不含判断corner case)其他方法的代码和这个类似What you expected to happen
No response
How to reproduce
No response
Anything else
No response