Skip to content

Casting array to float succeeds, but probably shouldn't #6331

@philrz

Description

@philrz
$ echo '{r:[1,2,3]}' | super -c 'values cast(r, <float64>)' -
0.

Details

Repro is with super commit bec8934.

The only other primitive type for which the casting seems to succeed is string, but that one makes sense to me.

$ super -version
Version: bec8934e0

$ for t in uint8 uint16 uint32 uint64 int8 int16 int32 int64 float64 duration time bool string ip net null; do   echo -n "$t: ";   echo '{r:[1,2,3]}' | super -c "values cast(r, <${t}>)" -; done
uint8: error({message:"cannot cast to uint8",on:[1,2,3]})
uint16: error({message:"cannot cast to uint16",on:[1,2,3]})
uint32: error({message:"cannot cast to uint32",on:[1,2,3]})
uint64: error({message:"cannot cast to uint64",on:[1,2,3]})
int8: error({message:"cannot cast to int8",on:[1,2,3]})
int16: error({message:"cannot cast to int16",on:[1,2,3]})
int32: error({message:"cannot cast to int32",on:[1,2,3]})
int64: error({message:"cannot cast to int64",on:[1,2,3]})
float64: 0.
duration: error({message:"cannot cast to duration",on:[1,2,3]})
time: error({message:"cannot cast to time",on:[1,2,3]})
bool: error({message:"cannot cast to bool",on:[1,2,3]})
string: "[1,2,3]"
ip: error({message:"cannot cast to ip",on:[1,2,3]})
net: error({message:"cannot cast to net",on:[1,2,3]})
null: error({message:"cannot cast to null",on:[1,2,3]})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions