question

PetraccaPaul-3220 avatar image
0 Votes"
PetraccaPaul-3220 asked PRADEEPCHEEKATLA-MSFT commented

Azure Synapse: Assertion Error while querying view

I am receiving an error sporadically when trying to run any query on views within an azure synapse workspace.

The error is as follows:
[Assertion failed: Number of data blocks does not match number of distinct files. This version of code supports having only one DataBlock per file.]

Is anyone familiar with this issue?

azure-synapse-analytics
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @PetraccaPaul-3220,

Welcome to the Microsoft Q&A platform.

We haven't seen this error message before.

To understand your query, could you please share the code snippet and the screenshot of the query?

0 Votes 0 ·

Hello @PetraccaPaul-3220,

Just checking in if you have had a chance to see the previous response. We need the following information to understand/investigate this issue further.

0 Votes 0 ·

Hello @PetraccaPaul-3220,

Did you get a chance to accept it as answer(144064-image.png). This can be beneficial to other community members.


0 Votes 0 ·
image.png (2.9 KiB)

1 Answer

PetraccaPaul-3220 avatar image
0 Votes"
PetraccaPaul-3220 answered PRADEEPCHEEKATLA-MSFT commented

Hello,

I apologize for not checking on this sooner.

This error occurs sporadically but only if a view in synapse is created using a wildcard.

For example:

 DROP VIEW IF EXISTS A_View
 GO
    
 CREATE VIEW  A_View AS
    
 SELECT *
 FROM OPENROWSET('CosmosDB',
                 Account= ACCOUNT;Database=DATABASE;Key=KEY',
                 A_Table)
 AS A_Table
    
 GO

Using the code above will result in "[Assertion failed: Number of data blocks does not match number of distinct files. This version of code supports having only one DataBlock per file.]" when trying to query the view, but not every time you query. It seems to be random.




The following resolved my issue:


     DROP VIEW IF EXISTS A_View
     GO
        
     CREATE VIEW  A_View AS
        
     SELECT Column1,Column2,Column...
     FROM OPENROWSET('CosmosDB',
                     Account= ACCOUNT;Database=DATABASE;Key=KEY',
                     A_Table)
     AS A_Table
        
     GO



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @PetraccaPaul-3220,

Glad to know that your issue has resolved. You can accept it as answer(142899-image.png). This can be beneficial to other community members. Thank you.


0 Votes 0 ·
image.png (2.9 KiB)