Last active
July 22, 2016 16:38
-
-
Save aseigneurin/b11afd1247752db952f163b6f8b9b508 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class PendingResult(k1: Long, k2: String, futureResults: ResultSetFuture) | |
val pendingResults = ArrayBuffer.empty[PendingResult] | |
for (i <- 1 to iterations) { | |
val k1 = ... | |
val k2 = ... | |
val futureResults = session.executeAsync(s"SELECT * FROM ${tableName} WHERE k1=${k1} AND k2='${k2}'") | |
pendingResults += PendingResult(k1, k2, futureResults) | |
} | |
for (pendingResult <- pendingResults) { | |
val results = pendingResult.futureResults.get() | |
val ids = ArrayBuffer.empty[Long] | |
for (row <- results) { | |
ids += row.getLong("id") | |
} | |
if (verbose) { | |
println(s"${pendingResult.k1}, ${pendingResult.k2}, ${ids.mkString(",")}") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment