[
https://issues.apache.org/jira/browse/TAJO-1435?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dongjoon Hyun updated TAJO-1435:
--------------------------------
Assignee: (was: Dongjoon Hyun)
> Improve JDBC PreparedStatement performance
> ------------------------------------------
>
> Key: TAJO-1435
> URL: https://issues.apache.org/jira/browse/TAJO-1435
> Project: Tajo
> Issue Type: Improvement
> Components: JDBC Driver
> Affects Versions: 0.10.0
> Reporter: Dongjoon Hyun
>
> After my discussing with [~hyunsik] on
> https://issues.apache.org/jira/browse/TAJO-1430, I create this issue.
> In this issue, Tajo PreparedStatement will be upgraded by using parsed SQL
> Context instead of using StringBuffer like the following.
> {code:java}
> private String updateSql(final String sql, HashMap<Integer, String>
> parameters) {
> StringBuffer newSql = new StringBuffer(sql);
> int paramLoc = 1;
> while (getCharIndexFromSqlByParamLocation(sql, '?', paramLoc) > 0) {
> // check the user has set the needs parameters
> if (parameters.containsKey(paramLoc)) {
> int tt = getCharIndexFromSqlByParamLocation(newSql.toString(), '?',
> 1);
> newSql.deleteCharAt(tt);
> newSql.insert(tt, parameters.get(paramLoc));
> }
> paramLoc++;
> }
> return newSql.toString();
> }
> {code}
> As a discussion, TajoCLI module has the same pattern, but TajoCLI exits
> immediately. So, we can not improve more at this side. If we want to improve
> both cases, we need to handle in deeper server side.
> {code:java}
> if (cmd.hasOption("f")) {
> displayFormatter.setScriptMode();
> cmd.getOptionValues("");
> File sqlFile = new File(cmd.getOptionValue("f"));
> if (sqlFile.exists()) {
> String script = FileUtil.readTextFile(new
> File(cmd.getOptionValue("f")));
> script = replaceParam(script, cmd.getOptionValues("param"));
> int exitCode = executeScript(script);
> sout.flush();
> System.exit(exitCode);
> } else {
> System.err.println(ERROR_PREFIX + "No such a file \"" +
> cmd.getOptionValue("f") + "\"");
> System.exit(-1);
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)