Skip to content

Resolve scalatest warnings during build - #1032

Closed
witgo wants to merge 1 commit into
apache:masterfrom
witgo:ShouldMatchers
Closed

witgo wants to merge 1 commit into
apache:masterfrom
witgo:ShouldMatchers

Conversation

@witgo

@witgo witgo commented Jun 10, 2014

Copy link
Copy Markdown
Contributor

No description provided.

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished.

@AmplabJenkins

Copy link
Copy Markdown

Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/15609/

@pwendell

Copy link
Copy Markdown
Contributor

Jenkins, retest this please.

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished.

@AmplabJenkins

Copy link
Copy Markdown

Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/15617/

@witgo

witgo commented Jun 10, 2014

Copy link
Copy Markdown
Contributor Author

@pwendell jenkins still has some issue

@pwendell

Copy link
Copy Markdown
Contributor

Jenkins, retest this please.

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@pwendell

Copy link
Copy Markdown
Contributor

LGTM pending tests, thanks for cleaning this up

@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/15652/

@pwendell

Copy link
Copy Markdown
Contributor

Thanks - merged.

@asfgit asfgit closed this in c48b622 Jun 11, 2014
@witgo
witgo deleted the ShouldMatchers branch June 11, 2014 03:25
pdeyhim pushed a commit to pdeyhim/spark-1 that referenced this pull request Jun 25, 2014
Author: witgo <witgo@qq.com>

Closes apache#1032 from witgo/ShouldMatchers and squashes the following commits:

7ebf34c [witgo] Resolve scalatest warnings during build
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
Author: witgo <witgo@qq.com>

Closes apache#1032 from witgo/ShouldMatchers and squashes the following commits:

