Skip to content

SPARK-2148 Add link to requirements for custom equals() and hashcode() methods - #1092

Closed
ash211 wants to merge 1 commit into
apache:masterfrom
ash211:SPARK-2148
Closed

ash211 wants to merge 1 commit into
apache:masterfrom
ash211:SPARK-2148

Conversation

@ash211

@ash211 ash211 commented Jun 15, 2014

Copy link
Copy Markdown
Contributor

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished. All automated tests passed.

@AmplabJenkins

Copy link
Copy Markdown

All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/15806/

@pwendell

Copy link
Copy Markdown
Contributor

Looks good - thanks Andrew! I'll merge this. I'm also going to make the small change of adding a period to the end of the sentence.

asfgit pushed a commit that referenced this pull request Jun 16, 2014
…) methods

https://issues.apache.org/jira/browse/SPARK-2148

Author: Andrew Ash <andrew@andrewash.com>

Closes #1092 from ash211/SPARK-2148 and squashes the following commits:

93513df [Andrew Ash] SPARK-2148 Add link to requirements for custom equals() and hashcode() methods
(cherry picked from commit 9672ee0)

Signed-off-by: Patrick Wendell <pwendell@gmail.com>
@asfgit asfgit closed this in 9672ee0 Jun 16, 2014
pdeyhim pushed a commit to pdeyhim/spark-1 that referenced this pull request Jun 25, 2014
…) methods

https://issues.apache.org/jira/browse/SPARK-2148

Author: Andrew Ash <andrew@andrewash.com>

Closes apache#1092 from ash211/SPARK-2148 and squashes the following commits:

93513df [Andrew Ash] SPARK-2148 Add link to requirements for custom equals() and hashcode() methods
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
…) methods

https://issues.apache.org/jira/browse/SPARK-2148

Author: Andrew Ash <andrew@andrewash.com>

Closes apache#1092 from ash211/SPARK-2148 and squashes the following commits:

93513df [Andrew Ash] SPARK-2148 Add link to requirements for custom equals() and hashcode() methods
sunchao pushed a commit to sunchao/spark that referenced this pull request Dec 8, 2021
Adding parquet-kms lib, with PME KMS clients and Apple CryptoFactory

these classes were removed from parquet-mr-apple. PME won't work without them.

No

