Benchmark Modification For Cubrid#188
Benchmark Modification For Cubrid#188Qianmin-Jiang wants to merge 15 commits intooltpbenchmark:masterfrom
Conversation
…id-ddl; add jar file to oltpbenchmark/lib
apavlo
left a comment
There was a problem hiding this comment.
Please make the requested changes.
| // Everyone else can use the regular getGeneratedKeys() method | ||
| else if (is != null) { | ||
| pStmt = conn.prepareStatement(stmt.getSQL(), is); | ||
| if (getDatabaseType() == DatabaseType.CUBRID) { |
There was a problem hiding this comment.
Can you add a comment to explain why you need this special clause?
| + "lineitem " | ||
| + "where " | ||
| + "l_shipdate <= date '1998-12-01' - interval '95' day " | ||
| + "l_shipdate <= ADDDATE('1998-12-01', interval -'95' day) " |
There was a problem hiding this comment.
Can you remove all of the changes that you made to the TPC-H queries for Cubrid? We will have to fix the benchmark later to add real dialect files.
| if(this.getDatabaseType() == DatabaseType.ORACLE) { | ||
| // Oracle handles quoted object identifiers differently, do not escape names | ||
| sql = SQLUtil.getInsertSQL(catalog_tbl, false); | ||
| } else if(this.getDatabaseType() == DatabaseType.CUBRID) { |
There was a problem hiding this comment.
Please add comments to explain what this does.
There was a problem hiding this comment.
It means for the generated the SQL queries, include the column names and skip the first auto_increment column.
The field is set to be auto_increment since in the insert queries in the UpdatePage, these fields are not set and they have not null constraints.
Both the loading phase and the procedures are inserting records. In the previous code, in the loading phase, it sets values for all columns. And in the procedures, it does not set value for the auto_increment fields. For Cubrid, it does not update the initial value of the auto_increment fields, while MySQL does this. So if we manually set values for these fields in the loading phase, in the execution phase Cubrid will set these values starting from some initial value which may already exist because of the loading phase. This causes the unique constraint violation. To avoid this, we skip setting these fields in the loading phase.
| // Oracle handles quoted object identifiers differently, do not escape names | ||
| sql = SQLUtil.getInsertSQL(catalog_tbl, false); | ||
| } else if(this.getDatabaseType() == DatabaseType.CUBRID) { | ||
| sql = SQLUtil.getInsertSQL(catalog_tbl, true, false, 1, 0); |
There was a problem hiding this comment.
Please add comments that explain these parameters.
| // Insert the text | ||
| int col = 1; | ||
| textInsert.setInt(col++, rev_id); // old_id | ||
| if (this.getDatabaseType() != DatabaseType.CUBRID) { |
There was a problem hiding this comment.
Old_id is an auto_increment field and we skip setting this field here.
| for (Integer otherUserId : wlUser) { | ||
| ps.setInt(param, otherUserId.intValue()); | ||
| ps.addBatch(); | ||
| param = 1; |
There was a problem hiding this comment.
In the previous code, each time it creates a prepared statement, it rebinds the userId field and does not change other fields.
For Cubrid, it complains that in the generated statements, not all parameters are binded. From the log record in Cubrid, in the query that server received, only userId is binded and other params are not. So we rebind all the params here.
| } catch (SQLException esql) { | ||
| int errorCode = esql.getErrorCode(); | ||
| if (errorCode == 8177) | ||
| if (errorCode == 8177) |
There was a problem hiding this comment.
No, this code exists in the previous code. Sorry we accidentally add a white space. We will remove that.
| // sb.append(";"); | ||
| return (sb.toString()); | ||
| StringBuilder sb = new StringBuilder(); |
There was a problem hiding this comment.
What did you change in this function?
There was a problem hiding this comment.
We used 4 spaces as indentation here and the master branch also has 4 spaces indentation. But the version compared to has 3 indentation. So we keep the 4 spaces indentation here.
a33d37a to
0b50469
Compare
This PR adds modifications on benchmark files to run Cubrid with TPCC, Wikipedia and TPCH.
For TPCH, it does not include any dialect and right now we directly modify the SQLs in /tpch/queries/Q{1-22}.java.