distinct 运算符distinct operator

生成一个表,其中包含输入表中所提供列的不同组合。Produces a table with the distinct combination of the provided columns of the input table.

T | distinct Column1, Column2

生成一个表,其中包含输入表中所有列的不同组合。Produces a table with the distinct combination of all columns in the input table.

T | distinct *

示例Example

显示水果与价格的不同组合。Shows the distinct combination of fruit and price.

Table | distinct fruit, price

两个表。一个表包含供应商、水果类型和价格,其中一些水果价格组合重复出现。第二个表仅列出独特的组合。

备注Notes

  • summarize by ... 不同,distinct 运算符支持提供星号 (*) 作为组键,使其更易于用于宽表。Unlike summarize by ..., the distinct operator supports providing an asterisk (*) as the group key, making it easier to use for wide tables.
  • 如果分组依据键的基数很高,则可将 summarize by ...随机策略一起使用。If the group by keys are of high cardinalities, using summarize by ... with the shuffle strategy could be useful.