Opened 4 years ago

Closed 3 years ago

#588 closed defect (fixed)

Casting problems with RasQL's CSV encoding

Reported by: pcampalani Owned by: vliaukevich
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 Changed 4 years ago by dmisev

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 Changed 4 years ago by pcampalani

  • 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 Changed 4 years ago by dmisev

No Piero, I mean remove the csv, like this

select pow(10, 1.0) from eobstest AS c

comment:4 Changed 4 years ago by dmisev

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

comment:5 Changed 4 years ago by dmisev

  • Component changed from undecided to conversion

comment:6 Changed 4 years ago by dmisev

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 4 years ago by dmisev (previous) (diff)

comment:7 Changed 4 years ago by pcampalani

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 4 years ago by pcampalani (previous) (diff)

comment:8 Changed 4 years ago by pcampalani

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 Changed 4 years ago by pcampalani

  • Complexity changed from Medium to Hard
  • Keywords csv added
  • Summary changed from Casting problems with RasQL to Casting problems with RasQL's CSV encoding

comment:10 Changed 4 years ago by dmisev

  • Owner changed from dmisev to uagha
  • Status changed from new to assigned

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 Changed 4 years ago by pcampalani

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

comment:12 Changed 4 years ago by pcampalani

  • Priority changed from critical to minor

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

comment:13 Changed 3 years ago by dmisev

  • Owner changed from uagha to vliaukevich

comment:14 Changed 3 years ago by dmisev

  • Complexity changed from Hard to Medium
  • Milestone set to 9.0.x

comment:15 Changed 3 years ago by vliaukevich

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