Azure Synapse: Assertion Error while querying view

PetraccaPaul 96 Reputation points
2021-08-25T17:35:47.367+00:00

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
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,395 questions
{count} votes

Accepted answer
  1. PetraccaPaul 96 Reputation points
    2021-10-19T22:28:59.927+00:00

    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
    

0 additional answers

Sort by: Most helpful