Wrong result when using `ROW()` function inside a named expression
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- backend
調査の方向性
named-expressions.spec.ts に用意されている再現ケースから始め、名前付き式の中で ROW() を使って HyperFormula.buildFromArray と buildFromSheets を実行します。基本例と中程度の例を実行し、その後、数式の直接的な結果と名前付き式の結果を比較します。行に対して相対的な値で両方のアサーションセットがパスすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
I am seeing unexpected results with Named Expressions.
Given an expression
const getRowExpression = "=ROW()"
And a Named Expression registered on sheet 0
engine.addNamedExpression('GetRowNumber', getRowExpression, 0)
The following usage returns different results
const engine = HyperFormula.buildFromArray([
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
])
A1:A5 => [0, 1, 2, 3, 4, 5]
B1:B5 => [2, 2, 2, 2, 2, 2]
I expected these values to be equal.
You can see a full example on JSFiddle (hyperformula-named-references-bug)
Or you can drop the following unit test into hyperformula/test/named-expressions.spec.ts on either the hyperformula::master or hyperformula:develop branches
describe('bug', () => {
it('basic example', () => {
const getRowExpression = "=ROW()"
const engine = HyperFormula.buildFromArray([
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
[getRowExpression, "=GetRowNumber"],
])
engine.addNamedExpression('GetRowNumber', getRowExpression, 0)
console.log(engine.getRangeValues(AbsoluteCellRange.spanFrom(adr('A1', 0), 2, 5)))
expect(engine.getCellValue(adr('A1', 0))).toEqual(1)
expect(engine.getCellValue(adr('A2', 0))).toEqual(2)
expect(engine.getCellValue(adr('A3', 0))).toEqual(3)
expect(engine.getCellValue(adr('A4', 0))).toEqual(4)
expect(engine.getCellValue(adr('A5', 0))).toEqual(5)
/* all the values in B are equal to 2 - maybe an issue with caching the named expression? */
expect(engine.getCellValue(adr('B1', 0))).toEqual(1)
expect(engine.getCellValue(adr('B2', 0))).toEqual(2)
expect(engine.getCellValue(adr('B3', 0))).toEqual(3)
expect(engine.getCellValue(adr('B4', 0))).toEqual(4)
expect(engine.getCellValue(adr('B5', 0))).toEqual(5)
})
it('moderate example', () => {
const accountLookupExpression = "=IFNA(VLOOKUP(INDEX(ledger!$A:$A, ROW()),accounts!$A:$B,2,FALSE()),\"\")"
const engine = HyperFormula.buildFromSheets({
ledger: [
[23, accountLookupExpression, "=AccountLookup"],
[30, accountLookupExpression, "=AccountLookup"],
[13, accountLookupExpression, "=AccountLookup"],
],
accounts: [
[23, "Office Supplies"],
[13, "Rent"],
[26, "Gas"],
[20, "Maintenance"],
[30, "Capital Improvements"],
]
})
engine.addNamedExpression('AccountLookup', accountLookupExpression, 0)
console.log(engine.getRangeValues(AbsoluteCellRange.spanFrom(adr('A1', 0), 3, 3)))
expect(engine.getCellValue(adr('B1', 0))).toEqual('Office Supplies')
expect(engine.getCellValue(adr('B2', 0))).toEqual('Capital Improvements')
expect(engine.getCellValue(adr('B3', 0))).toEqual('Rent')
/* all the values in C are equal to 'Capital Improvements' - maybe an issue with caching the named expression? */
expect(engine.getCellValue(adr('C1', 0))).toEqual('Office Supplies')
expect(engine.getCellValue(adr('C2', 0))).toEqual('Capital Improvements')
expect(engine.getCellValue(adr('C3', 0))).toEqual('Rent')
})
})
Steps to reproduce
- Run the provided JSFiddle (hyperformula-named-references-bug)
- Drop the provided unit test into
named-expressions.spec.ts.
Your environment
- HyperFormula version: 2.3.1,
hyperformula::master,hyperformula:develop - Browser Name and version: Chrome
- Operating System: Mac
- 主要言語
- TypeScript
- スター
- 2.8k
- フォーク
- 175
- 平均マージ
- 1日 20時間
- マージ済み PR(30日)
- 17
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
handsontable/hyperformula のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
handsontable/hyperformula#1803 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
handsontable/hyperformula#1793 ·
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
handsontable/hyperformula#1745 ·
メンテナーはふだん 1 日以内に返信
-
Bug Impact: Low
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
handsontable/hyperformula#1641 ·
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 5/5 1週間以上 初心者へのやさしさ 22/100
handsontable/hyperformula#1825 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
handsontable/hyperformula の issue をすべて見る
似ている issue
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
🎙️ task - drop the raw `./node_modules/.bin/rhachet roles boot` line from bhuild's feedback templateオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ehmpathy/rhachet-roles-bhuild#639 ·
メンテナーはふだん 1 日以内に返信
-
e2e-failure ready-to-code
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
redhat-developer/rhdh-plugin-export-overlays#4650 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 13 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
omdsh-dev/DSH-better-sidebar#1098 ·
メンテナーはふだん 2 日以内に返信