Skip to content

[SPARK-1812] sql/catalyst - Provide explicit type information - #1709

Closed
avati wants to merge 1 commit into
apache:masterfrom
avati:SPARK-1812-notnull
Closed

avati wants to merge 1 commit into
apache:masterfrom
avati:SPARK-1812-notnull

Conversation

@avati

@avati avati commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

For Scala 2.11 compatibility.

Without the explicit type specification, withNullability
return type is inferred to be Attribute, and thus calling
at() on the returned object fails in these tests:

[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:370: value at is not a
[ERROR] val c4_notNull = 'a.boolean.notNull.at(3)
[ERROR] ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:371: value at is not a
[ERROR] val c5_notNull = 'a.boolean.notNull.at(4)
[ERROR] ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:372: value at is not a
[ERROR] val c6_notNull = 'a.boolean.notNull.at(5)
[ERROR] ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:558: value at is not a
[ERROR] val s_notNull = 'a.string.notNull.at(0)

Signed-off-by: Anand Avati avati@redhat.com

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@marmbrus

marmbrus commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

These tests shouldn't be using scala NotNull, but catalyst's .notNull.

@avati

avati commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

These tests shouldn't be using scala NotNull, but catalyst's .notNull
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala#L199
.

Hmm, now that I look more carefully what you say makes sense. Trying to
figure out why notNull (catalyst's) was not found when compiling with Scala
2.11. The missing scala.NotNull in 2.11 was just a close coincidence I
think.

@marmbrus

marmbrus commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

Mind closing this PR if its not an issue then? Thanks!

@avati

avati commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

Mind closing this PR if its not an issue then? Thanks!

The description of the cause (scala.NotNull trait removal in 2.11) might be
wrong, but those tests are still failing with Scala 2.11. I'm still
investigating.

@marmbrus

marmbrus commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

Ah, thanks for the clarification.

@avati

avati commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

This is the exact failure. The error is actually missing at() method
encountered in Scala 2.11

[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:370:
value at is not a member of
org.apache.spark.sql.catalyst.expressions.Attribute
[ERROR] val c4_notNull = 'a.boolean.notNull.at(3)
[ERROR] ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:371:
value at is not a member of
org.apache.spark.sql.catalyst.expressions.Attribute
[ERROR] val c5_notNull = 'a.boolean.notNull.at(4)
[ERROR] ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:372:
value at is not a member of
org.apache.spark.sql.catalyst.expressions.Attribute
[ERROR] val c6_notNull = 'a.boolean.notNull.at(5)
[ERROR] ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:558:
value at is not a member of
org.apache.spark.sql.catalyst.expressions.Attribute
[ERROR] val s_notNull = 'a.string.notNull.at(0)
[ERROR] ^

@marmbrus

marmbrus commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

It is possibly a change with type inference / implicit conversions?

@avati

avati commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

It is possibly a change with type inference / implicit conversions?

Likely. What is the expected type which is supposed to have 'def at()',
that line of code is assuming?

@marmbrus

marmbrus commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

at should be added by this implicit conversion

@avati

avati commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

@marmbrus

marmbrus commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

I haven't looked closely but if we can make it work by specifying more generic explicit return types to our implicits that seems like a good approach.

@avati

avati commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

Yeah, I was thinking:

  def notNull: AttributeReference = a.withNullability(false)

For Scala 2.11 compatibility.

Without the explicit type specification, withNullability
return type is inferred to be Attribute, and thus calling
at() on the returned object fails in these tests:

[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:370: value at is not a member of org.apache.spark.sql.catalyst.expressions.Attribute
[ERROR]     val c4_notNull = 'a.boolean.notNull.at(3)
[ERROR]                                         ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:371: value at is not a member of org.apache.spark.sql.catalyst.expressions.Attribute
[ERROR]     val c5_notNull = 'a.boolean.notNull.at(4)
[ERROR]                                         ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:372: value at is not a member of org.apache.spark.sql.catalyst.expressions.Attribute
[ERROR]     val c6_notNull = 'a.boolean.notNull.at(5)
[ERROR]                                         ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:558: value at is not a member of org.apache.spark.sql.catalyst.expressions.Attribute
[ERROR]     val s_notNull = 'a.string.notNull.at(0)

Signed-off-by: Anand Avati <avati@redhat.com>
@avati avati changed the title [SPARK-1812] sql/catalyst - remove scala.NotNull related tests [SPARK-1812] sql/catalyst - Provide explicit type information Aug 1, 2014
@avati

avati commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

@marmbrus - this latest patch fixes the Scala 2.11 compilation breakage

@marmbrus

marmbrus commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

test this please

@SparkQA

SparkQA commented Aug 1, 2014

Copy link
Copy Markdown

QA tests have started for PR 1709. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17693/consoleFull

@SparkQA

SparkQA commented Aug 1, 2014

Copy link
Copy Markdown

QA results for PR 1709:
- This patch FAILED unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17693/consoleFull

@avati

avati commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

The failures seem to be odd and unrelated to the patch itself.

@marmbrus

marmbrus commented Aug 2, 2014

Copy link
Copy Markdown
Contributor

test this please

@SparkQA

SparkQA commented Aug 2, 2014

Copy link
Copy Markdown

QA tests have started for PR 1709. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17730/consoleFull

@SparkQA

SparkQA commented Aug 2, 2014

Copy link
Copy Markdown

QA results for PR 1709:
- This patch PASSES unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17730/consoleFull

@asfgit asfgit closed this in 08c095b Aug 2, 2014
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
For Scala 2.11 compatibility.

Without the explicit type specification, withNullability
return type is inferred to be Attribute, and thus calling
at() on the returned object fails in these tests:

[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:370: value at is not a
[ERROR]     val c4_notNull = 'a.boolean.notNull.at(3)
[ERROR]                                         ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:371: value at is not a
[ERROR]     val c5_notNull = 'a.boolean.notNull.at(4)
[ERROR]                                         ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:372: value at is not a
[ERROR]     val c6_notNull = 'a.boolean.notNull.at(5)
[ERROR]                                         ^
[ERROR] /Users/avati/work/spark/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala:558: value at is not a
[ERROR]     val s_notNull = 'a.string.notNull.at(0)

Signed-off-by: Anand Avati <avatiredhat.com>

Author: Anand Avati <avati@redhat.com>

Closes apache#1709 from avati/SPARK-1812-notnull and squashes the following commits:

0470eb3 [Anand Avati] SPARK-1812: sql/catalyst - Provide explicit type information
sunchao added a commit to sunchao/spark that referenced this pull request Jun 2, 2023
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 25, 2026
…apache#1709)

* [VARKA] Plan: correct rows 103, 351 and 414 for merged upstream fixes

Three plan records describe Spark as it was before upstream fixes that are
merged now. SPARK-60743 (on master since apache#1482) ended the int narrowing of the
six-field make_timestamp_ntz's seconds that VARKA-351 planned to copy, and
answered its upstream-filing flag. SPARK-60746 (since apache#1427) made the two
error classes of dt / -1 one, which VARKA-103 still described. SPARK-61352
merged upstream on 24 November 2026: VARKA-414 gave its pull request's old
title and a copyTagsFrom rule that runs the other way from the merged one, as
upstream's tests show, and named two of the three declines left to lift.
Row 351's PLAN.md line is left alone, since apache#1707 edits the adjacent row 350.

Generated-by: Claude Code (Claude Opus 5.5)

* [VARKA] Plan: fix the review findings on the upstream-fix corrections

Row 351's PLAN.md line now carries its own correction, as the change that
produces it should, and VARKA-351's open point about leaving it is dropped.
VARKA-351 2.6 states that the bad-field mask takes precedence over the micros
sum's FAIL, since without the narrowing a bad lane's seconds can make the sum
overflow where Spark rejects the fields first, and names the test for it; the
TRY form's NULL now cites the golden files that show it. The debt register
entry and row 414 record what SPARK-61352's merge leaves to close. VARKA-103
says the first of item 8's facts was refuted rather than settled, cites
IntervalMathUtils.divide's current overloads and marks its older line
citations as pre-SPARK-60746. VARKA-414 gives SPARK-61352's branch-4.x and
release-branch commits.

Generated-by: Claude Code (Claude Opus 5.5)

---------

Co-authored-by: t <t@example.com>
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