summaryrefslogtreecommitdiff
path: root/opendc-trace/opendc-trace-gwf/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-05-02 14:17:55 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-05-02 15:37:04 +0200
commit670cd279ea7789e07b6d778a21fdec68347ab305 (patch)
treedf91a7fd81a5d1afc51a0380fd938adf701bc43b /opendc-trace/opendc-trace-gwf/src
parent9411845b3f26536a1e6ea40504e396f19d25a09a (diff)
feat(trace/api): Add support for projecting tables
This change adds support for projecting certain columns of a table. This enables faster reading for tables with high number of columns. Currently, we support projection in the Parquet-based workload formats. Other formats are text-based and will probably not benefit much from projection.
Diffstat (limited to 'opendc-trace/opendc-trace-gwf/src')
-rw-r--r--opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt2
-rw-r--r--opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt6
2 files changed, 4 insertions, 4 deletions
diff --git a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt
index 63688523..8d9eab82 100644
--- a/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt
+++ b/opendc-trace/opendc-trace-gwf/src/main/kotlin/org/opendc/trace/gwf/GwfTraceFormat.kt
@@ -70,7 +70,7 @@ public class GwfTraceFormat : TraceFormat {
}
}
- override fun newReader(path: Path, table: String): TableReader {
+ override fun newReader(path: Path, table: String, projection: List<TableColumn<*>>?): TableReader {
return when (table) {
TABLE_TASKS -> GwfTaskTableReader(factory.createParser(path.toFile()))
else -> throw IllegalArgumentException("Table $table not supported")
diff --git a/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt b/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt
index 9bf28ad7..411d45d0 100644
--- a/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt
+++ b/opendc-trace/opendc-trace-gwf/src/test/kotlin/org/opendc/trace/gwf/GwfTraceFormatTest.kt
@@ -58,7 +58,7 @@ internal class GwfTraceFormatTest {
@Test
fun testTableReader() {
val path = Paths.get(checkNotNull(GwfTraceFormatTest::class.java.getResource("/trace.gwf")).toURI())
- val reader = format.newReader(path, TABLE_TASKS)
+ val reader = format.newReader(path, TABLE_TASKS, null)
assertAll(
{ assertTrue(reader.nextRow()) },
@@ -73,7 +73,7 @@ internal class GwfTraceFormatTest {
@Test
fun testReadingRowWithDependencies() {
val path = Paths.get(checkNotNull(GwfTraceFormatTest::class.java.getResource("/trace.gwf")).toURI())
- val reader = format.newReader(path, TABLE_TASKS)
+ val reader = format.newReader(path, TABLE_TASKS, null)
// Move to row 7
for (x in 1..6)
@@ -85,7 +85,7 @@ internal class GwfTraceFormatTest {
{ assertEquals("7", reader.get(TASK_ID)) },
{ assertEquals(Instant.ofEpochSecond(87), reader.get(TASK_SUBMIT_TIME)) },
{ assertEquals(Duration.ofSeconds(11), reader.get(TASK_RUNTIME)) },
- { assertEquals(setOf<String>("4", "5", "6"), reader.get(TASK_PARENTS)) },
+ { assertEquals(setOf("4", "5", "6"), reader.get(TASK_PARENTS)) },
)
}
}