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,624
questions
0
votes
0
answers
48
views
Unable to mock Scala object
I have started working in Scala very recently. I have below code in the main method that I'll need to mock for writing test cases,
object SacSAAgentSoftwareLogParser extends SparkSessionCreation {
...
-1
votes
0
answers
25
views
udf to transform a json string into multiple rows based on first level of nesting
I am trying to transform a df based on the first level nesting in the json string.
input dataframe
+------+------------------------------------+---------------------------------------------------------...
0
votes
1
answer
48
views
spark.sql() giving error : org.apache.spark.sql.catalyst.parser.ParseException: Syntax error at or near '('(line 2, pos 52)
I have class LowerCaseColumn.scala where one function is defined as below :
override def registerSQL(): Unit = spark.sql(
"""
|CREATE OR REPLACE TEMPORARY ...
1
vote
0
answers
50
views
SAML Login with Scala application as SP with pac4j-saml
I have a scala service which would act like the SP and would like to provide users to authenticate using SAML, for which I am using pac4j-saml version 6.0.2. The IdP that I am using is keycloak.
I ...
-1
votes
0
answers
57
views
Scala/SBT/Java - When running app locally with java 21 getting InaccessibleObjectException
Hi all I am using scala version 2.12.18, sbt version 1.9.0 and java jdk 21.0.3. When trying to run my application locally through
sbt run -Dconfig.resource=local-qa.conf
I am getting this error:
[...
0
votes
1
answer
49
views
Scala 3: Nonexhaustive match for Vector, but not for Seq
Using Scala 3.4.2:
Vector(1, 2, 3) match
case Vector() => println("empty")
case _ :+ last => println(s"last: $last")
gives me an (in my opinion incorrect) ...
0
votes
1
answer
29
views
Hot Reloading Scala.js
How to hot reload in scala.js application while in development
I am manually reloading the Scala.js application during development. However, I need the ability to reload and immediately reflect the ...
1
vote
0
answers
46
views
Get compiler to notice exhaustive match on Vector
The following code defines an exhaustive match over a Vector, v.
def testExhaustiveness(v: Vector[Int]) = {
v match {
case Vector() => println("v is empty")
case ns :+ n => ...
0
votes
1
answer
58
views
+50
How to create data-frame on rocks db (SST files)
We hold our documents in rocks-db. We will be syncing these rocks-db sst files to S3. I would like to create a dataframe on the SST files and later run an sql. When googled, I was not able to find any ...
0
votes
0
answers
42
views
How to force pull in fs2.Stream
I created an fs2.Stream with:
topic <- Stream.eval(fs2.concurrent.Topic[F, Either[Throwable, AmqpMessage[Array[Byte]]]])
messages <- Stream.resource(topic.subscribeAwait(innerQueueSize))
...
2
votes
1
answer
100
views
Test/compile not finding lib/jar with Scala 3 (but 2.13 works)
I'm packaging jars from generated source code with an sbt-plugin and the jars are fine and on the classpath.
Now I have two identical minimal projects targeting Scala 2.13 and 3.3. With 2.13 I can run ...
1
vote
0
answers
48
views
Akka to Pekko Migration and Grpc
Heeey all,
I'm doing a Akka to Pekko migration of a pet project (I'm learning scala atm). So far everything went smooth but there is one thing that I can't get fixed and the grpc plugin.
In my build....
0
votes
1
answer
39
views
Scala 3 binary compatibility issue
As I am moving to help my organization adopt scala 3, i am trying to map out the potential chanllenge to look after.
Generally, i was readying about binary compatibility change with scala 3 and ...
1
vote
1
answer
47
views
Scala Future strange behavior
What's wrong with this code? Why I can see only one output? What returns futureUserByName function? onComplete doesn't work for it as well. It must be just simple Future, but it doesn't work.
import ...
0
votes
0
answers
22
views
Flattening nested json with back slash in apache spark scala Dataframe
{
"messageBody": "{\"task\":{\"taskId\":\"c6d9fb0e-42ba-4a3e-bd39-f2a32a6958c1\",\"serializedTaskData\":\"{\\\"clientId\\\":\\\&...