scan
The scan operator produces a result array that is equivalent to a stored array. That is, scan reads a stored array.
Synopsis
scan(stored_array);
Inputs
stored_array:Â An array that was previously created and stored in SciDB.
Summary
The scan operator reads a stored array from disk. The scan operator's output is an array with the same content as stored_array. The scan operator is most useful for displaying a stored array on stdout from the AFL language.
Example
To create, build, scan, and store an array, do the following:
Create a 3×3 array called m3x3_A:
AFL% CREATE ARRAY m3x3_A <val_A:double>[i=0:2; j=0:2];
The output is:Query was executed successfully
Put values of 0–8 into the m3x3_A array:
AFL% store(build(m3x3_A,i*3+j),m3x3_A);
The output is:{i,j} val_A {0,0} 0 {0,1} 1 {0,2} 2 {1,0} 3 {1,1} 4 {1,2} 5 {2,0} 6 {2,1} 7 {2,2} 8
Create the m3x3_B array
AFL% CREATE ARRAY m3x3_B <val_B:double>[i=0:2; j=0:2];
The output is:Query was executed successfully
Use scan to display m3x3_A array:Â
AFL% scan(m3x3_A);
The output is:{i,j} val_A {0,0} 0 {0,1} 1 {0,2} 2 {1,0} 3 {1,1} 4 {1,2} 5 {2,0} 6 {2,1} 7 {2,2} 8
Use scan to display m3x3_B array:
AFL% scan(m3x3_B);
The output is:{i,j} val_B
Store the scan output of array m3x3_A into the m3x3_B array:
AFL% store(scan(m3x3_A), m3x3_B);
The output is:{i,j} val_B {0,0} 0 {0,1} 1 {0,2} 2 {1,0} 3 {1,1} 4 {1,2} 5 {2,0} 6 {2,1} 7 {2,2} 8
Scan m3x3_B to ensure it has the expected data
AFL% scan(m3x3_B);
The output is:{i,j} val_B {0,0} 0 {0,1} 1 {0,2} 2 {1,0} 3 {1,1} 4 {1,2} 5 {2,0} 6 {2,1} 7 {2,2} 8
Remove the m3x3_A array:
AFL% remove(m3x3_A);
The output is:Query was executed successfully
Remove the m3x3_B array:
AFL% remove(m3x3_B);
The output is:Query was executed successfully
Â