Opened 8 years ago

Closed 8 years ago

#1577 closed defect (fixed)

CSV has incorrect syntax in 1D

Reported by: Peter Baumann Owned by: bbell
Priority: critical Milestone:
Component: rasserver Version: development
Keywords: Cc: Dimitar Misev, Vlad Merticariu
Complexity: Easy

Description

in the WCPS console of earthlook when sending this query

for c in ( AvgLandTemp ) return encode(c[Lat(53.08), Long(8.80),
ansi("2014-01":"2014-12")], "csv")

I get this:

{2.83465,4.48819,11.1024,20.1968,21.0236,21.2992,25.9843,24.3307,22.126,16.063,8.89764,2.28346}

Now, CSV does not have curlies on the outermost dimension so this should be corrected.

Change History (6)

comment:1 by Dimitar Misev, 8 years ago

Sure, removing the brackets will work just fine for 1D as in this case, and 2D as well. But how do you suggest we represent nD arrays with "standard" CSV?

It will not work for anything more than 2D, unless we are ok with losing all information about the dimensions / sdom.

comment:2 by Peter Baumann, 8 years ago

We had this discussion in the past :) Actually, I am fine with disallowing 3+D in CSV, throwing an exception. We just need to come to something that is conforming in the dimensions covered by CSV.

comment:3 by Dimitar Misev, 8 years ago

So it seems like the outermost curly braces were removed already, see ticket #1505 (where Brennan is suggesting to re-introduce them :)) But for some reason they were NOT removed for 1D. So for consistency we should make sure they are removed for 1D as well, which will fix this ticket too.

For backwards compatibility disallowing it in 3D+ is a bad idea. We use this CSV encode in petascope for example for generating GML output, and some other client libraries are surely parsing it as well. We should migrate those to JSON first.

comment:4 by Peter Baumann, 8 years ago

good point about bw compatibility.

comment:5 by bbell, 8 years ago

I opened that ticket because we only created outerParens for 1-D outputs for csv outputs,

        if (rank == 0) 
        {
            outerParens = false;
        } 
        //honestly, this should be a simple else statement, but *.csv files lack outer
        //parens while json files possess them. Ideally, both would have them, but
        //it would require changing hundreds, possibly thousands, of oracle files in the systemtest
        //directory to fix, so for now, we will leave this as is.
        else if (rank == 1) 
        {
            outerParens = true;
        }
        if (outerParens) 
        {
            csvtemp << leftParen;
        }

but anyways, the fix to get the desired output here is quite trivial, and won't affect json outputs at all since json initializes the outerParens variable to "true".

comment:6 by bbell, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.