Getting problem when using select * from array_name


#1

Hello, all

I am getting problems when using query language SELECT

AFL% create array mon_matrix val:double[i=0:3,4,0,j=0:3,4,0];
Query was executed successfully
AFL% store(build(mon_matrix,i*4+j),mon_matrix);
{i,j} val
{0,0} 0
{0,1} 1
{0,2} 2
{0,3} 3
{1,0} 4
{1,1} 5
{1,2} 6
{1,3} 7
{2,0} 8
{2,1} 9
{2,2} 10
{2,3} 11
{3,0} 12
{3,1} 13
{3,2} 14
{3,3} 15
AFL% select * from mon_matrix;
UserQueryException in file: src/query/parser/Driver.cpp function: fail line: 148
Error id: scidb::SCIDB_SE_PARSER::SCIDB_LE_QUERY_PARSING_ERROR
Error description: Error during query parsing. Query parser failed with error ‘syntax error’.
select * from mon_matrix
^^^^^^

All other operators works fine , just cannot using “select”, any ideas? Thanks.


#2

This is an AFL versus AQL problem. In AFL you would say scan(mon_matrix).

We do prefer AFL right now; AQL isn’t as well-developed.


#3

Yes, I do know the scan operator, and it works perfectly fine to print out all the data in the array. I tried to run select just to see if it works. Since select is not working in AFL, what should I use to run queries and find something specific in the array.
Something like SELECT sth. FROM array_name WHERE
For example. After load the TSV file into SciDB (like you mentioned in another topic) there are two dimensions for the X,Y as location. How can I run a query and find the value for a specific location.
Thanks


#4

Hi, Alex

I google for a long time, didn’t find out any helpful solution for the query part. If like you said the AQL isn’t as well developed as AFL, then how exactly should I do to run a query under AFL. Thanks

Jingchao


#5

To filter by attributes you could say:
AFL% filter( mon_matrix , val>10)
Or to filter by dimensions:
AFL% between( mon_matrix , null, 3, null, 5)
To get all data for j>=3 and j<=5.

Check out the AFL documentation for more details:
https://paradigm4.atlassian.net/wiki/display/ESD/SciDB+Operators


#6

filter works fine. Thanks