project-keep 运算符project-keep operator

从输入中选择要保留在输出中的列。Select what columns from the input to keep in the output.

T | project-keep price, quantity, zz*

结果中列的顺序取决于列在表中的原始顺序。The order of the columns in the result is determined by their original order in the table. 仅保留已指定为参数的列。Only the columns that were specified as arguments are kept. 将从结果中排除其他列。The other columns are excluded from the result. 另请参阅 projectSee also project.


T | project-keep ColumnNameOrPattern [, ...]T | project-keep ColumnNameOrPattern [, ...]


  • T :输入表T : The input table
  • ColumnNameOrPattern:要保留在输出中的列或列通配符模式的名称。ColumnNameOrPattern: The name of the column or column wildcard-pattern to be kept in the output.


一个包含指定为参数的列的表。A table with columns that were named as arguments. 包含与输入表相同的行数。Contains same number of rows as the input table.


  • 若要重命名列,请使用 project-renameTo rename columns, use project-rename.
  • 若要对列重新排序,请使用 project-reorderTo reorder columns, use project-reorder.
  • 可以 project-keep 存在于原始表中或已作为查询的一部分进行计算的任何列。You can project-keep any columns that are present in the original table or that were computed as part of the query.


输入表 T 具有属于 long 类型的三列:ABCThe input table T has three columns of type long: A, B, and C.

datatable(A1:long, A2:long, B:long) [1, 2, 3]
| project-keep A*    // Keeps only columns A1 and A2 in the output
A1A1 A2A2
11 22

请参阅See also

若要从输入中选择要从输出中排除的列,请使用 project-awayTo choose what columns from the input to exclude from the output, use project-away.