Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Apache MADlib
Copyright 2016-2024 The Apache Software Foundation.
Copyright 2016-2025 The Apache Software Foundation.

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Down
2 changes: 1 addition & 1 deletion methods/kmeans/src/pg_gp/kmeans.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ compute_metric(PGFunction inMetricFn, MemoryContext inMemContext, Datum inVec1,
* in execUtils.c
*/

#if GP_VERSION_NUM >= 70000
#if defined(IS_CLOUDBERRY) || GP_VERSION_NUM >= 70000
if(inMemContext->mem_allocated > 50000)
#else
if(inMemContext->allBytesAlloc - inMemContext->allBytesFreed > 50000)
Expand Down
2 changes: 1 addition & 1 deletion src/bin/madpack
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# 2. Pass all arguments to ../madpack/madpack.py

PYTHON_PREFIX="python"
PYTHON_VERSIONS="2.7 2.6 3"
PYTHON_VERSIONS="3"

# create absolute path to madpack.py
pushd `dirname $0` > /dev/null
Expand Down
3 changes: 3 additions & 0 deletions src/config/Ports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ postgres:

greenplum:
name: Greenplum DB

cloudberry:
name: Apache Cloudberry
2 changes: 2 additions & 0 deletions src/library.ver
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ VERS_1.0 {
_ZnamRKSt9nothrow_t; # operator new[](unsigned long, std::nothrow_t const&);
_ZdaPv; # operator delete[](void*);
_ZdaPvRKSt9nothrow_t; # operator delete[](void*, std::nothrow_t const&);
_ZdlPvm ; # operator delete(void*, size_t);
_ZdaPvm ; # operator delete[](void*, size_t);

extern "C++" {
#
Expand Down
19 changes: 13 additions & 6 deletions src/madpack/madpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
for port in ports:
portid_list.append(port)

SUPPORTED_PORTS = ('postgres', 'greenplum')
SUPPORTED_PORTS = ('postgres', 'greenplum', 'cloudberry')

# Global variables
portid = None # Target port ID (eg: pg90, gp40)
Expand Down Expand Up @@ -189,7 +189,8 @@ def _run_m4_and_append(schema, maddir_mod_py, module, sqlfile,
'-I' + maddir_madpack,
sqlfile]
if ( (portid == 'postgres') &
(is_rev_gte(get_rev_num(dbver), get_rev_num('14.0'))) ):
(is_rev_gte(get_rev_num(dbver), get_rev_num('14.0'))) or
(portid == 'cloudberry') ):
m4args = ['m4',
'-P',
'-DMADLIB_SCHEMA=' + schema,
Expand Down Expand Up @@ -370,7 +371,7 @@ def _check_db_port(portid):
if portid == 'postgres':
if row[0]['version'].lower().find('greenplum') < 0:
return True
elif portid == 'greenplum':
elif portid == 'greenplum' or portid == 'cloudberry':
return True
return False
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -1240,6 +1241,7 @@ def create_install_madlib_sqlfile(args, madpack_cmd):
def get_madlib_function_drop_str(schema):

if ((portid == 'greenplum' and is_rev_gte(get_rev_num(dbver), get_rev_num('7.0'))) or
(portid == 'cloudberry') or
(portid == 'postgres')):
case_str = """
CASE p.prokind
Expand Down Expand Up @@ -1343,15 +1345,17 @@ def set_dynamic_library_path_in_database(dbver_split, madlib_library_path):
if ((portid == 'greenplum' and is_rev_gte(dbver_split, get_rev_num('7.0'))) or
(portid == 'postgres' and is_rev_gte(dbver_split, get_rev_num('13.0')))):
libdir = libdir.decode()
else:
libdir = libdir.decode('utf-8')

libdir = libdir.strip()+'/postgresql'
libdir = libdir.strip() + '/postgresql'
paths.append(libdir)

paths.append(madlib_library_path)
dynamic_library_path = ':'.join(paths)

if portid == 'greenplum':
if is_rev_gte(dbver_split, get_rev_num('6.0')):
if portid == 'greenplum' or portid == 'cloudberry':
if is_rev_gte(dbver_split, get_rev_num('6.0')) or portid == 'cloudberry':
ret = os.system('gpconfig -c dynamic_library_path -v \'{0}\''.format(dynamic_library_path))
else:
ret = os.system('gpconfig -c dynamic_library_path -v \'\\{0}\''.format(dynamic_library_path))
Expand Down Expand Up @@ -1482,6 +1486,9 @@ def main(argv):
else:
# only need the first two digits for <= 4.3.4
dbver = '.'.join(map(str, dbver_split[:2]))
elif portid == 'cloudberry':
# Assume Apache Cloudberry will stick to semantic versioning
dbver = str(dbver_split[0])
elif portid == 'postgres':
if is_rev_gte(dbver_split, get_rev_num('10.0')):
# Postgres starting 10.0 uses semantic versioning. Hence,
Expand Down
2 changes: 2 additions & 0 deletions src/madpack/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ def get_dbver(con_args, portid):
# for Greenplum the 3rd digit is necessary to differentiate
# 4.3.5+ from versions < 4.3.5
match = re.search("Greenplum[a-zA-Z\s]*(\d+\.\d+\.\d+)", versionStr)
elif portid == 'cloudberry':
match = re.search("Apache Cloudberry[a-zA-Z\s]*(\d+\.\d+\.\d+)", versionStr)
return None if match is None else match.group(1)
except Exception:
error_(this, "Failed reading database version", True)
Expand Down
1 change: 1 addition & 0 deletions src/ports/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_subdirectory(postgres)
add_subdirectory(greenplum)
add_subdirectory(cloudberry)
19 changes: 19 additions & 0 deletions src/ports/cloudberry/2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# 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.
#
add_current_cloudberry_version()
19 changes: 19 additions & 0 deletions src/ports/cloudberry/3/CMakeLists.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still no Cloudberry 3.0 yet. So can remove this file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apache MADlib should be able to build against both the REL_2_STABLE and main (3.0.0) branches. I believe it is better to keep support for Cloudberry 3.0. As main (3.0) has not released, maybe support for 3.0 can be labelled as experimental.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Thanks!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with ed.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# 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.
#
add_current_cloudberry_version()
Loading