Opened 9 years ago
Closed 8 years ago
#1269 closed defect (fixed)
csv output of scalars is wrong
Reported by: | Dimitar Misev | Owned by: | bbell |
---|---|---|---|
Priority: | minor | Milestone: | 9.4 |
Component: | rasql | Version: | development |
Keywords: | Cc: | Peter Baumann, Bang Pham Huu | |
Complexity: | Medium |
Description (last modified by )
csv encoding of a scalar includes braces in the output, however it will be more correct if it doesn't. If we think of scalar as 0D, then its csv output is now equivalent to that of 1D array, which is wrong.
$ rasql -q 'select csv(1)' --out string --quiet {1} $ rasql -q 'select csv(<[0:0] 1>)' --out string --quiet {1}
The correct output of the scalar encoding should be:
$ rasql -q 'select csv(1)' --out string --quiet 1
Change History (17)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Can you give more details? I can do this query as well and don't see any parentheses:
rasql -q 'select oid(mr) from mr' --out string Result element 1: 82945
comment:4 by , 9 years ago
The result of the first(csv) query is an array type, while the result of the second one is a scalar type. These types are determined by the server. In the rasql component the format of the data is not considered at all when displaying it. Even the brackets are put into the result in the server.
comment:5 by , 9 years ago
This one is also resulting in 1D char arrays, but they are not wrapped in { }
rasql -q 'select c from RAS_COLLECTIONNAMES AS c' --out string
comment:6 by , 9 years ago
Yes, but those 1D char arrays are determined on the server.
rasql -q 'select c from RAS_COLLECTIONNAMES AS c' --out string
For the above query we get 13 char arrays from the server none of which has a {}. While for the csv query we just get 1 char array containing {1}. Rasql only puts the chars on a stream, because a char array has no cardinality. The array values are determined elsewhere. I am already looking on what component this happens
comment:7 by , 9 years ago
Did you check in the conversion/csv.cc? rasql of course doesn't do much, it just sends the query and gets back the result.
comment:10 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:11 by , 8 years ago
Owner: | changed from | to
---|
comment:12 by , 8 years ago
Owner: | changed from | to
---|
comment:13 by , 8 years ago
Milestone: | 9.2 → 9.4 |
---|
comment:14 by , 8 years ago
hm, strange - isn't CSV all about {…}?
where can we see the complete, exact specification of CSV output?
comment:15 by , 8 years ago
I'm sure we agree that the CSV output of a scalar and 1D array of single element should be different? Currently they are of the same form.
comment:16 by , 8 years ago
I mean this is really low priority ticket, output of scalars is not really important, but getting the formatting right would be good.
The JSON encode/decode algorithm in SQL/MDA provides the exact specification (just substitute [..]
with {..}
). JSON of scalar SQL value is only scalar of course, with no [..]
around it.
comment:17 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The problem is not actually in the rasql component. All rasql does is parse the query and then display the result set. The rasodmg module is responsible for populating the result set(including the brackets).