Skip to content

Commit ef9af3d

Browse files
committed
address comments
1 parent 94d8c81 commit ef9af3d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

python/pyspark/sql/tests/test_dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def test_drop(self):
200200
self.assertEqual(df.drop(col("name"), col("age")).columns, ["active"])
201201
self.assertEqual(df.drop(col("name"), col("age"), col("random")).columns, ["active"])
202202

203-
def test_drop_II(self):
203+
def test_drop_notexistent_col(self):
204204
df1 = self.spark.createDataFrame(
205205
[("a", "b", "c")],
206206
schema="colA string, colB string, colC string",

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ColumnResolutionHelper.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,9 @@ trait ColumnResolutionHelper extends Logging with DataTypeErrorsBase {
509509
includeLastResort = includeLastResort)
510510
}
511511

512-
// Tries to resolve `UnresolvedAttribute` by the children with Plan Ids.
512+
// Try to resolve `UnresolvedAttribute` by the children with Plan Ids.
513513
// Returns `None` if fail to resolve.
514-
private[sql] def tryResolveUnresolvedAttributeByPlanChildren(
514+
private[sql] def tryResolveColumnByPlanChildren(
515515
u: UnresolvedAttribute,
516516
q: LogicalPlan,
517517
includeLastResort: Boolean = false): Option[Expression] = {

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveDataFrameDropColumns.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
package org.apache.spark.sql.catalyst.analysis
1919

20+
import org.apache.spark.sql.catalyst.SQLConfHelper
2021
import org.apache.spark.sql.catalyst.plans.logical.{DataFrameDropColumns, LogicalPlan, Project}
21-
import org.apache.spark.sql.catalyst.rules.Rule
2222
import org.apache.spark.sql.catalyst.trees.TreePattern.DF_DROP_COLUMNS
2323
import org.apache.spark.sql.connector.catalog.CatalogManager
2424

@@ -27,9 +27,9 @@ import org.apache.spark.sql.connector.catalog.CatalogManager
2727
* Note that DataFrameDropColumns allows and ignores non-existing columns.
2828
*/
2929
class ResolveDataFrameDropColumns(val catalogManager: CatalogManager)
30-
extends Rule[LogicalPlan] with ColumnResolutionHelper {
30+
extends SQLConfHelper with ColumnResolutionHelper {
3131

32-
override def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsWithPruning(
32+
def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsWithPruning(
3333
_.containsPattern(DF_DROP_COLUMNS)) {
3434
case d: DataFrameDropColumns if d.childrenResolved =>
3535
// expressions in dropList can be unresolved, e.g.
@@ -39,7 +39,7 @@ class ResolveDataFrameDropColumns(val catalogManager: CatalogManager)
3939
if (u.getTagValue(LogicalPlan.PLAN_ID_TAG).nonEmpty) {
4040
// Plan ID comes from Spark Connect,
4141
// here we ignore the column if fail to resolve by plan Id.
42-
tryResolveUnresolvedAttributeByPlanChildren(u, d)
42+
tryResolveColumnByPlanChildren(u, d)
4343
} else {
4444
Some(resolveExpressionByPlanChildren(u, d))
4545
}

0 commit comments

Comments
 (0)