cchsu created MADLIB-1287:
-----------------------------

             Summary: MADLib 1.15 does not recognize Postgres 10 declarative 
partitioned table
                 Key: MADLIB-1287
                 URL: https://issues.apache.org/jira/browse/MADLIB-1287
             Project: Apache MADlib
          Issue Type: Improvement
            Reporter: cchsu
             Fix For: v1.15


Hi,

Recently I test MADLib on PostgreSQL 10.6, installing MADLib with RPM.

I followed [https://madlib.apache.org/docs/latest/group__grp__linreg.html] and 
import the sample data in this page to run the function.

And I find that MADLib can not recognize declarative partitioned tables.
{code:java}
postgres=# \d+ houses_1gb 
                                     Table "public.houses_1gb"
 Column  |       Type       | Collation | Nullable | Default | Storage | Stats 
target | Description 
---------+------------------+-----------+----------+---------+---------+--------------+-------------
 id      | integer          |           |          |         | plain   |        
      | 
 tax     | integer          |           |          |         | plain   |        
      | 
 bedroom | integer          |           |          |         | plain   |        
      | 
 bath    | double precision |           |          |         | plain   |        
      | 
 price   | integer          |           |          |         | plain   |        
      | 
 size    | integer          |           |          |         | plain   |        
      | 
 lot     | integer          |           |          |         | plain   |        
      | 
Partition key: LIST (mod(id, 4))
Partitions: houses_0 FOR VALUES IN (0),
            houses_1 FOR VALUES IN (1),
            houses_2 FOR VALUES IN (2),
            houses_3 FOR VALUES IN (3)

postgres=# 
postgres=# SELECT madlib.linregr_train(
    'houses_1gb', 'houses_linregr', 'price', 'array[1, tax, bath, size]');
ERROR:  plpy.Error: Linregr error: Data table does not exist!
CONTEXT:  Traceback (most recent call last):
  PL/Python function "linregr_train", line 19, in <module>
    return linear.linregr_train(**globals())
  PL/Python function "linregr_train", line 22, in linregr_train
  PL/Python function "linregr_train", line 160, in _validate_args
  PL/Python function "linregr_train", line 77, in _assert
PL/Python function "linregr_train"
postgres=# 
{code}
I used the following modified table DDL to create the partitioned table.
{code:java}
CREATE TABLE houses_1gb (
   id INT, 
   tax INT, 
   bedroom INT, 
   bath FLOAT, 
   price INT,
   size INT, 
   lot INT)
PARTITIONED BY list(mod(id,4));

CREATE TABLE houses_0
    PARTITION OF houses_1gb 
FOR VALUES IN (0);
CREATE TABLE houses_1
    PARTITION OF houses_1gb 
FOR VALUES IN (1);
CREATE TABLE houses_2
    PARTITION OF houses_1gb 
FOR VALUES IN (2);
CREATE TABLE houses_3
    PARTITION OF houses_1gb 
FOR VALUES IN (3);
{code}
Maybe MADLib team can consider to support declarative partitioned tables for 
Postgres 10+.

 

 

Best Regards.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to