Skip to content
Snippets Groups Projects
Commit 470b1f41 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Fixed issue with long groups list

parent 802fe032
No related branches found
No related tags found
No related merge requests found
Pipeline #8748 failed
...@@ -14,11 +14,11 @@ public class PrivateRowsQueryExecutor extends QueryExecutor { ...@@ -14,11 +14,11 @@ public class PrivateRowsQueryExecutor extends QueryExecutor {
if (jobOwner instanceof CustomJobOwner) { if (jobOwner instanceof CustomJobOwner) {
CustomJobOwner user = (CustomJobOwner) jobOwner; CustomJobOwner user = (CustomJobOwner) jobOwner;
statement.execute("SET my.tap_groups = \"{" statement.execute("SET my.tap_groups = '{"
+ String.join(",", user.getGroups().stream() + String.join(",", user.getGroups().stream()
.map(g -> g.replace("'", "''")) .map(g -> g.replace("'", "''"))
.collect(Collectors.toList())) .collect(Collectors.toList()))
+ "}\""); + "}'");
} }
return super.executeQuery(statement, sql, jobOwner); return super.executeQuery(statement, sql, jobOwner);
......
...@@ -19,11 +19,11 @@ public class PrivateRowsQueryExecutorTest { ...@@ -19,11 +19,11 @@ public class PrivateRowsQueryExecutorTest {
Statement mockedStatement = mock(Statement.class); Statement mockedStatement = mock(Statement.class);
queryExecutor.executeQuery(mockedStatement, "", user); 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()); user = new CustomJobOwner("anonymous", Arrays.asList());
queryExecutor.executeQuery(mockedStatement, "", user); queryExecutor.executeQuery(mockedStatement, "", user);
verify(mockedStatement).execute(eq("SET my.tap_groups = \"{}\"")); verify(mockedStatement).execute(eq("SET my.tap_groups = '{}'"));
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment