Table of contents
Collapse the table of content
Expand the table of content

usql.distribution_columns (U-SQL)

Michael Rys|Last Updated: 5/15/2018
4 Contributors

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

Column nameData typeDescription
object_id_guidGuidIdentifier of the object for which the distribution is specified
index_idint?Identifier of the index for which the distribution is specified or null if it is specified directly on the table
distribution_column_idintOrdinal position of the column in the distribution definition
column_idintPosition of the column within the object on which the statistics is specified (unique within object_id_guid)
is_descending_keyboolTrue = 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

© 2018 Microsoft