Skip to content
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

Merged
merged 8 commits into from
Jun 28, 2022

Conversation

jkosh44
Copy link
Contributor

@jkosh44 jkosh44 commented Jun 20, 2022

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

jkosh44 added 2 commits April 24, 2022 22:41
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
@jkosh44
Copy link
Contributor Author

jkosh44 commented Jun 20, 2022

Just realized this has no tests, working on that now.

@jkosh44
Copy link
Contributor Author

jkosh44 commented Jun 20, 2022

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.

Copy link
Member

@apavlo apavlo left a 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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: getDDLPath

Copy link
Contributor Author

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: setDDLPath

Copy link
Contributor Author

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();
Copy link
Member

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.

Copy link
Contributor Author

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> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a creator?

Comment on lines 63 to 84
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);
}
}
}
Copy link
Member

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.

Copy link
Contributor Author

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.

@jkosh44
Copy link
Contributor Author

jkosh44 commented Jun 27, 2022

I know what the issue is here, I just haven't had the time to fix it. I'll update it sometime this week.

@jkosh44 jkosh44 requested a review from apavlo June 28, 2022 00:09
Copy link
Member

@apavlo apavlo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@apavlo apavlo changed the title Add configuration to read external ddl script Add config option to load external DDL file instead of default Jun 28, 2022
@apavlo apavlo merged commit 7c64657 into cmu-db:main Jun 28, 2022
@bpkroth bpkroth mentioned this pull request Feb 13, 2025
bpkroth added a commit that referenced this pull request Feb 14, 2025
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for selecting alternative DDL at runtime rather than compile time
2 participants