From 3d897d92299ec00b4f5d59cccb88fa64533e1ac9 Mon Sep 17 00:00:00 2001 From: voropaevp Date: Sun, 1 Aug 2021 00:13:31 +0100 Subject: [PATCH] Update quill-cassandra-ce/src/main/scala-2.12/io/getquill/CassandraCeContext.scala executeQuery optimization Co-authored-by: Diego E. Alonso Blas --- .../scala-2.12/io/getquill/CassandraCeContext.scala | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/quill-cassandra-ce/src/main/scala-2.12/io/getquill/CassandraCeContext.scala b/quill-cassandra-ce/src/main/scala-2.12/io/getquill/CassandraCeContext.scala index ddfe41486c..43e5aadf0b 100644 --- a/quill-cassandra-ce/src/main/scala-2.12/io/getquill/CassandraCeContext.scala +++ b/quill-cassandra-ce/src/main/scala-2.12/io/getquill/CassandraCeContext.scala @@ -60,14 +60,8 @@ class CassandraCeContext[N <: NamingStrategy, F[_]]( .map(extractor) } - def executeQuery[T](cql: String, prepare: Prepare = identityPrepare, extractor: Extractor[T] = identityExtractor): Result[RunQueryResult[T]] = { - streamQuery[T](cql, prepare, extractor) - .fold(List[T]())({ case (l, r) => r +: l }) - .map(_.reverse) - .covary[F] - .compile - .toList.map(_.head) - } + def executeQuery[T](cql: String, prepare: Prepare = identityPrepare, extractor: Extractor[T] = identityExtractor): Result[RunQueryResult[T]] = + streamQuery[T](cql, prepare, extractor).compile.toList def executeQuerySingle[T](cql: String, prepare: Prepare = identityPrepare, extractor: Extractor[T] = identityExtractor): Result[RunQuerySingleResult[T]] = Functor[F].map(executeQuery(cql, prepare, extractor))(handleSingleResult)