selectΒΆ

The select command specifies comma-separated list of literals, functions, names of fields of record stream and expressions to be computed. The list can contain wildcard * to select all fields. The fields can be referred also by position using @position syntax.

| select( [ alias':' ]
        { *
          | alias.*
          | '@'position
          | function
          | expression
          | literal
        }
        [ , ... ]
)

Each expression can be renamed using an alias. Aliases defined in a select command can be referenced in following commands down the pipeline.

Example:

1
2
3
4
5
6
7
dual(10)                     // generate 10 records
| select(i,                  // select by field name
         myLong:@2,          // select field by position,name the field as 'myLong'
         mySum:(i + myLong)) // compute the sum, name the field as 'mySum'
| filter(myLong > 10)        // include only records with myLong value greater than 10
| sort(mySum)                // sort resultset by mySum field in ascending order
| limit(10);                 // limit resultset to first 10 rows