discard
The discard macro produces a result array with the same dimensions as (but a subset of the attributes of) a source array. It is equivalent to a project operator with the inverse:true option specified.
Synopsis
discard(source_array, attribute [,attribute]...);
Summary
The discard macro produces a result array that includes only those attributes of the source array not named in the parameter list. In the result array, the remaining attributes appear in their original order.
You can use the discard macro in the FROM clause of an AQL SELECT statement, as a stand-alone operator in an AFL statement, or as an operand within other SciDB operators.
Examples
Using the Macro
To demonstrate discard macro, do the following:
Create an array with three attributes:
AFL% store(apply(build(<x:int64>[i=0:5], i), y, 2*x, z, x+10), A); Query was executed successfully AFL% scan(A); {i} x,y,z {0} 0,0,10 {1} 1,2,11 {2} 2,4,12 {3} 3,6,13 {4} 4,8,14 {5} 5,10,15
Use the discard macro to discard the named attributes:
AFL% discard(A, y); {i} x,z {0} 0,10 {1} 1,11 {2} 2,12 {3} 3,13 {4} 4,14 {5} 5,15 AFL% discard(A, z, x); {i} y {0} 0 {1} 2 {2} 4 {3} 6 {4} 8 {5} 10
Remove the array:
AFL% remove(A);