Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- end }}

{{ define `dbr_version` -}}
16.3
16.4
{{- end }}

{{ define `scala_major_minor_version` -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ object Main {
println("Showing nyctaxi trips ...")
val nycTaxi = new NycTaxi(spark)
val df = nycTaxi.trips()

// Define a simple UDF that formats the passenger count as a string
val testudf = udf((count: String) => s"test: $count")

// Apply the UDF to the passenger_count column
val transformedDF = df.withColumn("testresult", testudf(F.col("dropoff_zip")))

// Show the transformed DataFrame
transformedDF.show()
df.show()
}

def getSession(): SparkSession = {
Expand All @@ -39,6 +31,7 @@ object Main {
println("Running outside Databricks")
DatabricksSession.builder()
.serverless()
.validateSession(false)
.addCompiledArtifacts(Main.getClass.getProtectionDomain.getCodeSource.getLocation.toURI)
.getOrCreate()
}
Expand Down