usql.distribution_columns (U-SQL)


Returns the columns used by the distribution schemes for the tables in the schemas of the current database context.

Column name Data type Description
object_id_guid Guid Identifier of the object for which the distribution is specified
index_id int? Identifier of the index for which the distribution is specified or null if it is specified directly on the table
distribution_column_id int Ordinal position of the column in the distribution definition
column_id int Position of the column within the object on which the statistics is specified (unique within object_id_guid)
is_descending_key bool True = The distribution column has a descending sort direction

False = The distribution column has an ascending sort direction


The examples can be executed in Visual Studio with the Azure Data Lake Tools plug-in.

Query the usql.distribution_columns view

USE TestReferenceDB;

OUTPUT usql.distribution_columns
TO "/ReferenceGuide/CatalogViews/distribution_columns.txt"
USING Outputters.Tsv(outputHeader:true);

Query the usql.distribution_columns view with usql.objects view

@distribution_columns =
    SELECT AS tableName,
   AS columntName,
    FROM usql.objects AS o
    JOIN usql.distribution_columns AS dc
    ON o.object_id_guid == dc.object_id_guid
    JOIN usql.columns AS c
    ON dc.object_id_guid == c.object_id_guid
    AND dc.column_id == c.column_id;

OUTPUT @distribution_columns
TO "/ReferenceGuide/CatalogViews/distribution_columns_others.txt"
USING Outputters.Tsv(outputHeader:true);  

See Also