CREATE TABLE input(symbol String, x int, y int);
INSERT INTO input VALUES ("CAT", 1, 2),("CAT", 2, 4),("CAT", 3, 10),("CAT", 4, 1),("CAT", 5, 20);
INSERT INTO input VALUES ("IBM", 1, 4),("IBM", 2, 6),("IBM", 3, 9),("IBM", 4, 2),("IBM", 5, 30);
CREATE TABLE result AS PREPARE *,interpolate(x,y,"linear") as linear, interpolate(x,y,"spline") as spline from input PARTITION BY symbol;
Table input = SELECT * FROM input;
TABLE result = SELECT * FROM result;
// input =
// +----------------------+
// | input |
// +------+-------+-------+
// |symbol|x |y |
// |String|Integer|Integer|
// +------+-------+-------+
// |CAT |1 |2 |
// |CAT |2 |4 |
// |CAT |3 |10 |
// |CAT |4 |1 |
// |CAT |5 |20 |
// |IBM |1 |4 |
// |IBM |2 |6 |
// |IBM |3 |9 |
// |IBM |4 |2 |
// |IBM |5 |30 |
// +------+-------+-------+
//
// result =
// +--------------------------------------------------------------------------------------------------------------+
// | result |
// +------+-------+-------+-----------+---------------------------------------------------------------------------+
// |symbol|x |y |linear |spline |
// |String|Integer|Integer|String |String |
// +------+-------+-------+-----------+---------------------------------------------------------------------------+
// |CAT |1 |2 |0.0,2.0 |38.5,-67.25,36.5,-5.75 |
// |CAT |2 |4 |-8.0,6.0 |-380.0,351.25,-103.0,9.75 |
// |CAT |3 |10 |37.0,-9.0 !null |
// |CAT |4 |1 |-75.0,19.0 !null |
// |CAT |5 |20 !null !null |
// |IBM |1 |4 |2.0,2.0 |28.000000000000114,-45.33333333333354,25.500000000000114,-4.166666666666686|
// |IBM |2 |6 |0.0,3.0 |-349.9999999999999,332.66666666666663,-100.5,9.833333333333334 |
// |IBM |3 |9 |30.0,-7.0 !null |
// |IBM |4 |2 |-110.0,28.0!null |
// |IBM |5 |30 !null !null |
// +------+-------+-------+-----------+---------------------------------------------------------------------------+
//