Casting in mapd


#1

how to cast high precison values in mapd
i am using pymapd how to cast decimal(38,18) to decimal(19,9) in query

mapdql> insert into example_mapd values(13.9999,234.444,cast(150.675857 as DECIMAL(19,9)));
Syntax error at: cast


#2

is there any way in mapd can somone reply soon


#3

I guess you can’t use cast function on the legacy processor.

What’s the problem? Is the legacy-processor casting your values as a float/double before inserting them, so you are having wrong numbers?


#4

yes in postgres it has DECIMAL(38,18) when i load that to mapd i kept defalut as DECIMAL(19,9) for all columns
but in mapd it is having wrong values


#5

I guess it’s a bug because the values in insert looks converted into a float/double before to be inserted into database.

Casting works only in calcite, bit it doesnt work in Legacy processor.


#6

is there any other way to convert column in postgres as DECIMAL(38,19) to mapd as DECIMAL(19,9) in mapd without chaning values in it


#7

I would try dumping postgres values in a cavallo then loading with copy Command, or doing something in python.

Have you tried the Java utility to copy data from a database to another? It’s called slqimporter.

Here is a reference to the utility
https://www.mapd.com/docs/latest/6_loading_data.html