7ebf34c [witgo] Resolve scalatest warnings during build
wangyum added a commit that referenced this pull request May 26, 2023
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Oct 27, 2026
…exists (apache#1032)

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

Two lines in `sql/varka/matrix/skips.tsv`. They skip the coverage rows `CAST(y1 AS INT) * CAST(y2 AS INT)` and `CAST(s1 AS INT) * CAST(s2 AS INT)` of `VarkaCoverageDifferentialSuite` under the option-matrix configuration `validityByWidth=false`. The reason is the one their family's other rows already give there.

### Why are the changes needed?

Under `validityByWidth=false` no int lane count is baked into the kernel, so a `TINYINT` or `SMALLINT` column has no widening load. The compiler then declines these two rows and the row engine answers them, by design. Under the defaults both rows fuse, so the option matrix's check that a test still fuses fails on them. The rows started fusing under the defaults with the change that fuses narrow values beside wider lanes. The last option matrix on master ran before that change, so master's next scheduled run would fail on these two tests.

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

No. The change affects only which tests the option matrix runs under one configuration.

### How was this patch tested?

The option matrix on the open TIMESTAMP_NTZ change (fork run 40294304006, shard 11) failed exactly these two tests under `validityByWidth=false`, with the plan showing the declined row. The option matrix is dispatched on this branch to confirm that the configuration passes, with no stale skip line. Test time: none added.

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

Generated-by: Claude Code (Opus 5.5)
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Oct 27, 2026
…TE (apache#1031)

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

Varka's vector kernels now read `TIMESTAMP_NTZ` columns. They compare them, test them for null, choose between them, write them back, and cast them to and from `DATE`, with the row engine's answers in LEGACY, ANSI and TRY. The zoned `TIMESTAMP` is still declined.

A `TIMESTAMP_NTZ` value is a signed count of microseconds since the epoch, with no zone. Varka's 64-bit lane already holds `BIGINT`, `TIME` and day-time intervals in that form, so most of this change is admission:

- The type registry's `TIMESTAMP_NTZ` entry moves from "owed" to the 64-bit lane.
- The evaluator reads and writes the type through Spark's `TimeStampMicroVector`. That is a different class from the zoned type's `TimeStampMicroTZVector`, so no zoned column is admitted.

With that, the comparisons, `<=>`, `IS [NOT] NULL`, `greatest`, `least`, `CASE`, `IF` and `coalesce` fuse through the lane's existing nodes. `IN` and its optimizer form `InSet` needed a 64-bit twin of the int lane's chain of equality tests, written for this type only. `BIGINT`'s `IN` is still declined on purpose.

The two casts are built from existing IR nodes:

- **`CAST(d AS TIMESTAMP_NTZ)`** widens the day to 64 bits and multiplies it by the microseconds of a day, under a range guard of ±106,751,991 days. Spark computes this cast with `Math.multiplyExact` in every mode, so a day past that bound raises under LEGACY and ANSI, and `try_cast` turns the error into a null. The lane has no checked multiply. So the guard sends a batch holding such a day to the row engine, which raises or nulls on that row. Inside the guard the wrapping multiply is exact, and the other batches stay on the kernel.
- **`CAST(ntz AS DATE)`** is `Math.floorDiv(t, 86,400,000,000)`, which cannot fail. 86,400,000,000 is 2^13 × 10,546,875, so the kernel computes it as follows:
  - an arithmetic shift right by 13;
  - a move of a negative value down by 10,546,874, so that the next division floors;
  - the lane's truncating constant division by 10,546,875.

  That division is exact only for dividends under 2^52. After the shift the dividend is under 2^50 + 10,546,875, so it is exact for every long. The helper (`floorDivLong`) is shared with the date fields of `TIMESTAMP_NTZ`, which come next.

The type conformance contract, the shared suite of seven checks each landed type must pass, now also runs kernels on the 64-bit lane. `VarkaTimestampNtzConformanceSuite` holds the new type to it. The int, bigint, date, time and interval suites that the contract still owes can use the same path.

The differential test harness's error comparison now allows one JVM effect. Once a `Math.*Exact` overflow has trapped often enough at one call site, C2 throws a preallocated `ArithmeticException` with no message there (`inline_math_mathExact` in HotSpot). So the row engine's overflow reads "long overflow" in a cold JVM and has no message in a hot one, depending on what ran before. The new cast test failed on that under one option configuration. A missing message on an otherwise equal `ArithmeticException` now counts as the same error. Errors with a condition, subclasses and two different messages are still compared in full, and a test pins the rule.

### Why are the changes needed?

A query over a `TIMESTAMP_NTZ` column ran entirely on Spark's row engine. Even a filter like `ts > TIMESTAMP_NTZ'2021-01-01 00:00:00'` beside fused date predicates left a row filter over every row. Comparing a date with a timestamp has the same effect, because Spark casts the date to `TIMESTAMP_NTZ` first. `TIMESTAMP_NTZ` is one of the types the current milestone adds, and its arithmetic and its date and time fields build on this lane and on the cast's floor division.

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

Queries that compare, choose, test or cast `TIMESTAMP_NTZ` values, or compare a `DATE` with a `TIMESTAMP_NTZ`, are now served by Varka's kernels where they used to decline. Answers and errors are unchanged: they match the row engine's in all three modes. `EXPLAIN` no longer shows the decline reason "the TIMESTAMP_NTZ lane is row 338's".

### How was this patch tested?

- **Proofs.** `sql/varka/proofs/long_divide.smt2` adds 10,546,875 to the divisors whose constant division is proven exact under 2^52. It also proves four claims over every 64-bit `x`:
  - the shift right by 63 is the sign;
  - the composition equals `Math.floorDiv(x, 86.4e9)`;
  - its dividend is under the bound the compiler states;
  - its quotient fits an int.

  Z3 and cvc5 both prove the file: 983 checks, in 32 s and 9 s.
- **`VarkaTimestampNtzCastSuite` (new).**
  - It reads the guard and the multiplier from the compiled tree and holds them to the exact overflow condition over every int day, in all three modes. It also runs `multiplyExact` itself over a million days at each end of the guard and in the middle.
  - It runs the kernels at the guard's ends and one day past them.
  - It runs `CAST(ntz AS DATE)` at `Long.MIN_VALUE`, `Long.MAX_VALUE`, -1, 0 and ±1 day with their neighbours, against Spark and `java.time`.
  - It pins the decline reason of `year(ntz)`, which still declines.
- **`VarkaTimestampNtzSuite` (new, through queries).** It runs `CAST` and `try_cast` at the guard's ends. A day past the guard raises under LEGACY and ANSI. Under `try_cast` it declines exactly one batch of three and nulls that row. The cast to `DATE` gives `java.time`'s day at the 64-bit range's ends.
- **`VarkaTimestampNtzConformanceSuite` (new).** The values are the 64-bit range's ends, the guard's day boundaries and the first microsecond past them. Its cast row is cancelled after the cast to `DATE` runs, because the casts to `TIME` are not built yet.
- **Coverage.** 19 new coverage rows run through the differential suites against the row engine. Both test fixtures derive two NTZ columns from a date and a time column.
- **Flipped tests.** The two tests that pinned the type's decline now hold the NTZ case fused, and the zoned case declined.
- **No existing emitted method moved:** the byte oracle changed only by new shapes, before and after the merge with master. The census, the cast register, the width audit and the type table are regenerated.
- **The full laptop gate passes on the merge with master**: both vector widths, the sweeps, docs, benchmarks, lint (Error Prone, `lint-java`, scalastyle) and the quote check. An independent review found no wrong answer; its findings, weak test checks and stale comments, are fixed here.
- **Option matrix (CI).** An earlier partial run found five failures under `lanesOverride=4` and `narrowHalfSpecies=true`: the new suites' kernels need a second int vector species, which the shared test JVM refuses, so both suites now run in JVMs of their own. It also found two narrow-type rows failing under `validityByWidth=false`, which master fixed separately (apache#1032). The full matrix, all 51 configurations, passes on GitHub CI on the harness fix (run 40459480249); its run before the fix failed only in the messageless `ArithmeticException` case the fix allows.
- **Test time.** The gate's wide and narrow steps took 1,613 and 1,649 s, against `sql/varka/ci/step-budget.tsv`'s medians of 708 and 707 s, which predate most of the current suites. The new suites add about 30 s.

### 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