{"action":"created","issue":{"url":"https://api.github.com/repos/Paradigm4/SciDBR/issues/93","repository_url":"https://api.github.com/repos/Paradigm4/SciDBR","labels_url":"https://api.github.com/repos/Paradigm4/SciDBR/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/Paradigm4/SciDBR/issues/93/comments","events_url":"https://api.github.com/repos/Paradigm4/SciDBR/issues/93/events","html_url":"https://github.com/Paradigm4/SciDBR/issues/93","id":153878920,"number":93,"title":"Aggregate throws Mismatched coordinates when dimension unbounded","user":{"login":"rvernica","id":241185,"avatar_url":"https://avatars.githubusercontent.com/u/241185?v=3","gravatar_id":"","url":"https://api.github.com/users/rvernica","html_url":"https://github.com/rvernica","followers_url":"https://api.github.com/users/rvernica/followers","following_url":"https://api.github.com/users/rvernica/following{/other_user}","gists_url":"https://api.github.com/users/rvernica/gists{/gist_id}","starred_url":"https://api.github.com/users/rvernica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rvernica/subscriptions","organizations_url":"https://api.github.com/users/rvernica/orgs","repos_url":"https://api.github.com/users/rvernica/repos","events_url":"https://api.github.com/users/rvernica/events{/privacy}","received_events_url":"https://api.github.com/users/rvernica/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-09T21:54:41Z","updated_at":"2016-05-09T22:18:56Z","closed_at":null,"body":"In SciDBR, an aggregate query results in an error if one dimension is unbounded.\r\n\r\nIn `iquery` it works fine:\r\n```\r\n# iquery --afl\r\nAFL% store(build(<val:double>[i1=1:3,3,0], i1), t);\r\n{i1} val\r\n{1} 1\r\n{2} 2\r\n{3} 3\r\nAFL% aggregate(t, min(val), i1);\r\n{i1} val_min\r\n{1} 1\r\n{2} 2\r\n{3} 3\r\nAFL% store(redimension(t, <val:double>[i1=1:*,3,0]),t2);\r\n{i1} val\r\n{1} 1\r\n{2} 2\r\n{3} 3\r\nAFL% aggregate(t2, min(val), i1);\r\n{i1} val_min\r\n{1} 1\r\n{2} 2\r\n{3} 3\r\n```\r\n\r\nIn SciDBR only the first aggregate query works:\r\n```\r\n> iquery(\"aggregate(t, min(val), i1)\",return=TRUE)\r\n  i1 val_min\r\n1  1       1\r\n2  2       2\r\n3  3       3\r\n> iquery(\"aggregate(t2, min(val), i1)\",return=TRUE)\r\nError in value[[3L]](cond) : \r\n  Error in SGET(\"/execute_query\", list(id = sessionid, release = release, : HTTP error 500\r\nSystemException in file: src/query/Operator.cpp function: PhysicalBoundaries line: 387\r\nError id: scidb::SCIDB_SE_INTERNAL::SCIDB_LE_MISMATCHED_COORDINATES_IN_PHYSICAL_BOUNDARIES\r\nError description: Internal SciDB error. Mismatched coordinates in physical boundaries: density not between 0.0 and 1.0.\r\n```\r\n\r\nI am using SciDB `15.12` and SciDBR `scidb_2.0.0` compiled from GitHub."},"comment":{"url":"https://api.github.com/repos/Paradigm4/SciDBR/issues/comments/218007018","html_url":"https://github.com/Paradigm4/SciDBR/issues/93#issuecomment-218007018","issue_url":"https://api.github.com/repos/Paradigm4/SciDBR/issues/93","id":218007018,"user":{"login":"apoliakov","id":2708498,"avatar_url":"https://avatars.githubusercontent.com/u/2708498?v=3","gravatar_id":"","url":"https://api.github.com/users/apoliakov","html_url":"https://github.com/apoliakov","followers_url":"https://api.github.com/users/apoliakov/followers","following_url":"https://api.github.com/users/apoliakov/following{/other_user}","gists_url":"https://api.github.com/users/apoliakov/gists{/gist_id}","starred_url":"https://api.github.com/users/apoliakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apoliakov/subscriptions","organizations_url":"https://api.github.com/users/apoliakov/orgs","repos_url":"https://api.github.com/users/apoliakov/repos","events_url":"https://api.github.com/users/apoliakov/events{/privacy}","received_events_url":"https://api.github.com/users/apoliakov/received_events","type":"User","site_admin":false},"created_at":"2016-05-09T22:18:56Z","updated_at":"2016-05-09T22:18:56Z","body":"Thank you for finding this. I can repro. The scidb-level bug repro is like this:\r\n```\r\n$ iquery -aq \"unpack(aggregate(t2, min(val), i1), i)\"\r\nSystemException in file: src/query/Operator.cpp function: PhysicalBoundaries line: 379\r\nError id: scidb::SCIDB_SE_INTERNAL::SCIDB_LE_MISMATCHED_COORDINATES_IN_PHYSICAL_BOUNDARIES\r\nError description: Internal SciDB error. Mismatched coordinates in physical boundaries: density not between 0.0 and 1.0.\r\n```\r\nSo, at the core it is a SciDB bug that R bumps into. It also does not reproduce on every array shape - something about your array shape is special.\r\n\r\nFor workarounds, you can use redimension or new grouped aggregate:\r\n```\r\n$ iquery -aq \"unpack(redimension(t2, <val:double null>[i1=0:*,3,0], avg(val) as val), i)\"\r\n{i} i1,val\r\n{0} 1,1\r\n{1} 2,2\r\n{2} 3,3\r\n\r\n$ iquery -aq \"unpack(grouped_aggregate(t2, avg(val) as val, i1), i)\"\r\n{i} instance_id,value_no,i1,val\r\n{0} 3,0,3,3\r\n{1} 5,0,1,1\r\n{2} 12,0,2,2\r\n```\r\n\r\nI'll file this as a proper SciDB bug - I don't think the R package does anything wrong here. Bryan we might be using unpack less frequently though - right?"}}