Michael Smith has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/21550 )

Change subject: IMPALA-12800: Implement hashCode everywhere
......................................................................

IMPALA-12800: Implement hashCode everywhere

Fixes a regression in earlier IMPALA-12800 commits where two decimal
ScalarTypes could be equal, but have different hash codes. That led to
different lookup behavior, where iterating through lhs_ (the old method)
would find a similar expression via equals, but when looking up via the
substitutions_ map it would resolve a different hash code and return
null (no match). That caused analysis to fail on statements that used
the same cast-to-decimal expression twice, as one of them would fail to
find a result in ExprSubstitutionMap and lead to an unbound slot

  ERROR: AnalysisException: select list expression not produced by
  aggregation output (missing from GROUP BY clause?): <expr>...

Overrides hashCode on every class that overrides equals to avoid other
cases that might be untested, and avoid similar mistakes in the future.
https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html
requires "If two objects are equal according to the equals(Object)
method, then calling the hashCode method on each of the two objects must
produce the same integer result", which requires an explicit hashCode
implementation anywhere we override equals.

Adds a unit test covering the regression.

Change-Id: I129bff6fd0968be135e23e0b24e273b2ea384eca
Reviewed-on: http://gerrit.cloudera.org:8080/21550
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Michael Smith <[email protected]>
---
M fe/src/main/java/org/apache/impala/analysis/ColumnDef.java
M fe/src/main/java/org/apache/impala/analysis/Expr.java
M fe/src/main/java/org/apache/impala/analysis/PlanHint.java
M fe/src/main/java/org/apache/impala/catalog/ArrayType.java
M fe/src/main/java/org/apache/impala/catalog/IcebergStructField.java
M fe/src/main/java/org/apache/impala/catalog/MapType.java
M fe/src/main/java/org/apache/impala/catalog/ScalarType.java
M fe/src/main/java/org/apache/impala/catalog/StructField.java
M fe/src/main/java/org/apache/impala/catalog/StructType.java
M fe/src/main/java/org/apache/impala/catalog/TopicUpdateLog.java
M fe/src/main/java/org/apache/impala/catalog/Type.java
M fe/src/main/java/org/apache/impala/planner/DataPartition.java
M fe/src/test/java/org/apache/impala/analysis/AnalyzeExprsTest.java
13 files changed, 109 insertions(+), 2 deletions(-)

Approvals:
  Impala Public Jenkins: Looks good to me, approved
  Michael Smith: Verified

--
To view, visit http://gerrit.cloudera.org:8080/21550
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I129bff6fd0968be135e23e0b24e273b2ea384eca
Gerrit-Change-Number: 21550
Gerrit-PatchSet: 8
Gerrit-Owner: Michael Smith <[email protected]>
Gerrit-Reviewer: Abhishek Rawat <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jason Fehr <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Kurt Deschler <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>

Reply via email to