Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented Dec 22, 2018

What changes were proposed in this pull request?

Variation of #20500
I cheated by not referencing fields or columns at all as this exception propagates in contexts where both would be applicable.

How was this patch tested?

Existing tests

@MaxGekk
Copy link
Member

MaxGekk commented Dec 22, 2018

Is it related to SQL not to CORE?

throw new IllegalArgumentException(
s"""Nonexistent field(s): ${nonExistFields.mkString(", ")}.
|Available fields: ${fieldNames.mkString(", ")}""".stripMargin)
s"""${nonExistFields.mkString(", ")} do not exist.
Copy link
Member

Choose a reason for hiding this comment

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

nonExistFields can contain only one element, right? Maybe do/does?

@SparkQA
Copy link

SparkQA commented Dec 22, 2018

Test build #100401 has finished for PR 23373 at commit e2e1c4c.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member Author

srowen commented Dec 22, 2018

I think the issue is that these exceptions could pop up in several places, including anywhere you'd use a dataframe with columns. It probably applies to lots of places. I can change the tag here but won't matter for anything really

@srowen srowen changed the title [SPARK-14023][CORE] Don't reference 'field' in StructField errors for clarity in exceptions [SPARK-14023][CORE][SQL] Don't reference 'field' in StructField errors for clarity in exceptions Dec 22, 2018
@SparkQA
Copy link

SparkQA commented Dec 22, 2018

Test build #100404 has finished for PR 23373 at commit 9979df7.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

s"""Field "$name" does not exist.
|Available fields: ${fieldNames.mkString(", ")}""".stripMargin))
s""""$name" does not exist.
|Available: ${fieldNames.mkString("\"", "\", \"", "\"")}""".stripMargin))
Copy link
Member

Choose a reason for hiding this comment

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

Can we keep the original form instead of adding additional " here?

scala> val s = org.apache.spark.sql.types.StructType.fromDDL("`\"` INT")
s: org.apache.spark.sql.types.StructType = StructType(StructField(",IntegerType,true))

scala> s("a")
java.lang.IllegalArgumentException: "a" does not exist.
Available: """

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll remove quotes around all versions of this exception.

@dongjoon-hyun
Copy link
Member

Mostly looks good except the additional ".

cc @cloud-fan , @gatorsmile

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM (Pending Jenkins). Thanks!

@SparkQA
Copy link

SparkQA commented Dec 24, 2018

Test build #100413 has finished for PR 23373 at commit fb74c83.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

Merged to master.

@asfgit asfgit closed this in 0523f5e Dec 24, 2018
@srowen srowen deleted the SPARK-14023.2 branch January 2, 2019 04:22
holdenk pushed a commit to holdenk/spark that referenced this pull request Jan 5, 2019
…s for clarity in exceptions

## What changes were proposed in this pull request?

Variation of apache#20500
I cheated by not referencing fields or columns at all as this exception propagates in contexts where both would be applicable.

## How was this patch tested?

Existing tests

Closes apache#23373 from srowen/SPARK-14023.2.

Authored-by: Sean Owen <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
…s for clarity in exceptions

## What changes were proposed in this pull request?

Variation of apache#20500
I cheated by not referencing fields or columns at all as this exception propagates in contexts where both would be applicable.

## How was this patch tested?

Existing tests

Closes apache#23373 from srowen/SPARK-14023.2.

Authored-by: Sean Owen <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants