You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@madlib.apache.org by iyerr3 <gi...@git.apache.org> on 2018/06/27 17:07:42 UTC

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

GitHub user iyerr3 opened a pull request:

    https://github.com/apache/madlib/pull/282

    Utilites: Add CTAS while dropping some columns

    JIRA: MADLIB-1241
    
    This commit adds function to create a new table from existing table
    while dropping some of the columns of the source table.
    
    Closes #282

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/madlib/madlib feature/drop_columns

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/madlib/pull/282.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #282
    
----
commit 3b5310c07c2092059cd116c82457d026f968cd7a
Author: Rahul Iyer <ri...@...>
Date:   2018-06-27T00:36:39Z

    Utilites: Add CTAS while dropping some columns
    
    JIRA: MADLIB-1241
    
    This commit adds function to create a new table from existing table
    while dropping some of the columns of the source table.
    
    Closes #282

----


---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/550/



---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/524/



---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/540/



---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by fmcquillan99 <gi...@git.apache.org>.
Github user fmcquillan99 commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    There is a bit of inconsistency related to the last param `cols_to_drop`
    
    ```
    SELECT madlib.dropcols(
                        'houses',
                        'houses_out',
                        NULL
    );
    ```
    results in `houses_out` = 'houses' , i.e., no-op.
    
    But
    
    ```
    SELECT madlib.dropcols(
                        'houses',
                        'houses_out'
    );
    ```
    results in an error:
    
    ```
    ERROR:  function madlib.dropcols(unknown, unknown) does not exist
    LINE 1: SELECT madlib.dropcols(
                   ^
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
    ```
    
    I suggest we either make the param `cols_to_drop` mandatory (preferred) or make the 2 cases above consistent.
    
    Also in the user docs:
    
    1) please make the `dropcols` function name bold like the other utility functions on 
     http://madlib.apache.org/docs/latest/group__grp__utilities.html
    
    2) In the left panel, I would suggest we rename
    `Developer Database Functions` to `Utilities`
    and rename the top level
    `Utility Functions` to `Other Functions`
    
    What to you think?
    
    



---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by iyerr3 <gi...@git.apache.org>.
Github user iyerr3 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199862080
  
    --- Diff: src/ports/postgres/modules/utilities/test/utilities.sql_in ---
    @@ -0,0 +1,77 @@
    +/* ----------------------------------------------------------------------- */
    +/**
    + *
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + *
    + */
    +/* ----------------------------------------------------------------------- */
    +
    +CREATE TABLE "__madlib_temp_Quoted"(b varchar);
    +CREATE TABLE __madlib_temp_non_quoted(a text);
    +-- assert that madlib_temp tables are created
    +SELECT assert(count(*) >= 2, 'Error setting up madlib_temp in schema ' || quote_ident(current_schema()))
    +FROM pg_tables
    +WHERE tablename LIKE '%madlib\_temp%'
    +  AND quote_ident(schemaname) = quote_ident(current_schema());
    +
    +-- cleanup
    +SELECT cleanup_madlib_temp_tables(quote_ident(current_schema()));
    +
    +-- assert that madlib_temp tables are dropped
    +SELECT assert(count(*) = 0, 'Error cleaning up madlib_temp in schema ' || quote_ident(current_schema()))
    +FROM pg_tables
    +WHERE tablename LIKE '%madlib\_temp%'
    +  AND quote_ident(schemaname) = quote_ident(current_schema());
    +
    +-- test dropcols
    +DROP TABLE IF EXISTS dt_golf CASCADE;
    +CREATE TABLE dt_golf (
    +    id integer NOT NULL,
    +    id_2 integer,
    +    "OUTLOOK" text,
    +    temperature double precision,
    +    humidity double precision,
    +    "Cont,features" double precision[],
    +    cat_features text[],
    +    windy boolean,
    +    class text
    +) ;
    +
    +INSERT INTO dt_golf (id,"OUTLOOK",temperature,humidity,"Cont,features",cat_features, windy,class) VALUES
    --- End diff --
    
    I've added another column, but I expect all chars requiring a double quote to behave similarly. 


---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by fmcquillan99 <gi...@git.apache.org>.
Github user fmcquillan99 commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    looks like user docs lost the params description for dropcols()


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by kaknikhil <gi...@git.apache.org>.
Github user kaknikhil commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199002937
  
    --- Diff: src/ports/postgres/modules/utilities/test/utilities.sql_in ---
    @@ -0,0 +1,77 @@
    +/* ----------------------------------------------------------------------- */
    +/**
    + *
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + *
    + */
    +/* ----------------------------------------------------------------------- */
    +
    +CREATE TABLE "__madlib_temp_Quoted"(b varchar);
    +CREATE TABLE __madlib_temp_non_quoted(a text);
    +-- assert that madlib_temp tables are created
    +SELECT assert(count(*) >= 2, 'Error setting up madlib_temp in schema ' || quote_ident(current_schema()))
    +FROM pg_tables
    +WHERE tablename LIKE '%madlib\_temp%'
    +  AND quote_ident(schemaname) = quote_ident(current_schema());
    +
    +-- cleanup
    +SELECT cleanup_madlib_temp_tables(quote_ident(current_schema()));
    +
    +-- assert that madlib_temp tables are dropped
    +SELECT assert(count(*) = 0, 'Error cleaning up madlib_temp in schema ' || quote_ident(current_schema()))
    +FROM pg_tables
    +WHERE tablename LIKE '%madlib\_temp%'
    +  AND quote_ident(schemaname) = quote_ident(current_schema());
    +
    +-- test dropcols
    +DROP TABLE IF EXISTS dt_golf CASCADE;
    +CREATE TABLE dt_golf (
    +    id integer NOT NULL,
    +    id_2 integer,
    +    "OUTLOOK" text,
    +    temperature double precision,
    +    humidity double precision,
    +    "Cont,features" double precision[],
    +    cat_features text[],
    +    windy boolean,
    +    class text
    +) ;
    +
    +INSERT INTO dt_golf (id,"OUTLOOK",temperature,humidity,"Cont,features",cat_features, windy,class) VALUES
    +(1, 'sunny', 85, 85,ARRAY[85, 85], ARRAY['a', 'b'], false, 'Don''t Play'),
    +(2, 'sunny', 80, 90, ARRAY[80, 90], ARRAY['a', 'b'], true, 'Don''t Play'),
    +(3, 'overcast', 83, 78, ARRAY[83, 78], ARRAY['a', 'b'], false, 'Play'),
    +(4, 'rain', 70, NULL, ARRAY[70, 96], ARRAY['a', 'b'], false, 'Play'),
    +(5, 'rain', 68, 80, ARRAY[68, 80], ARRAY['a', 'b'], false, 'Play'),
    +(6, 'rain', NULL, 70, ARRAY[65, 70], ARRAY['a', 'b'], true, 'Don''t Play'),
    +(7, 'overcast', 64, 65, ARRAY[64, 65], ARRAY['c', 'b'], NULL , 'Play'),
    +(8, 'sunny', 72, 95, ARRAY[72, 95], ARRAY['a', 'b'], false, 'Don''t Play'),
    +(9, 'sunny', 69, 70, ARRAY[69, 70], ARRAY['a', 'b'], false, 'Play'),
    +(10, 'rain', 75, 80, ARRAY[75, 80], ARRAY['a', 'b'], false, 'Play'),
    +(11, 'sunny', 75, 70, ARRAY[75, 70], ARRAY['a', 'd'], true, 'Play'),
    +(12, 'overcast', 72, 90, ARRAY[72, 90], ARRAY['c', 'b'], NULL, 'Play'),
    +(13, 'overcast', 81, 75, ARRAY[81, 75], ARRAY['a', 'b'], false, 'Play'),
    +(15, NULL, 81, 75, ARRAY[81, 75], ARRAY['a', 'b'], false, 'Play'),
    +(16, 'overcast', NULL, 75, ARRAY[81, 75], ARRAY['a', 'd'], false, 'Play'),
    +(14, 'rain', 71, 80, ARRAY[71, 80], ARRAY['c', 'b'], true, 'Don''t Play');
    +
    +SELECT dropcols('dt_golf', 'dt_golf2', '"OUTLOOK", "Cont,features", cat_features');
    +-- test if the retained columns are present in output table
    +SELECT
    +    id, id_2, temperature, humidity, windy, class
    --- End diff --
    
    maybe we should also test that the dropped columns were indeed dropped from the output table ?


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by kaknikhil <gi...@git.apache.org>.
Github user kaknikhil commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199019606
  
    --- Diff: src/ports/postgres/modules/utilities/test/utilities.sql_in ---
    @@ -0,0 +1,77 @@
    +/* ----------------------------------------------------------------------- */
    +/**
    + *
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + *
    + */
    +/* ----------------------------------------------------------------------- */
    +
    +CREATE TABLE "__madlib_temp_Quoted"(b varchar);
    +CREATE TABLE __madlib_temp_non_quoted(a text);
    +-- assert that madlib_temp tables are created
    +SELECT assert(count(*) >= 2, 'Error setting up madlib_temp in schema ' || quote_ident(current_schema()))
    +FROM pg_tables
    +WHERE tablename LIKE '%madlib\_temp%'
    +  AND quote_ident(schemaname) = quote_ident(current_schema());
    +
    +-- cleanup
    +SELECT cleanup_madlib_temp_tables(quote_ident(current_schema()));
    +
    +-- assert that madlib_temp tables are dropped
    +SELECT assert(count(*) = 0, 'Error cleaning up madlib_temp in schema ' || quote_ident(current_schema()))
    +FROM pg_tables
    +WHERE tablename LIKE '%madlib\_temp%'
    +  AND quote_ident(schemaname) = quote_ident(current_schema());
    +
    +-- test dropcols
    +DROP TABLE IF EXISTS dt_golf CASCADE;
    +CREATE TABLE dt_golf (
    +    id integer NOT NULL,
    +    id_2 integer,
    +    "OUTLOOK" text,
    +    temperature double precision,
    +    humidity double precision,
    +    "Cont,features" double precision[],
    +    cat_features text[],
    +    windy boolean,
    +    class text
    +) ;
    +
    +INSERT INTO dt_golf (id,"OUTLOOK",temperature,humidity,"Cont,features",cat_features, windy,class) VALUES
    --- End diff --
    
    should we add some more special chars like https://github.com/apache/madlib/pull/281 ?


---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by iyerr3 <gi...@git.apache.org>.
Github user iyerr3 commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    That's just the way it has to be if it needs to be a link (bold) like the
    other functions. There are some other functions in that list that have
    parameters and you can get their info by clicking into them. Similarly you
    can click drop_cols() to get the parameters info. It's either this or have
    the parameters in that same page and make it inconsistent with the other
    functions.
    
    On Wed, Jul 11, 2018 at 5:56 PM Frank McQuillan <no...@github.com>
    wrote:
    
    > looks like user docs lost the params description for dropcols()
    >
    > —
    > You are receiving this because you authored the thread.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/madlib/pull/282#issuecomment-404355944>, or mute
    > the thread
    > <https://github.com/notifications/unsubscribe-auth/ACIkB03nI3TSwyEI7yTXmBt5G3Q1dBnAks5uFp7MgaJpZM4U6Eds>
    > .
    >



---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by iyerr3 <gi...@git.apache.org>.
Github user iyerr3 commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    @fmcquillan99 Suggested changes have been made in latest commit. 


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/madlib/pull/282


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by iyerr3 <gi...@git.apache.org>.
Github user iyerr3 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199861396
  
    --- Diff: src/ports/postgres/modules/utilities/test/utilities.ic.sql_in ---
    @@ -0,0 +1,58 @@
    +/* ----------------------------------------------------------------------- */
    +/**
    + *
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + *
    + *//* ----------------------------------------------------------------------- */
    +
    +-- cleanup
    +SELECT cleanup_madlib_temp_tables(quote_ident(current_schema()));
    --- End diff --
    
    Yes


---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/531/



---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/533/



---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by iyerr3 <gi...@git.apache.org>.
Github user iyerr3 commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    Thanks @kaknikhil for the review. I've updated per the comments. Will merge after your approval. 


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by kaknikhil <gi...@git.apache.org>.
Github user kaknikhil commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199002193
  
    --- Diff: src/ports/postgres/modules/utilities/test/utilities.ic.sql_in ---
    @@ -0,0 +1,58 @@
    +/* ----------------------------------------------------------------------- */
    +/**
    + *
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + *
    + *//* ----------------------------------------------------------------------- */
    +
    +-- cleanup
    +SELECT cleanup_madlib_temp_tables(quote_ident(current_schema()));
    --- End diff --
    
    I am assuming that we moved this test from the `drop_madlib_temp.ic.sql_in` file to this generic utilities install check test, right ?


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by kaknikhil <gi...@git.apache.org>.
Github user kaknikhil commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199005872
  
    --- Diff: src/ports/postgres/modules/utilities/utilities.py_in ---
    @@ -853,6 +857,34 @@ def validate_module_input_params(source_table, output_table, independent_varname
                                                source_table=source_table))
     # ------------------------------------------------------------------------
     
    +
    +def create_table_drop_cols(source_table, out_table,
    --- End diff --
    
    If the client_min_messages is set to NOTICE, calling dropcols prints the create table query. We should use thje context manager to silence everything except ERROR messages. 


---

[GitHub] madlib issue #282: Utilites: Add CTAS while dropping some columns

Posted by fmcquillan99 <gi...@git.apache.org>.
Github user fmcquillan99 commented on the issue:

    https://github.com/apache/madlib/pull/282
  
    ah, i see.  I think it is fine as you have put it.
    
    LGTM


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by iyerr3 <gi...@git.apache.org>.
Github user iyerr3 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199861734
  
    --- Diff: src/ports/postgres/modules/utilities/utilities.py_in ---
    @@ -853,6 +857,34 @@ def validate_module_input_params(source_table, output_table, independent_varname
                                                source_table=source_table))
     # ------------------------------------------------------------------------
     
    +
    +def create_table_drop_cols(source_table, out_table,
    +                           cols_to_drop, **kwargs):
    +    """ Create copy of table while dropping some of the columns
    +    Args:
    +        @param source_table str. Name of the source table
    +        @param out_table str. Name of the output table
    +        @param cols_to_drop str. Comma-separated list of columns to drop
    +    """
    +    input_tbl_valid(source_table, 'Utilities')
    +    output_tbl_valid(out_table, 'Utilities')
    +
    --- End diff --
    
    Added a note in the docs. 


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by iyerr3 <gi...@git.apache.org>.
Github user iyerr3 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199861841
  
    --- Diff: src/ports/postgres/modules/utilities/utilities.py_in ---
    @@ -853,6 +857,34 @@ def validate_module_input_params(source_table, output_table, independent_varname
                                                source_table=source_table))
     # ------------------------------------------------------------------------
     
    +
    +def create_table_drop_cols(source_table, out_table,
    --- End diff --
    
    Good point. Added the `MinWarning`


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by kaknikhil <gi...@git.apache.org>.
Github user kaknikhil commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199006902
  
    --- Diff: src/ports/postgres/modules/utilities/utilities.py_in ---
    @@ -853,6 +857,34 @@ def validate_module_input_params(source_table, output_table, independent_varname
                                                source_table=source_table))
     # ------------------------------------------------------------------------
     
    +
    +def create_table_drop_cols(source_table, out_table,
    +                           cols_to_drop, **kwargs):
    +    """ Create copy of table while dropping some of the columns
    +    Args:
    +        @param source_table str. Name of the source table
    +        @param out_table str. Name of the output table
    +        @param cols_to_drop str. Comma-separated list of columns to drop
    +    """
    +    input_tbl_valid(source_table, 'Utilities')
    +    output_tbl_valid(out_table, 'Utilities')
    +
    --- End diff --
    
    should we error out if the requested column to drop is not a valid column in the table? If not , then we should add a note about this in the user docs


---

[GitHub] madlib pull request #282: Utilites: Add CTAS while dropping some columns

