singhpk234 commented on code in PR #1802: URL: https://github.com/apache/polaris/pull/1802#discussion_r2127832210
########## persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/QueryGenerator.java: ########## @@ -37,35 +40,51 @@ public class QueryGenerator { - public static <T> String generateSelectQuery( + public static class PreparedQuery { + private final String sql; + private final List<Object> parameters; + + public PreparedQuery(String sql, List<Object> parameters) { + this.sql = sql; + this.parameters = parameters; + } + + public String getSql() { + return sql; + } + + public List<Object> getParameters() { + return parameters; + } + } + + public static <T> PreparedQuery generateSelectQuery( @Nonnull Converter<T> entity, @Nonnull Map<String, Object> whereClause) { Review Comment: [Update] I refactored the QueryGenerator to now containing only 5 ways to generate the query so now it has only 1. SELECT and where 2. UPDATE all columns and where 3. DELETE and where 4. SELECT with IN query with dynamic list 5. SELECT with one special disjunction These are all single table queries, all the projection are taken from the static member and the filters column reference has an assertion that keys in filter are subset of the columns from the static member of the model. All this functions return a PreparedQuery -> SQL string with `?` and the ordered list of parameters which we can feed to the JDBC, it now doesn't need entity obj to create these. Need to refactor this more to completely decouple the query generation and parameter feeding, working on it, it gonna take some more time. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org