Opened 11 years ago

Closed 10 years ago

#588 closed defect (fixed)

Casting problems with RasQL's CSV encoding

Reported by: Piero Campalani Owned by: Veranika Liaukevich
Priority: minor Milestone: 9.0.x
Component: conversion Version: development
Keywords: cast rasql csv Cc: mantovani@…
Complexity: Medium

Description

RasQL has some supposedly unexpected behaviors which might unveil some bug in the handling of data types and casting.

This might also be related with #434.

A couple of RasQL examples (with --string output):

  • 12
    "select csv(pow(1, 2.0)) from eobstest AS c"
      Result object 1: {0}  --> WRONG
    
  • (long)12
    select csv((long)pow(1, 2.0)) from eobstest AS c
      Result object 1: {1} --> OK
    
  • ln(10.0)
    select csv(ln(10.0)) from eobstest AS c
      Result object 1: {0} --> WRONG
    
  • (float)ln(10.0)
    select csv((float)ln(10.0)) from eobstest AS c
      Result object 1: {2.30259} --> OK
    

Change History (15)

comment:1 by Dimitar Misev, 11 years ago

Can you try with --output hex and remove the csv, so we can see if it's an csv error or something further down?

comment:2 by Piero Campalani, 11 years ago

Cc: mantovani@… added
Keywords: cast rasql added

Yes, I verified already that csv was not the issue. I forgot to mention that:

select csv(pow(10, 1.0)) from eobstest AS c
  Result object 1: 7b 30 7d 

select csv((long)pow(10, 1.0)) from eobstest AS c"
  Result object 1: 7b 31 30 7d 

comment:3 by Dimitar Misev, 11 years ago

No Piero, I mean remove the csv, like this

select pow(10, 1.0) from eobstest AS c

comment:4 by Dimitar Misev, 11 years ago

I'm getting correct result without the csv, so it's an issue in the source:conversion/csv.cc converter.

comment:5 by Dimitar Misev, 11 years ago

Component: undecidedconversion

comment:6 by Dimitar Misev, 11 years ago

I think the issue here is that csv does not work with single scalar values, but with MDD objects only.

$ rasql -q 'select csv(marray i in [0:0] values pow(10, 1.0)) from test_grey AS c' --out string
  Result object 1: {10}
$ rasql -q 'select csv(pow(10, 1.0)) from test_grey AS c' --out string:
  Result object 1: {0}
$ rasql -q 'select pow(10, 1.0) from test_grey AS c' --out string
  Result element 1: 10

Possibly the cast produces an MDD out of the scalar and that's why it works, but I'm not sure.

Last edited 11 years ago by Dimitar Misev (previous) (diff)

comment:7 by Piero Campalani, 11 years ago

Ah ok, I thought encoding was mandatory.
Actually the result is ok without csv encoding:

select pow(10, 1.0) from eobstest AS c where oid(c)=154625"
  Result element 1: 10

Despite this, it seems that the --output argument is ignored when no encoding is specified in the query and the result is a scalar: that is, the above query gives 10 and not "0A if I set --output hex. As well for instance select avg_cell(pow((c) [3,52:54,151], 2.0)) from eobstest as c returns a string (1.69838e+06) output though it is set to hex.
Maybe this deserves a separate ticket.

Last edited 11 years ago by Piero Campalani (previous) (diff)

comment:8 by Piero Campalani, 11 years ago

An other use case:

select csv(((pow(191, 1.0))/(10))) from whatever AS c"
  Result object 1: {191.019}

select    (((pow(191, 1.0))/(10))) from whatever AS c"
  Result element 1: 19.1

comment:9 by Piero Campalani, 11 years ago

Complexity: MediumHard
Keywords: csv added
Summary: Casting problems with RasQLCasting problems with RasQL's CSV encoding

comment:10 by Dimitar Misev, 11 years ago

Owner: changed from Dimitar Misev to uagha
Status: newassigned

Uneeb could look at this along while solving with #586

@Uneeb: the queries in the description of this ticket should all produce the same result.

comment:11 by Piero Campalani, 11 years ago

Casting problems are as well arising with booleans: see #592.

comment:12 by Piero Campalani, 11 years ago

Priority: criticalminor

Lowering priority since WCPS queries can still allow non-CSV encoded scalar expressions.

comment:13 by Dimitar Misev, 10 years ago

Owner: changed from uagha to Veranika Liaukevich

comment:14 by Dimitar Misev, 10 years ago

Complexity: HardMedium
Milestone: 9.0.x

comment:15 by Veranika Liaukevich, 10 years ago

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