ScriptDom does not fill Clustered property even if it was explicitly provided on HASH index
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
Research direction
Start by parsing the supplied CREATE TABLE statement with ScriptDOM and inspect the primary-key node's Clustered property. Compare the result for the explicit NONCLUSTERED HASH declaration; the issue is done when that property is false instead of null for this case.
Written by the indexing model from the issue text.
Description
ScriptDom version: 161.8919.0
Compatibility level used for parsing: 150
Parser did not fill Clustered property and because it is a PRIMARY KEY which are CLUSTERED by default unless explicitly defined as NONCLUSTERED, I resolved this case in my code as implicitly clustered. However it is clearly explicitly NONCLUSTERED. I think Clustered property should be false in this case.
CREATE TABLE dbo.foo
(
bar VARCHAR(512) NOT NULL
, far VARCHAR(20) NULL
, CONSTRAINT PK PRIMARY KEY NONCLUSTERED HASH (bar) WITH (BUCKET_COUNT = 500000)
, INDEX IX_2 NONCLUSTERED HASH (far)
WITH (BUCKET_COUNT = 500000)
)
WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA);
GO
Here are object properties for PK node:
So to check if index is clustered with respect to property nullability one has to do something like that:
bool isClustered;
if (node.Clustered.HasValue)
{
isClustered = node.Clustered.Value;
}
else if (node.IndexType != null && node.IndexType.IndexTypeKind.HasValue)
{
isClustered = node.IndexType.IndexTypeKind.Value == IndexTypeKind.Clustered
|| node.IndexType.IndexTypeKind.Value == IndexTypeKind.ClusteredColumnStore;
}
else
{
isClustered = node.IsPrimaryKey;
}
feels like it could be more straightforward
- Dominant language
- GAP
- Stars
- 277
- Forks
- 43
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/SqlScriptDOM
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/SqlScriptDOM#228 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/SqlScriptDOM#183 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 56/100
microsoft/SqlScriptDOM#226 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/SqlScriptDOM#225 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
microsoft/SqlScriptDOM#224 ·
All issues in microsoft/SqlScriptDOM
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
splunk/token-meter#56 ·
-
Doc: Oppdater README Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100