Questions tagged [scala]
Scala is a general-purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both imperative and functional programming styles. Its key features are: an advanced static type system with type inference; function types; pattern-matching; implicit parameters and conversions; operator overloading; full interoperability with Java; concurrency
scala
112,647
questions
0
votes
0
answers
33
views
Jetty 12 with Scala "Unable to locate class corresponding to inner class entry for Scope"
After upgrading jetty-server from 11 to 12, the compilation (using mill as the build tool) fails with:
Unable to locate class corresponding to inner class entry for Scope in owner org.eclipse.jetty....
1
vote
1
answer
59
views
Scala 3 macros: "dynamically" instantiating singleton objects at compile-time
I'm trying to create a macro that makes use of some objects.
Suppose I have the following definitions:
trait Foo:
def doStuff(): Unit
// in other files
object Bar extends Foo:
def doStuff() = ......
0
votes
0
answers
76
views
Importing libraries with same names
I have two libraries that both follow the same names for importing, but one has more functionality than the other. How do I make scala choose the right library to use when importing? Currently, it’s ...
0
votes
1
answer
29
views
Comparing impact of Scala PlayFramework's db.withConnection and db.withTransaction methods on the underlying postgres database
Given that there is just one simple SQL statement (example: select id from foo) that I need to execute on my Postgres 15 database, I am curious to know the performance impact of executing it using ...
0
votes
0
answers
33
views
Spark : Read special characters from the content of dat file without corrupting it in scala
I have to read all the special characters in some dat file (e.g.- testdata.dat) without being corrupted and initialise it into a dataframe in scala using spark.
I have one dat file (eg - testdata.dat),...
0
votes
1
answer
30
views
Use Jedis `echo` in pipeline
The examples use Scala code, but the issue would be the same with Java.
Way back in version 2 of Jedis, you could use echo in a pipeline:
import redis.clients.jedis._
object Main {
def main(args: ...
1
vote
1
answer
39
views
Scala 2 to Scala 3: Instantiating a trait no longer recognises new methods
The following code compiles and runs in Scala 2:
trait SomeTrait {
val myName: String
}
class SomeClass() extends SomeTrait {
override val myName: String = "Billy Banana"
}
val ...
1
vote
0
answers
28
views
Creating a custom aggregator in spark with window rowsBetween?
What I'm trying to do is use a window function to get the last and current row and do some computation on a couple of the columns with a custom aggregator. I have time series data with points that are ...
1
vote
0
answers
60
views
Mocking is not working with Pekko. Instead of fulfilling request from mocking, it's hitting actual database
When we were using Akka Actors, and while using it, our mocking and testing was working fine. Now we switched to Pekko Actors, and while using it, our mocking is not working because sending request ...
0
votes
0
answers
150
views
Is it safe run blocking call in OS executor when using virtual thread?
When using virtual thread, can I safely use a separate thread pool while interacting with a library we don't have a control over, such as HikariCP DB connection manager, which uses synchronized blocks,...
0
votes
2
answers
68
views
Compilation Error: Instance not found: Conversion[models.Errorcode, _ <: Product] on Scala 3 Playframework
I've been recently migrating a playframework project from scala2 to scala3, and I found this error that only happens in scala 3 but it doesnt happen in scala 2:
play.sbt.PlayExceptions$...
1
vote
0
answers
31
views
More Parallelism Than Expected in Glue ETL Spark Job
I am using Glue ETL Spark jobs to run some tests. I am trying to understand why I am getting more parallel processing than the available cores on a single executor.
Here's my job config:
I setting ...
0
votes
0
answers
55
views
Scala 2.13 migration from 2.12 bring Conflicting cross-version suffixes in: org.scala-lang.modules:scala-parser-combinators
While I am trying to migrate scala project from 2.12 to 2.13 , I am getting the below error with following stracktrace
java.lang.RuntimeException: Conflicting cross-version suffixes in: org.scala-...
0
votes
1
answer
44
views
Scala circe: encode List to json as flat string
The task is to encode:
List(1,2,3)
to the the following string:
[1,2,3]
By applying io.circe.asJson - function:
List(1,2,3).asJson
I receive the following output:
[
1,
2,
3
]
What am I ...
0
votes
0
answers
37
views
Issue with proto object defining isEmpty
we've got this protobuffer object definition (and we cannot modify it)
...
message Condition {
oneof condition_one_of {
FieldCondition field = 1;
IsEmptyCondition is_empty = 2;
...