-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config option to load external DDL file instead of default #192
Conversation
This commit adds a configuration option to the xml configuration files that specifies a path to a ddl script. If the configuration option is specified then that ddl script will be used instead of the default script for the benchmark and database. This could be useful for selecting between a row store and column store layout or other alternative indexing options. The xml tag is 'ddlpath'. Resolves cmu-db#153
Just realized this has no tests, working on that now. |
Ok, I added some. Let me know if there's a better way to test this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor requests.
I would remove all the TestXCreator
tests and just make one.
/** | ||
* Return the path in which we can find the ddl script. | ||
*/ | ||
public String getDdlPath() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: getDDLPath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
/** | ||
* Set the path in which we can find the ddl script. | ||
*/ | ||
public void setDdlPath(String ddlPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: setDDLPath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
ScriptRunner runner = new ScriptRunner(conn, true, true); | ||
|
||
if (LOG.isDebugEnabled()) { | ||
if (workConf.getDdlPath() != null) { | ||
String ddlPath = workConf.getDdlPath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a WARN
message to indicate you are overriding the default DDL path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
import java.sql.Statement; | ||
import java.util.List; | ||
|
||
public abstract class AbstractTestCreator<T extends BenchmarkModule> extends AbstractTestCase<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a creator?
private void validateCreate() throws SQLException { | ||
assertFalse("Failed to get table names for " + benchmark.getBenchmarkName().toUpperCase(), this.catalog.getTables().isEmpty()); | ||
|
||
for (Table table : this.catalog.getTables()) { | ||
String tableName = table.getName(); | ||
Table catalog_tbl = this.catalog.getTable(tableName); | ||
|
||
String sql = SQLUtil.getCountSQL(this.workConf.getDatabaseType(), catalog_tbl); | ||
|
||
try (Statement stmt = conn.createStatement(); | ||
ResultSet result = stmt.executeQuery(sql);) { | ||
|
||
assertNotNull(result); | ||
|
||
boolean adv = result.next(); | ||
assertTrue(sql, adv); | ||
|
||
int count = result.getInt(1); | ||
assertEquals(0, count); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to test this for every benchmark? It seems like we just need to test the functionality once that should be good enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted these and just added a single test that uses the MockBenchmark
let me know if that's what you had in mind.
I know what the issue is here, I just haven't had the time to fix it. I'll update it sometime this week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR introduces functionality for configuring a session by executing predefined statements before the benchmark execution begins. Users should specify the file containing these statements within the tag `<sessionsetupfile> </sessionsetupfile>` in the benchmarks' config files. CC: @bpkroth For example, ```xml <?xml version="1.0"?> <parameters> <!-- Connection details --> <type>sqlserver</type> ... <!-- Session setup statements file --> <sessionsetupfile>config/sqlserver/session_setup_sqlserver_cmds_example.sql</sessionsetupfile> ... ``` See Also: #192 --------- Co-authored-by: Rana Alotaibi <[email protected]> Co-authored-by: Rana Alotaibi <[email protected]> Co-authored-by: Brian Kroth <[email protected]> Co-authored-by: Brian Kroth <[email protected]>
This commit adds a configuration option to the xml configuration files
that specifies a path to a ddl script. If the configuration option is
specified then that ddl script will be used instead of the default
script for the benchmark and database.
This could be useful for selecting between a row store and column store
layout or other alternative indexing options.
The xml tag is 'ddlpath'.
Resolves #153