Quantcast
Viewing all articles
Browse latest Browse all 12963

SQL Server 2014 columnstore with partitioning/indexed views bug

Hi all,

This appears to be two separate bugs in SQL Server 2014, but somewhat related.  I'm running the latest cumulative update (version 12.0.2342).

Basically, I have a simple table that I partition and create a clustered columnstore index on.  Then, I create an indexed view with some of the columns.  The actual creation of the index fails with:

"Internal Query Processor Error: The query processor could not obtain access to a required interface."

If I reverse the order (i.e. create the indexed view on the table first, then create the columnstore index), it works fine.

Secondly, with or without partitions, if I create a clustered columnstore indexed table, then create an indexed view that contains an NVARCHAR column in the view, bulk inserts will fail with:

"SQL Server Assertion: File: <valrow.cpp>, line=415 Failed Assertion = '*((ULONG*)(pb + x_ibLengthInBuffer)) <= m_cbMaxLen'. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check the database for structural integrity, or restart the server to ensure in-memory data structures are not corrupted."

Of course, I have done a DBCC CHECKDB to no success.

The script to reproduce the former is below.  To test the bulk insert, simply create the structure without the partitioning and then use an SSIS package or what not to try to bulk load some data.

SET NOCOUNT ON

CREATE PARTITION FUNCTION [SalesByDate](datetime2(7)) AS RANGE LEFT FOR VALUES (N'1970-01-01T00:00:00.000', N'2013-01-01T00:00:00.000', N'2014-01-01T00:00:00.000')
CREATE PARTITION SCHEME [SalesByDate] AS PARTITION [SalesByDate] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY])

CREATE TABLE [dbo].[Test](
	[TestId] [bigint] NOT NULL IDENTITY(1,1),
	[Key] nvarchar(50) NOT NULL,
	[Date] [datetime2](7) NOT NULL,
	[Num] [int] NOT NULL
) ON SalesByDate (Date)
GO

DECLARE @i INT = 0

WHILE @i < 100000
BEGIN
INSERT INTO dbo.Test
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)
UNION ALL
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)
UNION ALL
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)
UNION ALL
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)
UNION ALL
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)
UNION ALL
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)
UNION ALL
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)
UNION ALL
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)
UNION ALL
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)
UNION ALL
SELECT 'Blah!', DATEADD(DAY, CAST(RAND() * 720 as INT), '2013-01-01'), CAST(RAND() * 100 as INT)

SET @i = @i + 10
END

GO

CREATE CLUSTERED COLUMNSTORE INDEX PK_Test ON dbo.Test ON SalesByDate (Date)
GO

CREATE VIEW [dbo].[TestView]  WITH SCHEMABINDING
AS

SELECT [Date],
	[Key],
	[TestId]
  FROM [dbo].[Test]
GO

CREATE UNIQUE CLUSTERED INDEX PK_TestView ON dbo.TestView (Date, TestId) ON SalesByDate (Date)
GO


Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>