Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create dataframe from list instead of RDD #363

Draft
wants to merge 1 commit into
base: spark-3.5.1
Choose a base branch
from
Draft
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 @@ -7,6 +7,8 @@ package org.apache.spark.sql

import java.util.Locale

import scala.collection.JavaConverters._

import com.amazonaws.services.glue.model.{AccessDeniedException, AWSGlueException}
import com.amazonaws.services.s3.model.AmazonS3Exception
import com.fasterxml.jackson.databind.ObjectMapper
Expand Down Expand Up @@ -177,12 +179,16 @@ trait FlintJobExecutor {
startTime: Long,
timeProvider: TimeProvider,
cleaner: Cleaner): DataFrame = {
// Create the schema dataframe
val schemaRows = result.schema.fields.map { field =>
Row(field.name, field.dataType.typeName)
}
// collect schema rows as List
val schemaRows = result.schema.fields
.map { field =>
Row(field.name, field.dataType.typeName)
}
.toList
.asJava

val resultSchema = spark.createDataFrame(
spark.sparkContext.parallelize(schemaRows),
schemaRows,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this process all data on driver node?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, only schema.

StructType(
Seq(
StructField("column_name", StringType, nullable = false),
Expand Down
Loading