Function Currying and Object-Oriented Programming in Scala
Function Currying
Currying transforms a function with multiple arguments into a series of functions each taking a single argument. This technique essentially creates closures.
package com.example.functions
object CurryingExample {
def main(args: Array[String]): Unit = {
// Basic function to find the larger of two integers
def largerV ...
Posted on Thu, 17 Sep 2026 16:36:00 +0000 by donbonzo
Implementing a Local SVM Classifier with Apache Spark MLlib
The input dataset follows a pipe-delimited format where the first field represents the binary class label, followed by a comma-separated list of numerical features. This structure maps directly to Spark’s LabeledPoint type, which expects a double-precision label paired with a dense feature vector.
A representative sample of the training set inc ...
Posted on Fri, 07 Aug 2026 16:59:20 +0000 by thryb
Common Methods for Converting Spark RDD to DataFrame
This approach leverages Spark's implicit conversinos to infer column names from case class attributes.
import org.apache.spark.sql.SparkSession
val spark = SparkSession.builder()
.appName("RDDConversionExample")
.master("local[*]")
.getOrCreate()
import spark.implicits._
case class User(id: Int, username: String, sc ...
Posted on Mon, 18 May 2026 18:57:46 +0000 by ThunderAI
Deep Dive into Kafka's Log Management Component
Architecture OverviewKafka's internal codebase is organized into distinct modules, each handling specific responsibilities. The server-side code implements the Broker's core mechanics, encompassing log persistence, controller logic, coordinator management, metadata state machines, delayed operations, consumer group oversight, and high-concurren ...
Posted on Sat, 16 May 2026 15:27:21 +0000 by DataRater
Mastering Error Handling in Scala: Traditional Exceptions vs. The Try Monad
Imperative Exception Control
Scala inherits its exception hierarchy from the JVM but deliberately omits checked exceptions. Unlike Java, Scala functions never require explicit throws declarations in their signatures. Runtime errors are propagated using the throw keyword, which evaluates to type Nothing, allowing seamless integration with contro ...
Posted on Thu, 14 May 2026 15:44:17 +0000 by ramu_rp2005
Setting Up a Standalone Hadoop and Spark Environment
System Requirements
Operating System: CentOS 7 (virtual machine)
CPU: 2 cores
Memory: 2 GB
Disk: 40 GB
Software Versions
JDK: 1.8 (jdk-8u144-linux-x64.tar.gz)
Hadoop: 2.8.2 (hadoop-2.8.2.tar.gz)
Scala: 2.12.2 (scala-2.12.2.tgz)
Spark: 1.6.3 (spark-1.6.3-bin-hadoop2.4-without-hive.tgz)
Initial System Configuration
Set Hostname
hostnamectl set- ...
Posted on Wed, 13 May 2026 15:09:50 +0000 by tracy
Common Uses of the Underscore in Scala
Importing All Members from a Package
The underscore can import every member of a package or object.
import scala.io._
Default Value Initialization for Variables
Assigns the default value for a type to a var field.
class Container {
var itemLabel: String = _
var itemCount: Int = _
}
Tuple Element Access
Access elements of a tuple using the ...
Posted on Tue, 12 May 2026 18:11:42 +0000 by burge124
Configuring and Running Spark SQL with Hive Integration
To build a Spark distribution compatible with Hadoop CDH 5.7.0 and Hive support, navigate to the Spark source directory:
[hadoop@hadoop001 spark-2.1.0]$ pwd
/home/hadoop/source/spark-2.1.0
Compile using Maven with profiles for YARN, Hadoop 2.6, Hive, and Hive Thriftserver:
./build/mvn -Pyarn -Phadoop-2.6 -Phive -Phive-thriftserver \
-Dhadoop ...
Posted on Thu, 07 May 2026 02:26:00 +0000 by kporter.porter