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:

  1. 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
  2. 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


  3. 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
  4. 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
  5. Use scan to display m3x3_B array:

    AFL% scan(m3x3_B);


    The output is:

    {i,j} val_B


  6. 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
  7. 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
  8. Remove the m3x3_A array:

    AFL% remove(m3x3_A);


    The output is:

    Query was executed successfully
  9. Remove the m3x3_B array:

    AFL% remove(m3x3_B);


    The output is:

    Query was executed successfully

Â