Repository navigation
[SPARK-1720][SPARK-1719] Add the value of LD_LIBRARY_PATH to the java opts "java.library.path" - #1031
[SPARK-1720][SPARK-1719] Add the value of LD_LIBRARY_PATH to the java opts "java.library.path" #1031witgo wants to merge 3 commits into
Conversation
witgo
commented
Jun 10, 2014
- Standalone
- YARN
- Mesos
- Test cases
|
Merged build triggered. |
|
Merged build started. |
|
Merged build finished. |
|
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/15607/ |
|
Jenkins, retest this please. |
|
Merged build triggered. |
|
Merged build started. |
|
Merged build finished. All automated tests passed. |
|
All automated tests passed. |
|
Just curious -- will this patch change how users specify paths to native libraries on the worker machines? (I think the current way is to set |
|
Jenkins, retest this please. |
|
Merged build triggered. |
|
Merged build started. |
|
Merged build triggered. |
|
Merged build started. |
|
Merged build finished. All automated tests passed. |
1 similar comment
|
Merged build finished. All automated tests passed. |
|
All automated tests passed. |
|
All automated tests passed. |
|
QA tests have started for PR 1031. This patch merges cleanly. |
|
QA results for PR 1031: |
|
QA tests have started for PR 1031. This patch merges cleanly. |
|
QA results for PR 1031: |
|
Does this work cross-platform? I think OSX uses |
|
QA tests have started for PR 1031 at commit
|
|
QA tests have finished for PR 1031 at commit
|
|
Test PASSed. |
There was a problem hiding this comment.
I'm not a fan of the name of this method. Maybe "libraryPathScriptVar"? (Ugly but less cryptic.)
|
This LGTM (but there are merge conflicts again...) @andrewor14 @pwendell could one of you guys take a look at this? Thanks! |
|
QA tests have started for PR 1031 at commit
|
|
QA tests have finished for PR 1031 at commit
|
|
Test PASSed. |
|
sorry perhaps I'm missing something, why are we adding the value of LD_LIBRARY_PATH to the java.library.path and not just using LD_LIBRARY_PATH like proposed in the jira(s)? |
|
The current solution is simple to implement.If we don't do so,we have to change a lot of existing code. |
|
Hey @tgravescs I actually don't mind capturing |
|
I haven't looked at the code to fully understand what all changes would be required and why its so much more complex. So if it makes the implementation much simpler then I guess its a step in the right direction. Are you thinking we will have a followup to move to using LD_LIBRARY_PATH or thinking its not necessary? |
|
OK so I was thinking about this some more and I'm not sure how much the current change will help. @pwendell have you seen specific requests from other users? If so what was the problem they were seeing? So I'm not 100% on all of these as I haven't specifically tested these but from what I've read on the MR jira my understanding is:
Perhaps we should write a quick test program to make sure the above are true. I'm not sure if this would be different between java version but it probably wouldn't hurt to check. |
|
I wrote a small test for this; it uses three implementations of the same native library that print different things, and a small java class to call it. This is the output: So Tom's observation that setting So, perhaps, even if it's more code, using |
|
Ok, I'll try to use LD_LIBRARY_PATH. |
…y.path - [X] Standalone - [X] YARN - [X] Mesos - [X] Mac OS X - [X] Linux - [ ] Windows This is another implementation about #1031 Author: GuoQiang Li <witgo@qq.com> Closes #2711 from witgo/SPARK-1719 and squashes the following commits: c7b26f6 [GuoQiang Li] review commits 4488e41 [GuoQiang Li] Refactoring CommandUtils a444094 [GuoQiang Li] review commits 40c0b4a [GuoQiang Li] Add buildLocalCommand method c1a0ddd [GuoQiang Li] fix comments 156ce88 [GuoQiang Li] review commit 38aa377 [GuoQiang Li] Refactor CommandUtils.scala 4269e00 [GuoQiang Li] Refactor SparkSubmitDriverBootstrapper.scala 7a1d634 [GuoQiang Li] use LD_LIBRARY_PATH instead of -Djava.library.path
…tistics if it is foldable expression (#1031) ### What changes were proposed in this pull request? This PR adds support estimate column statistics if it is foldable expression. For example: estimate the `'a' AS a`'s column statistics from `SELECT 'a' AS a FROM tbl`. 1. If the foldable expression is null: ```scala ColumnStat(Some(0), None, None, Some(rowCount), Some(size), Some(size), None, 2) ``` 2. If the foldable expression is not null: ```scala ColumnStat(Some(1), Some(value), Some(value), Some(0), Some(size), Some(size), None, 2) ``` ### Why are the changes needed? Improve column statistics. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Unit test. Closes #37421 from wangyum/SPARK-39989. Lead-authored-by: Yuming Wang <yumwang@ebay.com> Co-authored-by: Yuming Wang <wgyumg@gmail.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit d77bc70)
…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)
### What changes were proposed in this pull request? A plan for reading the fields of a `TIMESTAMP_NTZ` in Varka's kernels, `sql/varka/plans/m8/VARKA-340.md`: the date fields (`year`, `month`, `day`, `quarter`, `dayofyear`, `weekofyear`, `last_day`, `trunc` and their `extract` forms), `hour`, `minute`, `second`, the casts with `TIME`, and `make_timestamp_ntz(date, time)`. The milestone plan's row opens with its state, and row 339's plan gets a dated note on the helper the two rows share. The plan starts from a check of today's code and of Spark's own, with a file and line for each fact. The facts that shape it: - **The fields are total.** A `TIMESTAMP_NTZ` is a long of microseconds read at UTC, and every field is defined for every long, so a field kernel fuses or hands a batch to Spark's row engine, and never raises. Only `make_timestamp_ntz` - and the `TIME` to `TIMESTAMP_NTZ` cast, which Spark rewrites into it - can overflow the long. Where Spark drops digits it truncates. - **No new IR node.** The day is the exact floor division by a day that the `TIMESTAMP_NTZ` cast to `DATE` already uses and proves; the time of day is the remainder; the date fields go through the existing calendar decomposition at the int lane, so one kernel crosses from the long lane to the int lane. No emitted byte of an existing kernel moves. - **The guard.** The calendar nodes need their day inside the calendar's range with a year of room below it, because the week forms and a field over `trunc` shift the day down; a batch with a day outside goes to the row engine. Row 339's plan had planned a tighter guard for the same helper, under which `weekofyear` would decline; the dated note there moves both rows to this one. - **The current date.** `CAST(time AS TIMESTAMP_NTZ)` is rewritten with the query's date as a literal; the plan passes it as a runtime argument outside the kernel's cache key, so one compiled kernel serves every date, and a test runs the same query under two time zones 26 hours apart to prove each answers its own date. Two points the first draft asked are settled by the row text: `SECOND`'s decimal output belongs to the row that builds decimal outputs, and the faster Granlund-Montgomery division is recorded but not built, since JDK 25's Vector API has no 64-bit high multiply. A baseline benchmark lands first as its own pull request. ### Why are the changes needed? `TIMESTAMP_NTZ` columns are read by Varka since apache#1031, but extracting their fields still runs on Spark's row engine, and the date fields over them are pinned as declining. The plan sets out the design, the guard and the proofs before any code is written. ### Does this PR introduce _any_ user-facing change? No. Plan documents only. ### How was this patch tested? `dev/varka_plan_lint.py --check` and `dev/varka_quote_check.py` pass. An independent review checked every claim against the code and against Spark's expressions and `DateTimeUtils`, rechecked the division constants by exact arithmetic, and found the cross-plan gap with row 339 and a claim about `trunc` wider than the code, all corrected here. Test time: none. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
…pache#1063) ### What changes were proposed in this pull request? Holds the six types Varka fused before its type conformance contract existed - `INT`, `BIGINT`, `DATE`, `TIME`, and the year-month and day-time intervals - to that contract, and moves `TIMESTAMP_NTZ`'s suite onto the same base. The contract (`VarkaTypeConformance`) runs the same checks on every type: an Arrow round trip, ordering, null handling, a choice, the overflow behaviour of the type's arithmetic, its casts and `IN`. Each new suite runs the checks whose forms Varka fuses for that type; a check whose form is not fused yet is cancelled, naming the row that owes it, after the forms it does fuse have run and agreed with Spark. The census check (`dev/varka_census.py`), which compares what the compiler fuses with what the census claims, now owes nothing for these types. What the first runs found and changed: - **Census drift.** The compiler fused forms the census did not claim - `<=>` on all six types, the choice forms on `TIME` and both intervals, `coalesce` on `BIGINT`, `+` on the year-month interval, `try_add` and `try_subtract` on `INT`. They get 17 coverage rows, and the generated files are regenerated; no existing kernel's emitted bytes changed. - **The reference evaluator and a narrowing cast.** At the long lane the reference evaluator did not truncate a narrowing root, so a LEGACY `CAST(bigint AS INT)` disagreed with Spark. The conformance path, which compares against Spark's answers, now truncates there; the fuzz and IR entry points, which have no Spark answer, still see an out-of-range value as a difference. - **A check that compared almost nothing.** The interval null-handling check's pair overflowed on almost every batch, so only a lone all-null row was ever answered. Pair forms now carry values of their own that cannot overflow, and a new check holds the batches actually answered to the same rule as the fixture. - **Own JVMs.** `INT`, `BIGINT`, `TIME`, the day-time interval and `DATE` (whose cast to `TIMESTAMP_NTZ` fuses since apache#1031) run in JVMs of their own, since a kernel of both the int and the long lane needs a second vector species, which the shared test JVM refuses under the option matrix's lane-pinning configurations. - **Owed work recorded.** An ANSI narrowing cast's in-range answers are still not compared with Spark's (only its declines are); the owner put this into row 332's done-when. ANSI `int *` maps to row 95 through a small hand-kept table, since the census cannot say "fused in LEGACY only". ### Why are the changes needed? A type is only trusted once it passes the same checks as every other type. These six were built before the checks existed, and holding them to the checks found real drift between what the compiler fuses and what the census and documentation claim, and a test harness gap that made one disagreement with Spark invisible. ### Does this PR introduce _any_ user-facing change? No. Test code, coverage rows, generated documentation and plan documents only; no engine code changes. ### How was this patch tested? The ten conformance suites, the IR fuzz, small-tree and guard-edge suites, the coverage suite and the emitted-bytes suite pass (90 passed, 29 cancelled with their rows, 0 failed). The local option-matrix runner over the conformance suites passes at the defaults, `lanesOverride=4` and `narrowHalfSpecies=true`. The census check, `varka_new_lane.py --check`, the plan lint, the quote check, `varka_errorprone.sh`, `dev/lint-java` and `dev/lint-scala` pass. An independent review checked the reference change against Spark for every narrowing root, every cancellation's reason, the merge with apache#1031 and the coverage rows; its findings are addressed here. The full option matrix runs on this branch. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5.5)
…che#1564) ### What changes were proposed in this pull request? Varka's coverage table (`sql/varka/coverage.json`, written by `VarkaCoverageSuite`) holds a `columns` map: the 35 columns its rows read, each with its SQL type, in declaration order. Two other catalyst test sources, the emitted-bytes oracle (`VarkaEmittedBytesSuite`) and the width audit (`VarkaWidthAuditShapes`), did not read that map. Each declared the same 35 columns again by hand. This change removes both copies: - `VarkaCoverageRows.columns(path)` reads the map by walking the JSON object's fields in the order they are written. The order matters: a column's position is a kernel's input ordinal, and ordinals are part of the bytes the oracle pins. The older reader went through json4s's `extract[Map[String, String]]`, and a Scala `Map` of more than four entries does not keep insertion order. `VarkaCoverageRows.read` now uses the new method too. - `VarkaEmittedBytesSuite` and `VarkaWidthAuditShapes` take their columns from the file they compile the rows of. The audit's `parsedRow`, `resolvedRow` and `predicateRow` take the columns as a parameter. - If a coverage row does not parse or resolve against the file's columns, the bytes oracle now fails, with the row's SQL and the resolver's reason (for a missing column, `unknown column <name>`). Before, such a row went into `coverage_rows_skipped` and nothing failed. The rendered file keeps `"coverage_rows_skipped" : [ ]`, so `emitted_bytes.json` is byte-identical. - The two sql/core fixtures that build data tables for the coverage rows check those tables against the map. Every table of `VarkaCoverageDifferentialSuite` must hold every column at its type. `VarkaSparkFuzz`'s fixture must hold the 18 columns its draws read: its draws leave out rows over BOOLEAN, TINYINT/SMALLINT and DECIMAL columns, so it builds only the other columns. - `dev/varka_new_lane.py` no longer checks the width audit's copy as one of a new type's sites, and `sql/varka/ADDING_A_TYPE.md` step 11 says a new column goes in three places instead of five. ### Why are the changes needed? A column missing from one of the copies caused no failure. During the `TIMESTAMP_NTZ` work (apache#1031), the bytes suite's copy lacked the new columns. Every row over them failed to resolve and went quietly into `coverage_rows_skipped`, so those rows were not pinned. The gap only came to light when the width audit's probe crashed on the same missing columns. With one source for the columns, that gap cannot happen. A row that still fails to resolve now fails the suite and names the missing column. ### Does this PR introduce _any_ user-facing change? No. Test sources, a dev script and a contributor guide only. ### How was this patch tested? On the laptop, one sbt command at a time: - `VarkaCoverageSuite`, the new test "coverage.json's columns read back in the order and at the types this suite declares them": passed. - `VarkaEmittedBytesSuite` and `VarkaWidthAuditSuite`: 14 passed. 2 were canceled: the option and pairs audits, which are opt-in through `VARKA_OPTION_AUDIT`, the same as on master. This run includes the new planted-table test: a row over a column `q` that the table's map lacks fails the oracle, naming the row and `unknown column q`. - `git diff --exit-code` over `emitted_bytes.json`, `width_audit.json` and `coverage.json` exits 0. Both pinned files depend on column order, so this also checks that the new reader keeps it. - `VarkaCoverageCompositionFuzzSuite`, `VarkaGroupingBoundSuite` and `VarkaDivisorProofSuite`, the other readers of `VarkaCoverageRows`, passed at their committed seeds. If the old reader did lose the column order, a seed copied from an older log may now draw different shapes. Their verdicts do not depend on the order. - The two new sql/core tests: passed, and after the review's fixes the fuzz one again, with "the draw includes every row of the table", which exercises the shared filter. - `dev/varka_new_lane.py --check`: every line reports no missing site, and each type reports "(2 checked)". Review: `/code-review high` on the branch, run twice: once on the first commit, once on the fix round. The first run's findings: It found six points, none a wrong answer: - The old reader's order was very likely hash order: json4s's `extract[Map]` builds an immutable `Map`, which is a hash map at 35 entries. This was inferred, not measured. So the three fuzz-style readers now compile against different ordinals. They still pass, but a seed logged before this change no longer reproduces the same shape. This is stated here and scored in the plan. - The fuzz fixture test copied the draw filter. It now uses `VarkaSparkFuzz.leftOut`, which `coverageRows` uses too. - The test's count of 18 columns is kept on purpose: without it, a filter that left out every column would pass. Its message says to move the count, and `ADDING_A_TYPE.md` step 11 mentions it. - The always-empty skip list's regeneration comparison looked live. A comment now says the key is kept only so the file's bytes stay the same. - A guide line over 100 columns was rewrapped. - Kept as it is (it predates this change): `VarkaCoverageRows`' `readsBoolean`, `readsNarrow` and `readsDecimal` regexes still name columns by hand. Deriving them from the map's types would be a follow-up. The second run, on the fix round, found nothing that changes behaviour. Its wording fixes were applied: comments, the count's message, `leftOut`'s doc and the plan record. Step 11 now also names the regexes. Kept as it is: `leftOut` restates the composition fuzzer's three filters rather than reading `VarkaCoverageRows.compositionFilters`, because the two fuzzers' exclusions may legitimately part ways once VARKA-352 draws the narrow types. Owed: CI (the PR Build), and the whole `VarkaCoverageDifferentialSuite` and `VarkaSparkFuzzSuite`. Only their new tests ran locally, because nothing else in those two suites changed. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5)