Skip to content

Commit

Permalink
Fixes a few warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppanopticon committed Dec 1, 2023
1 parent ac7dfe7 commit 2771c6e
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.vitrivr.cottontail

import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.json.DecodeSequenceMode
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.decodeToSequence
import kotlinx.serialization.json.encodeToStream
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardOpenOption
import java.util.*

/**
*
* @author Ralph Gasser
* @version 1.0
*/

fun main(args: Array<String>) {
val path = Paths.get("/Users/rgasser/Downloads/package/warren.VBSLHE.descriptor_file.0.json")
val json = Json { prettyPrint = true }
Files.newInputStream(path, StandardOpenOption.READ).use { input ->
val buffer = LinkedList<FileDescriptor>()
var index = 0
val descriptors = Json.decodeToSequence(input, FileDescriptor.serializer(), DecodeSequenceMode.ARRAY_WRAPPED)
for (descriptor in descriptors) {
buffer.add(descriptor)
if (buffer.size == 50_000) {
write(index++, buffer)
buffer.clear()
}
}
write(index, buffer)
}
}

/**
*
*/
fun write(index: Int, buffer: LinkedList<FileDescriptor>) {
val path = Paths.get("/Users/rgasser/Downloads/package/out/warren.VBSLHE.descriptor_file.$index.json")
Files.newOutputStream(path, StandardOpenOption.CREATE, StandardOpenOption.WRITE).use { output ->
Json.encodeToStream(ListSerializer(FileDescriptor.serializer()), buffer, output)
}
}

@Serializable
data class Descriptor(val descriptorId: String, val retrievableId: String, val descriptor: FloatArray)

@Serializable
data class Retrievable(val retrievableId: String, val type: String)

@Serializable
data class Relationship(val objectId: String, val subjectId: String, val predicate: String)

@Serializable
data class FileDescriptor(val descriptorId: String = UUID.randomUUID().toString(), val retrievableId: String, val size: Int, val path: String) {}

@Serializable
data class TimeDescriptor(val descriptorId: String, val retrievableId: String, val start: Long, val end: Long)
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import kotlin.time.ExperimentalTime
import kotlin.time.TimeSource

/**
* A facility common to all service that handle [TransactionManager.TransactionImpl]s over gRPC.
* A facility common to all service that handle [TransactionManager.AbstractTransaction]s over gRPC.
*
* @author Ralph Gasser
* @version 1.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ class DMLServiceTest : AbstractClientTest() {
fun testInvalidNullInsert() {
val entries = TEST_COLLECTION_SIZE * 5
val batchSize = 1000
val stringLength = 200

/* Start large insert. */
val txId = this.client.begin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ object GrpcTestUtils {
*/
fun populateVectorEntity(client: SimpleClient) {
val batch = BatchInsert(TestConstants.TEST_VECTOR_ENTITY_NAME.fqn)
.columns(ID_COLUMN_NAME, STRING_COLUMN_NAME, INT_COLUMN_NAME, TestConstants.TWOD_COLUMN_NAME)
.columns(ID_COLUMN_NAME, STRING_COLUMN_NAME, INT_COLUMN_NAME, TWOD_COLUMN_NAME)
val random = Random.Default
repeat(TestConstants.TEST_COLLECTION_SIZE) {
val lat = random.nextFloat() + random.nextInt(0, 50)
Expand Down

0 comments on commit 2771c6e

Please sign in to comment.