Opened 12 months ago

Closed 2 weeks ago

#1269 closed defect (fixed)

csv output of scalars is wrong

Reported by: dmisev Owned by: bbell
Priority: minor Milestone: 9.4
Component: rasql Version: development
Keywords: Cc: pbaumann, bphamhuu
Complexity: Medium

Description (last modified by dmisev)

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 Changed 12 months ago by dmisev

  • Description modified (diff)

comment:2 Changed 11 months ago by rdeliallisi

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).

comment:3 Changed 11 months ago by dmisev

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 Changed 11 months ago by rdeliallisi

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 Changed 11 months ago by dmisev

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 Changed 11 months ago by rdeliallisi

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 Changed 11 months ago by dmisev

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:8 Changed 11 months ago by rdeliallisi

Yes, I have narrowed down the problem to that. Fix in progress.

comment:9 Changed 11 months ago by dmisev

Hi Rubin, did you manage to fix it?

comment:10 Changed 8 months ago by dmisev

  • Owner changed from rdeliallisi to stimilsina
  • Status changed from new to assigned

comment:11 Changed 4 months ago by dmisev

  • Owner changed from stimilsina to dmisev

comment:12 Changed 2 months ago by dmisev

  • Owner changed from dmisev to bbell

comment:13 Changed 8 weeks ago by dmisev

  • Milestone changed from 9.2 to 9.4

comment:14 Changed 5 weeks ago by pbaumann

hm, strange - isn't CSV all about {...}?
where can we see the complete, exact specification of CSV output?

comment:15 Changed 5 weeks ago by dmisev

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 Changed 5 weeks ago by dmisev

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 Changed 2 weeks ago by dmisev

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.