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

[SPARK-51496][SQL][FOLLOW-UP] Preserve the case of DataSourceV2Relation option keys #50487

Closed
wants to merge 1 commit into from
Closed
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 @@ -63,7 +63,7 @@ object V2Writes extends Rule[LogicalPlan] with PredicateHelper {
}.toArray

val table = r.table
val writeOptions = mergeOptions(options, r.options.asScala.toMap)
val writeOptions = mergeOptions(options, r.options.asCaseSensitiveMap.asScala.toMap)
val writeBuilder = newWriteBuilder(table, writeOptions, query.schema)
val write = writeBuilder match {
case builder: SupportsTruncate if isTruncate(predicates) =>
Expand All @@ -79,7 +79,7 @@ object V2Writes extends Rule[LogicalPlan] with PredicateHelper {

case o @ OverwritePartitionsDynamic(r: DataSourceV2Relation, query, options, _, None) =>
val table = r.table
val writeOptions = mergeOptions(options, r.options.asScala.toMap)
val writeOptions = mergeOptions(options, r.options.asCaseSensitiveMap.asScala.toMap)
val writeBuilder = newWriteBuilder(table, writeOptions, query.schema)
val write = writeBuilder match {
case builder: SupportsDynamicOverwrite =>
Expand All @@ -93,7 +93,8 @@ object V2Writes extends Rule[LogicalPlan] with PredicateHelper {
case WriteToMicroBatchDataSource(
relationOpt, table, query, queryId, options, outputMode, Some(batchId)) =>
val writeOptions = mergeOptions(
options, relationOpt.map(r => r.options.asScala.toMap).getOrElse(Map.empty))
options,
relationOpt.map(r => r.options.asCaseSensitiveMap.asScala.toMap).getOrElse(Map.empty))
val writeBuilder = newWriteBuilder(table, writeOptions, query.schema, queryId = queryId)
val write = buildWriteForMicroBatch(table, writeBuilder, outputMode)
val microBatchWrite = new MicroBatchWrite(batchId, write.toStreaming)
Expand All @@ -105,14 +106,14 @@ object V2Writes extends Rule[LogicalPlan] with PredicateHelper {
case rd @ ReplaceData(r: DataSourceV2Relation, _, query, _, projections, _, None) =>
val rowSchema = projections.rowProjection.schema
val metadataSchema = projections.metadataProjection.map(_.schema)
val writeOptions = mergeOptions(Map.empty, r.options.asScala.toMap)
val writeOptions = mergeOptions(Map.empty, r.options.asCaseSensitiveMap.asScala.toMap)
val writeBuilder = newWriteBuilder(r.table, writeOptions, rowSchema, metadataSchema)
val write = writeBuilder.build()
val newQuery = DistributionAndOrderingUtils.prepareQuery(write, query, r.funCatalog)
rd.copy(write = Some(write), query = newQuery)

case wd @ WriteDelta(r: DataSourceV2Relation, _, query, _, projections, None) =>
val writeOptions = mergeOptions(Map.empty, r.options.asScala.toMap)
val writeOptions = mergeOptions(Map.empty, r.options.asCaseSensitiveMap.asScala.toMap)
val deltaWriteBuilder = newDeltaWriteBuilder(r.table, writeOptions, projections)
val deltaWrite = deltaWriteBuilder.build()
val newQuery = DistributionAndOrderingUtils.prepareQuery(deltaWrite, query, r.funCatalog)
Expand Down