Posted by iyerr3 <gi...@git.apache.org>.
Github user iyerr3 commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/282#discussion_r199861894
  
    --- Diff: src/ports/postgres/modules/utilities/test/utilities.sql_in ---
    @@ -0,0 +1,77 @@
    +/* ----------------------------------------------------------------------- */
    +/**
    + *
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + *
    + */
    +/* ----------------------------------------------------------------------- */
    +
    +CREATE TABLE "__madlib_temp_Quoted"(b varchar);
    +CREATE TABLE __madlib_temp_non_quoted(a text);
    +-- assert that madlib_temp tables are created
    +SELECT assert(count(*) >= 2, 'Error setting up madlib_temp in schema ' || quote_ident(current_schema()))
    +FROM pg_tables
    +WHERE tablename LIKE '%madlib\_temp%'
    +  AND quote_ident(schemaname) = quote_ident(current_schema());
    +
    +-- cleanup
    +SELECT cleanup_madlib_temp_tables(quote_ident(current_schema()));
    +
    +-- assert that madlib_temp tables are dropped
    +SELECT assert(count(*) = 0, 'Error cleaning up madlib_temp in schema ' || quote_ident(current_schema()))
    +FROM pg_tables
    +WHERE tablename LIKE '%madlib\_temp%'
    +  AND quote_ident(schemaname) = quote_ident(current_schema());
    +
    +-- test dropcols
    +DROP TABLE IF EXISTS dt_golf CASCADE;
    +CREATE TABLE dt_golf (
    +    id integer NOT NULL,
    +    id_2 integer,
    +    "OUTLOOK" text,
    +    temperature double precision,
    +    humidity double precision,
    +    "Cont,features" double precision[],
    +    cat_features text[],
    +    windy boolean,
    +    class text
    +) ;
    +
    +INSERT INTO dt_golf (id,"OUTLOOK",temperature,humidity,"Cont,features",cat_features, windy,class) VALUES
    +(1, 'sunny', 85, 85,ARRAY[85, 85], ARRAY['a', 'b'], false, 'Don''t Play'),
    +(2, 'sunny', 80, 90, ARRAY[80, 90], ARRAY['a', 'b'], true, 'Don''t Play'),
    +(3, 'overcast', 83, 78, ARRAY[83, 78], ARRAY['a', 'b'], false, 'Play'),
    +(4, 'rain', 70, NULL, ARRAY[70, 96], ARRAY['a', 'b'], false, 'Play'),
    +(5, 'rain', 68, 80, ARRAY[68, 80], ARRAY['a', 'b'], false, 'Play'),
    +(6, 'rain', NULL, 70, ARRAY[65, 70], ARRAY['a', 'b'], true, 'Don''t Play'),
    +(7, 'overcast', 64, 65, ARRAY[64, 65], ARRAY['c', 'b'], NULL , 'Play'),
    +(8, 'sunny', 72, 95, ARRAY[72, 95], ARRAY['a', 'b'], false, 'Don''t Play'),
    +(9, 'sunny', 69, 70, ARRAY[69, 70], ARRAY['a', 'b'], false, 'Play'),
    +(10, 'rain', 75, 80, ARRAY[75, 80], ARRAY['a', 'b'], false, 'Play'),
    +(11, 'sunny', 75, 70, ARRAY[75, 70], ARRAY['a', 'd'], true, 'Play'),
    +(12, 'overcast', 72, 90, ARRAY[72, 90], ARRAY['c', 'b'], NULL, 'Play'),
    +(13, 'overcast', 81, 75, ARRAY[81, 75], ARRAY['a', 'b'], false, 'Play'),
    +(15, NULL, 81, 75, ARRAY[81, 75], ARRAY['a', 'b'], false, 'Play'),
    +(16, 'overcast', NULL, 75, ARRAY[81, 75], ARRAY['a', 'd'], false, 'Play'),
    +(14, 'rain', 71, 80, ARRAY[71, 80], ARRAY['c', 'b'], true, 'Don''t Play');
    +
    +SELECT dropcols('dt_golf', 'dt_golf2', '"OUTLOOK", "Cont,features", cat_features');
    +-- test if the retained columns are present in output table
    +SELECT
    +    id, id_2, temperature, humidity, windy, class
    --- End diff --
    
    Added a test for dropped cols. 


---