Skip to content

Tag: scala

is scala OpenHashMap remove operator threadsafe

Sorry but I cannot find in the network a direct answer to a very simple questions. is scala OpenHashMap remove operator threadsafe? Regrds. Answer Seems it is not thread safe: Scala OpenHashMap def: Ref link: https://alvinalexander.com/java/jwarehouse/scala-2.11/library/scala/collection/mutable/OpenHashMap.sc…

Apache spark and scala, error while executing queries

I am working with a dataset whose sample is as follows: I have executed the following commands successfully: I am getting following error: java.lang.RuntimeException: Error while encoding: java.lang.RuntimeException: java.lang.Character is not a valid external type for schema of string I am getting the same e…

NoSuchMethodError in shapeless seen only in Spark

I am trying to write a Spark connector to pull AVRO messages off a RabbitMQ message queue. When decoding the AVRO messages, there is a NoSuchMethodError error that occurs only when running in Spark. I could not reproduce the Spark code exactly outside of spark, but I believe the two examples are sufficiently …

Java Array vs Scala Array

Seems one difference between Java Array and Scala Array is Java Array is co variant. Scala Array is not. Both are mutable. In java, sort method can take different arrays, such as arrays of String or Int. This is often quoted as a good example of Liskov substitution principle. Seems a good design to me? In Sca…