Top "Scala" questions

Scala is a general-purpose programming language principally targeting the Java Virtual Machine.

How to use java.String.format in Scala?

I am trying to use a .format method of a string. But if I place %1, %2, etc. in the string, java.…

java string scala format
How can I change column types in Spark SQL's DataFrame?

Suppose I'm doing something like: val df = sqlContext.load("com.databricks.spark.csv", Map("path" -> "cars.csv", "header" …

scala apache-spark apache-spark-sql
Spark - load CSV file as DataFrame?

I would like to read a CSV in spark and convert it as DataFrame and store it in HDFS with …

scala apache-spark hadoop apache-spark-sql hdfs
How to convert rdd object to dataframe in spark

How can I convert an RDD (org.apache.spark.rdd.RDD[org.apache.spark.sql.Row]) to a Dataframe org.…

scala apache-spark apache-spark-sql rdd
How to sort by column in descending order in Spark SQL?

I tried df.orderBy("col1").show(10) but it sorted in ascending order. df.sort("col1").show(10) also sorts in descending …

scala apache-spark apache-spark-sql
Write single CSV file using spark-csv

I am using https://github.com/databricks/spark-csv , I am trying to write a single CSV, but not able to, …

scala csv apache-spark spark-csv
How to print the contents of RDD?

I'm attempting to print the contents of a collection to the Spark console. I have a type: linesWithSessionId: org.apache.…

scala apache-spark
Get item in the list in Scala?

How in the world do you get just an element at index i from the List in scala? I tried …

scala
Read entire file in Scala?

What's a simple and canonical way to read an entire file into memory in Scala? (Ideally, with control over character …

scala
Appending an element to the end of a list in Scala

I can't add an element of type T into a list List[T]. I tried with myList ::= myElement but it …

arrays scala