running locally
wangyum pushed a commit that referenced this pull request May 26, 2023
…rtitioning and sortorder with respect to aliases to avoid unneeded exchange/sort nodes (#1092)

* [SPARK-31078][SQL] Respect aliases in output ordering

Currently, in the following scenario, an unnecessary `Sort` node is introduced:
```scala
withSQLConf(SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "0") {
  val df = (0 until 20).toDF("i").as("df")
  df.repartition(8, df("i")).write.format("parquet")
    .bucketBy(8, "i").sortBy("i").saveAsTable("t")
  val t1 = spark.table("t")
  val t2 = t1.selectExpr("i as ii")
  t1.join(t2, t1("i") === t2("ii")).explain
}
```
```
== Physical Plan ==
*(3) SortMergeJoin [i#8], [ii#10], Inner
:- *(1) Project [i#8]
:  +- *(1) Filter isnotnull(i#8)
:     +- *(1) ColumnarToRow
:        +- FileScan parquet default.t[i#8] Batched: true, DataFilters: [isnotnull(i#8)], Format: Parquet, Location: InMemoryFileIndex[file:/..., PartitionFilters: [], PushedFilters: [IsNotNull(i)], ReadSchema: struct<i:int>, SelectedBucketsCount: 8 out of 8
+- *(2) Sort [ii#10 ASC NULLS FIRST], false, 0    <==== UNNECESSARY
   +- *(2) Project [i#8 AS ii#10]
      +- *(2) Filter isnotnull(i#8)
         +- *(2) ColumnarToRow
            +- FileScan parquet default.t[i#8] Batched: true, DataFilters: [isnotnull(i#8)], Format: Parquet, Location: InMemoryFileIndex[file:/..., PartitionFilters: [], PushedFilters: [IsNotNull(i)], ReadSchema: struct<i:int>, SelectedBucketsCount: 8 out of 8
```
Notice that `Sort [ii#10 ASC NULLS FIRST], false, 0` is introduced even though the underlying data is already sorted. This is because `outputOrdering` doesn't handle aliases correctly. This PR proposes to fix this issue.

To better handle aliases in `outputOrdering`.

Yes, now with the fix, the `explain` prints out the following:
```
== Physical Plan ==
*(3) SortMergeJoin [i#8], [ii#10], Inner
:- *(1) Project [i#8]
:  +- *(1) Filter isnotnull(i#8)
:     +- *(1) ColumnarToRow
:        +- FileScan parquet default.t[i#8] Batched: true, DataFilters: [isnotnull(i#8)], Format: Parquet, Location: InMemoryFileIndex[file:/..., PartitionFilters: [], PushedFilters: [IsNotNull(i)], ReadSchema: struct<i:int>, SelectedBucketsCount: 8 out of 8
+- *(2) Project [i#8 AS ii#10]
   +- *(2) Filter isnotnull(i#8)
      +- *(2) ColumnarToRow
         +- FileScan parquet default.t[i#8] Batched: true, DataFilters: [isnotnull(i#8)], Format: Parquet, Location: InMemoryFileIndex[file:/..., PartitionFilters: [], PushedFilters: [IsNotNull(i)], ReadSchema: struct<i:int>, SelectedBucketsCount: 8 out of 8
```

Tests added.

Closes #27842 from imback82/alias_aware_sort_order.

Authored-by: Terry Kim <yuminkim@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>

* [SPARK-33399][SQL] Normalize output partitioning and sortorder with respect to aliases to avoid unneeded exchange/sort nodes

This pull request tries to remove unneeded exchanges/sorts by normalizing the output partitioning and sortorder information correctly with respect to aliases.

Example: consider this join of three tables:

     |SELECT t2id, t3.id as t3id
     |FROM (
     |    SELECT t1.id as t1id, t2.id as t2id
     |    FROM t1, t2
     |    WHERE t1.id = t2.id
     |) t12, t3
     |WHERE t1id = t3.id

The plan for this looks like:

      *(9) Project [t2id#1034L, id#1004L AS t3id#1035L]
      +- *(9) SortMergeJoin [t1id#1033L], [id#1004L], Inner
         :- *(6) Sort [t1id#1033L ASC NULLS FIRST], false, 0
         :  +- Exchange hashpartitioning(t1id#1033L, 5), true, [id=#1343]   <------------------------------
         :     +- *(5) Project [id#996L AS t1id#1033L, id#1000L AS t2id#1034L]
         :        +- *(5) SortMergeJoin [id#996L], [id#1000L], Inner
         :           :- *(2) Sort [id#996L ASC NULLS FIRST], false, 0
         :           :  +- Exchange hashpartitioning(id#996L, 5), true, [id=#1329]
         :           :     +- *(1) Range (0, 10, step=1, splits=2)
         :           +- *(4) Sort [id#1000L ASC NULLS FIRST], false, 0
         :              +- Exchange hashpartitioning(id#1000L, 5), true, [id=#1335]
         :                 +- *(3) Range (0, 20, step=1, splits=2)
         +- *(8) Sort [id#1004L ASC NULLS FIRST], false, 0
            +- Exchange hashpartitioning(id#1004L, 5), true, [id=#1349]
               +- *(7) Range (0, 30, step=1, splits=2)

In this plan, the marked exchange could have been avoided as the data is already partitioned on "t1.id". This happens because AliasAwareOutputPartitioning class handles aliases only related to HashPartitioning. This change normalizes all output partitioning based on aliasing happening in Project.

To remove unneeded exchanges.

No

New UT added.

On TPCDS 1000 scale, this change improves the performance of query 95 from 330 seconds to 170 seconds by removing the extra Exchange.

Closes #30300 from prakharjain09/SPARK-33399-outputpartitioning.

Authored-by: Prakhar Jain <prakharjain09@gmail.com>
Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>

* [CARMEL-6306] Fix ut

* [CARMEL-6306] Fix alias not compatible with ebay skew implementation

Co-authored-by: Terry Kim <yuminkim@gmail.com>
Co-authored-by: Prakhar Jain <prakharjain09@gmail.com>
udaynpusa pushed a commit to mapr/spark that referenced this pull request Jan 30, 2024
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Oct 28, 2026
…' bytes (apache#1092)

### What changes were proposed in this pull request?

The option matrix, the CI workflow that reruns the Varka suites once per emit-option configuration, stops rerunning tree cases that the defaults run has already checked. This applies to the two suites that run IR trees.

- **The rule.** A tree case's answer depends only on its emitted class and its inputs. The reference evaluator reads the tree and the batch, and the kernel checker reads no options. So when a configuration emits a case to the same bytes as the defaults do, the defaults run has already compared that exact class on those exact inputs. The new `VarkaReach.ranAtDefaults` makes this call for a case. If the options are equal, it skips the case without emitting anything. Otherwise it emits the case again under the defaults' options, to the same class name, and compares the bytes. If the defaults decline the case, it runs.
- **`VarkaSmallTreeSuite`.** Its three series (int trees, long trees, and multi-root value trees) filter their cases this way. The planted liveness test, which has to find its planted fault, does not filter.
- **`VarkaIrFuzzSuite`.** Its C2 history test, which takes nine tenths of the suite's time, draws options per case on top of the matrix's base options. Every option it draws comes from the same coin over either base. So it redraws each case over the defaults and skips the draws whose options match. It compares options only, never bytes, because this test's checker reads `exactRefusalStatus` while a kernel runs.
- **The tally.** Under a configuration, each suite prints one `VARKA_REACH` line: the cases skipped for equal options, those skipped for equal bytes, and those that ran.
- **`VarkaReachSuite`** tests the filter against a planted arm. `misdescribeAdd=true` changes the bytes of `date_add` and not those of `date_sub`, and only the first runs. It is left out of the matrix, like the matrix's other self-tests.
- **Row 507** records the step.

### Why are the changes needed?

The matrix takes over an hour of wall time, and the target is 20 to 30 minutes. `VarkaSmallTreeSuite` and `VarkaIrFuzzSuite` are 8.5 of its roughly 40 configuration-hours. Most configurations change only a few of their trees, but every configuration reran all of them.

### Does this PR introduce _any_ user-facing change?

No. Tests only.

### How was this patch tested?

- `VarkaReachSuite` passes.
- On the laptop, with the series at size 4:

  | Configuration | Series | Trees that ran | IR fuzzer |
  |---|---:|---:|---:|
  | defaults | 139 s | all | 186 s |
  | `cse=false` | 39 s | 7,902 of 149,771 | 16 s |
  | `division=DOUBLE_DIV` | 125 s | | |
  | `validityByWidth=false` | 156 s | all | |
  | `lanesOverride=4` | 159 s | all | |
  | `groupBudget=64` | | | 141 s |

- **The cost.** A configuration that changes every tree pays for the second emission, 12 to 14% on the series. A later change can skip that emission for such configurations.
- **The coverage trade-off.** C2 compiles a class according to what it compiled before. Under a configuration, the fuzzer's surviving draws now meet a sparser history than the full sequence did. Each class's own answer is still checked in the defaults run, in its original order, but no configuration replays the defaults' full history any more. The project's owner accepted this trade-off on 28 October 2026.
- The dispatched matrix on this branch gives each configuration's tally and the time saved on CI.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5.5)
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.

3 participants