Github user nongli commented on a diff in the pull request:
https://github.com/apache/spark/pull/10498#discussion_r48588450
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala ---
@@ -189,13 +205,44 @@ final class DataFrameWriter private[sql](df:
DataFrame) {
ifNotExists = false)).toRdd
}
- private def normalizedParCols: Option[Seq[String]] =
partitioningColumns.map { parCols =>
- parCols.map { col =>
- df.logicalPlan.output
- .map(_.name)
- .find(df.sqlContext.analyzer.resolver(_, col))
- .getOrElse(throw new AnalysisException(s"Partition column $col not
found in existing " +
- s"columns (${df.logicalPlan.output.map(_.name).mkString(",
")})"))
+ private def normalizedParCols: Option[Seq[String]] =
partitioningColumns.map { cols =>
+ cols.map(normalize(_, "Partition"))
+ }
+
+ private def normalizedBucketCols: Option[Seq[String]] =
bucketingColumns.map { cols =>
+ cols.map(normalize(_, "Bucketing"))
+ }
+
+ private def normalizedSortCols: Option[Seq[String]] = sortingColumns.map
{ cols =>
+ cols.map(normalize(_, "Sorting"))
+ }
+
+ private def getBucketSpec: Option[BucketSpec] = {
+ if (numBuckets.isEmpty && sortingColumns.isDefined) {
+ throw new IllegalArgumentException("Specify numBuckets and bucketing
columns first.")
--- End diff --
This error message is not quite right. The order of bucketBy and sortBy
doesn't matter right?
e.g.
df.write.bucketBy().sortBy() and df.write.sortBy.bucketBy both work?
Should be something like sortBy requires bucketBy.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]