summaryrefslogtreecommitdiff
path: root/opendc-format/src/main
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-06-09 09:48:07 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-06-09 12:42:23 +0200
commitf0f59a0b98fe474da4411c0d5048ccdf4a2d7c43 (patch)
treeb9a8de23bac3a764d24a348b8d2d548b0d6b4298 /opendc-format/src/main
parent1b52a443e508bc4130071e67a1a8e17a6714c6b8 (diff)
exp: Use LocalInputFile for Parquet readers
This change updates the Parquet readers used in the Capelin experiments to use our InputFile implementation for local files, to reduce our dependency on Apache Hadoop.
Diffstat (limited to 'opendc-format/src/main')
-rw-r--r--opendc-format/src/main/kotlin/org/opendc/format/util/LocalInputFile.kt6
1 files changed, 6 insertions, 0 deletions
diff --git a/opendc-format/src/main/kotlin/org/opendc/format/util/LocalInputFile.kt b/opendc-format/src/main/kotlin/org/opendc/format/util/LocalInputFile.kt
index d8c25a62..92319ace 100644
--- a/opendc-format/src/main/kotlin/org/opendc/format/util/LocalInputFile.kt
+++ b/opendc-format/src/main/kotlin/org/opendc/format/util/LocalInputFile.kt
@@ -25,6 +25,7 @@ package org.opendc.format.util
import org.apache.parquet.io.InputFile
import org.apache.parquet.io.SeekableInputStream
import java.io.EOFException
+import java.io.File
import java.nio.ByteBuffer
import java.nio.channels.FileChannel
import java.nio.file.Path
@@ -39,6 +40,11 @@ public class LocalInputFile(private val path: Path) : InputFile {
*/
private val channel = FileChannel.open(path, StandardOpenOption.READ)
+ /**
+ * Construct a [LocalInputFile] for the specified [file].
+ */
+ public constructor(file: File) : this(file.toPath())
+
override fun getLength(): Long = channel.size()
override fun newStream(): SeekableInputStream = object : SeekableInputStream() {