uninitialized token indexes in some fragments
まだ誰も着手していません。
評価
調査の方向性
SqlScriptDom/Parser/TSql/TSql80.g の 6276~6294 行付近から始め、issue にある 2 つの SQL 例を再現します。OptimizerHint と StatementList にトークン インデックスがどのように割り当てられているかを調べます。これらのフラグメントが -1 ではなく、正しい最初と最後のトークン インデックスを報告すれば作業は完了です。
索引モデルが issue の本文から書いたものです。
説明
Using Microsoft.SqlServer.TransactSql.ScriptDom version 161.9135.0.
For example:
select 1
option(recompile)
gets parsed as:
TOKENS:
0: Select "select"
1: WhiteSpace " "
2: Integer "1"
3: WhiteSpace "\n"
4: Option "option"
5: LeftParenthesis "("
6: Identifier "recompile"
7: RightParenthesis ")"
8: EndOfFile
FRAGMENTS:
TSqlScript {
FirstTokenIndex = 0,
LastTokenIndex = 8,
Batches = [
TSqlBatch {
FirstTokenIndex = 0,
LastTokenIndex = 7,
Statements = [
SelectStatement {
FirstTokenIndex = 0,
LastTokenIndex = 7,
QueryExpression = QuerySpecification {
FirstTokenIndex = 0,
LastTokenIndex = 2,
UniqueRowFilter = NotSpecified,
SelectElements = [
SelectScalarExpression {
FirstTokenIndex = 2,
LastTokenIndex = 2,
Expression = IntegerLiteral {
FirstTokenIndex = 2,
LastTokenIndex = 2,
LiteralType = Integer,
Value = 1,
},
},
],
},
OptimizerHints = [
OptimizerHint {
FirstTokenIndex = -1,
LastTokenIndex = -1,
HintKind = Recompile,
},
],
},
],
},
],
}
where OptimizerHint ends up with -1 in FirstTokenIndex and LastTokenIndex.
I think the issue here is that here
tokens get assigned to vParent and should be assigned to vHint.
Another example:
if 1=1
begin
select 1
end
gets parsed as:
TOKENS:
0: If "if"
1: WhiteSpace " "
2: Integer "1"
3: EqualsSign "="
4: Integer "1"
5: WhiteSpace "\n"
6: Begin "begin"
7: WhiteSpace "\n"
8: WhiteSpace " "
9: Select "select"
10: WhiteSpace " "
11: Integer "1"
12: WhiteSpace "\n"
13: End "end"
14: EndOfFile
FRAGMENTS:
TSqlScript {
FirstTokenIndex = 0,
LastTokenIndex = 14,
Batches = [
TSqlBatch {
FirstTokenIndex = 0,
LastTokenIndex = 13,
Statements = [
IfStatement {
FirstTokenIndex = 0,
LastTokenIndex = 13,
Predicate = BooleanComparisonExpression {
FirstTokenIndex = 2,
LastTokenIndex = 4,
ComparisonType = Equals,
FirstExpression = IntegerLiteral {
FirstTokenIndex = 2,
LastTokenIndex = 2,
LiteralType = Integer,
Value = 1,
},
SecondExpression = IntegerLiteral {
FirstTokenIndex = 4,
LastTokenIndex = 4,
LiteralType = Integer,
Value = 1,
},
},
ThenStatement = BeginEndBlockStatement {
FirstTokenIndex = 6,
LastTokenIndex = 13,
StatementList = StatementList {
FirstTokenIndex = -1,
LastTokenIndex = -1,
Statements = [
SelectStatement {
FirstTokenIndex = 9,
LastTokenIndex = 11,
QueryExpression = QuerySpecification {
FirstTokenIndex = 9,
LastTokenIndex = 11,
UniqueRowFilter = NotSpecified,
SelectElements = [
SelectScalarExpression {
FirstTokenIndex = 11,
LastTokenIndex = 11,
Expression = IntegerLiteral {
FirstTokenIndex = 11,
LastTokenIndex = 11,
LiteralType = Integer,
Value = 1,
},
},
],
},
},
],
},
},
},
],
},
],
}
here StatementList is missing token indexes.
- 主要言語
- GAP
- スター
- 277
- フォーク
- 43
- 平均マージ
- 6日 17時間
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/SqlScriptDOM のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/SqlScriptDOM#228 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microsoft/SqlScriptDOM#183 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
microsoft/SqlScriptDOM#226 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
microsoft/SqlScriptDOM#225 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
microsoft/SqlScriptDOM#224 ·
microsoft/SqlScriptDOM の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
oxc-project/oxc#26944 ·
-
todo:perf
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
bug
難易度 2/5 半日 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
tenstorrent/tt-metal#57393 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
objectionary/eo#8894 ·