Skip to content

Commit 00d24da

Browse files
zhangwenchao-123zhangwenchao
authored andcommitted
Support madlib2 for lighting.
This commit, we support madlib2 for the version 3 of lightning.
1 parent 6555f60 commit 00d24da

7 files changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
add_current_cloudberry_version()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
add_current_cloudberry_version()
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Set defaults that can be overridden by files that include this file:
2+
if(NOT DEFINED _FIND_PACKAGE_FILE)
3+
set(_FIND_PACKAGE_FILE "${CMAKE_CURRENT_LIST_FILE}")
4+
endif(NOT DEFINED _FIND_PACKAGE_FILE)
5+
6+
# Set parameters for calling FindPostgreSQL.cmake
7+
set(_NEEDED_PG_CONFIG_PACKAGE_NAME "Apache Cloudberry")
8+
set(_PG_CONFIG_VERSION_NUM_MACRO "GP_VERSION_NUM")
9+
set(_PG_CONFIG_VERSION_MACRO "GP_VERSION")
10+
set(_SEARCH_PATH_HINTS
11+
"/usr/local/cloudberry-db-devel/bin"
12+
"/usr/local/cloudberry-db/bin"
13+
"$ENV{GPHOME}/bin"
14+
)
15+
16+
include("${CMAKE_CURRENT_LIST_DIR}/../../postgres/cmake/FindPostgreSQL.cmake")
17+
18+
if(${PKG_NAME}_FOUND)
19+
# server/funcapi.h ultimately includes server/access/xact.h, from which
20+
# cdb/cdbpathlocus.h is included
21+
execute_process(COMMAND ${${PKG_NAME}_PG_CONFIG} --pkgincludedir
22+
OUTPUT_VARIABLE ${PKG_NAME}_ADDITIONAL_INCLUDE_DIRS
23+
OUTPUT_STRIP_TRAILING_WHITESPACE
24+
)
25+
set(${PKG_NAME}_ADDITIONAL_INCLUDE_DIRS
26+
"${${PKG_NAME}_ADDITIONAL_INCLUDE_DIRS}/internal")
27+
if(_PG_CONFIG_HEADER_CONTENTS MATCHES "#define SERVERLESS 1")
28+
message("-- Detected Hashdata Cloud (Cloudberry Serverless)")
29+
set(CLOUDBERRY_SERVERLESS TRUE PARENT_SCOPE)
30+
else()
31+
message("-- Detected Cloudberry")
32+
endif()
33+
endif(${PKG_NAME}_FOUND)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FindCloudberry.cmake
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FindCloudberry.cmake
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FindCloudberry.cmake

src/ports/postgres/modules/pmml/table_to_pmml.sql_in

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@ File table_to_pmml.sql_in documenting the PMML export functions.
307307
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pmml(
308308
model_table varchar
309309
) RETURNS xml AS $$
310+
311+
import collections
312+
import collections.abc
313+
if not hasattr(collections, 'MutableSequence'):
314+
collections.MutableSequence = collections.abc.MutableSequence
315+
collections.MutableMapping = collections.abc.MutableMapping
316+
collections.MutableSet = collections.abc.MutableSet
317+
310318
PythonFunction(pmml, table_to_pmml, table_to_pmml)
311319
$$ LANGUAGE plpython3u
312320
m4_ifdef(`__HAS_FUNCTION_PROPERTIES__', `READS SQL DATA', `');
@@ -325,6 +333,14 @@ CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pmml(
325333
model_table varchar
326334
, name_spec varchar
327335
) RETURNS xml AS $$
336+
337+
import collections
338+
import collections.abc
339+
if not hasattr(collections, 'MutableSequence'):
340+
collections.MutableSequence = collections.abc.MutableSequence
341+
collections.MutableMapping = collections.abc.MutableMapping
342+
collections.MutableSet = collections.abc.MutableSet
343+
328344
PythonFunction(pmml, table_to_pmml, table_to_pmml)
329345
$$ LANGUAGE plpython3u
330346
m4_ifdef(`__HAS_FUNCTION_PROPERTIES__', `READS SQL DATA', `');
@@ -343,6 +359,14 @@ CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pmml(
343359
model_table varchar
344360
, name_spec varchar[]
345361
) RETURNS xml AS $$
362+
363+
import collections
364+
import collections.abc
365+
if not hasattr(collections, 'MutableSequence'):
366+
collections.MutableSequence = collections.abc.MutableSequence
367+
collections.MutableMapping = collections.abc.MutableMapping
368+
collections.MutableSet = collections.abc.MutableSet
369+
346370
PythonFunction(pmml, table_to_pmml, table_to_pmml)
347371
$$ LANGUAGE plpython3u
348372
m4_ifdef(`__HAS_FUNCTION_PROPERTIES__', `READS SQL DATA', `');
@@ -351,6 +375,14 @@ m4_ifdef(`__HAS_FUNCTION_PROPERTIES__', `READS SQL DATA', `');
351375
-- Help messages -------------------------------------------------------
352376
CREATE OR REPLACE FUNCTION MADLIB_SCHEMA.pmml()
353377
RETURNS TEXT AS $$
378+
379+
import collections
380+
import collections.abc
381+
if not hasattr(collections, 'MutableSequence'):
382+
collections.MutableSequence = collections.abc.MutableSequence
383+
collections.MutableMapping = collections.abc.MutableMapping
384+
collections.MutableSet = collections.abc.MutableSet
385+
354386
PythonFunction(pmml, table_to_pmml, pmml_help_msg)
355387
$$ LANGUAGE plpython3u IMMUTABLE
356388
m4_ifdef(`__HAS_FUNCTION_PROPERTIES__', `CONTAINS SQL', `');

0 commit comments

Comments
 (0)