spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JoshRosen <>
Subject [GitHub] spark pull request #13504: [SPARK-15762][SQL] Cache Metadata & StructType ha...
Date Sat, 04 Jun 2016 21:13:22 GMT
Github user JoshRosen commented on a diff in the pull request:
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/types/Metadata.scala ---
    @@ -104,7 +104,8 @@ sealed class Metadata private[types] (private[types] val map: Map[String,
    -  override def hashCode: Int = Metadata.hash(this)
    +  private lazy val _hashCode: Int = Metadata.hash(this)
    +  override def hashCode: Int = _hashCode
    --- End diff --
    Making `hashCode` into a `lazy val` triggers compilation errors and triggers Scalastyle's
"You should implement equals and hashCode together" error; it also causes problems in Scala
code which calls `.hashCode()`:
    [error] /Users/joshrosen/Documents/spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala:247:
type mismatch;
    [error]  found   : AttributeReference.this.metadata.type (with underlying type org.apache.spark.sql.types.Metadata)
    [error]  required: ?{def hashCode(): ?}
    [error] Note that Metadata extends Any, not AnyRef.
    [error] Such types can participate in value classes, but instances
    [error] cannot appear in singleton types or in reference comparisons.
    [error]     h = h * 37 + metadata.hashCode()
    [error]                  ^
    [error] /Users/joshrosen/Documents/spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala:247:
Int does not take parameters
    [error]     h = h * 37 + metadata.hashCode()
    [error]                                   ^
    [error] two errors found
    [error] /Users/joshrosen/Documents/spark/sql/catalyst/src/main/scala/org/apache/spark/sql/types/Metadata.scala:41:13:
You should implement equals and hashCode together

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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message