Commit 470b1f41 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Fixed issue with long groups list

parent 802fe032
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -14,11 +14,11 @@ public class PrivateRowsQueryExecutor extends QueryExecutor {

        if (jobOwner instanceof CustomJobOwner) {
            CustomJobOwner user = (CustomJobOwner) jobOwner;
            statement.execute("SET my.tap_groups = \"{"
            statement.execute("SET my.tap_groups = '{"
                    + String.join(",", user.getGroups().stream()
                            .map(g -> g.replace("'", "''"))
                            .collect(Collectors.toList()))
                    + "}\"");
                    + "}'");
        }

        return super.executeQuery(statement, sql, jobOwner);
+2 −2
Original line number Diff line number Diff line
@@ -19,11 +19,11 @@ public class PrivateRowsQueryExecutorTest {
        Statement mockedStatement = mock(Statement.class);
        queryExecutor.executeQuery(mockedStatement, "", user);

        verify(mockedStatement).execute(eq("SET my.tap_groups = \"{group1,group2}\""));
        verify(mockedStatement).execute(eq("SET my.tap_groups = '{group1,group2}'"));

        user = new CustomJobOwner("anonymous", Arrays.asList());
        queryExecutor.executeQuery(mockedStatement, "", user);

        verify(mockedStatement).execute(eq("SET my.tap_groups = \"{}\""));
        verify(mockedStatement).execute(eq("SET my.tap_groups = '{}'"));
    }
}