Skip to content

Commit 6cb36f0

Browse files
committed
Feat: Adapt gp_url_tools for Cloudberry and fix UTF-16 surrogate decoding
1 parent 22ed95b commit 6cb36f0

10 files changed

Lines changed: 218 additions & 311 deletions

File tree

.github/workflows/build-cloudberry-rocky8.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ jobs:
318318
"make_configs":["gpcontrib/orafce:installcheck",
319319
"gpcontrib/zstd:installcheck",
320320
"gpcontrib/gp_sparse_vector:installcheck",
321-
"gpcontrib/gp_toolkit:installcheck"]
321+
"gpcontrib/gp_toolkit:installcheck",
322+
"gpcontrib/gp_url_tools:installcheck"]
322323
},
323324
{"test":"ic-fixme",
324325
"make_configs":["src/test/regress:installcheck-fixme"],

.github/workflows/build-cloudberry.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ jobs:
312312
"gpcontrib/zstd:installcheck",
313313
"gpcontrib/gp_sparse_vector:installcheck",
314314
"gpcontrib/gp_toolkit:installcheck",
315-
"gpcontrib/gp_exttable_fdw:installcheck"]
315+
"gpcontrib/gp_exttable_fdw:installcheck",
316+
"gpcontrib/gp_url_tools:installcheck"]
316317
},
317318
{"test":"ic-diskquota",
318319
"make_configs":["gpcontrib/diskquota:installcheck"],

gpcontrib/gp_url_tools/.clang-format

Lines changed: 0 additions & 192 deletions
This file was deleted.

gpcontrib/gp_url_tools/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ TESTS = $(wildcard test/sql/*.sql)
66
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
77
REGRESS_OPTS = --inputdir=test
88

9+
ifdef USE_PGXS
910
PG_CONFIG = pg_config
1011
PGXS := $(shell $(PG_CONFIG) --pgxs)
1112
include $(PGXS)
13+
else
14+
top_builddir = ../..
15+
include $(top_builddir)/src/Makefile.global
16+
include $(top_srcdir)/contrib/contrib-global.mk
17+
endif

gpcontrib/gp_url_tools/README.md

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,66 @@
1-
# gp_url_tools: Greenplum extension providing functionality for working with URL addresses
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+
20+
# gp_url_tools: Cloudberry extension providing functionality for working with URL addresses
221

322
### Features
4-
gp_url_tools is an extension for the Greenplum database that gives implementation
23+
gp_url_tools is an extension for the Cloudberry database that gives implementation
524
for functions that encode/decode url/uri.
625

7-
### Installation
8-
Install from source:
9-
```
10-
git clone https://github.com/open-gpdb/gp_url_tools.git
11-
cd gp_url_tools
12-
# Build it. Building would require GP installed nearby and sourcing greenplum_path.sh
13-
source <path_to_gp>/greenplum_path.sh
14-
make && make install
15-
```
16-
1726
### Usage
27+
```sql
28+
CREATE EXTENSION gp_url_tools;
1829
```
19-
=# create extension gp_url_tools;
20-
21-
=# select url_tools_schema.encode_url('Hello World');
30+
```sql
31+
SELECT url_tools_schema.encode_url('Hello World');
32+
```
33+
```bash
2234
encode_url
2335
───────────────
2436
Hello%20World
2537
(1 row)
26-
27-
=# select url_tools_schema.decode_url('Hello%20World');
38+
```
39+
```sql
40+
SELECT url_tools_schema.decode_url('Hello%20World');
41+
```
42+
```bash
2843
decode_url
2944
─────────────
3045
Hello World
3146
(1 row)
32-
33-
=# select url_tools_schema.encode_uri('https://ru.wikipedia.org/wiki/Greenplum_(компания)');
47+
```
48+
```sql
49+
SELECT url_tools_schema.encode_uri('https://ru.wikipedia.org/wiki/Greenplum_(компания)');
50+
```
51+
```bash
3452
encode_uri
3553
────────────────────────────────────────────────────────────────────────────────────────────
3654
https://ru.wikipedia.org/wiki/Greenplum_(%D0%BA%D0%BE%D0%BC%D0%BF%D0%B0%D0%BD%D0%B8%D1%8F)
37-
38-
=# select url_tools_schema.decode_uri('https://ru.wikipedia.org/wiki/Greenplum_(%D0%BA%D0%BE%D0%BC%D0%BF%D0%B0%D0%BD%D0%B8%D1%8F)');
55+
```
56+
```sql
57+
SELECT url_tools_schema.decode_uri('https://ru.wikipedia.org/wiki/Greenplum_(%D0%BA%D0%BE%D0%BC%D0%BF%D0%B0%D0%BD%D0%B8%D1%8F)');
58+
```
59+
```bash
3960
decode_uri
4061
────────────────────────────────────────────────────
4162
https://ru.wikipedia.org/wiki/Greenplum_(компания)
4263
```
4364

4465
### Acknowledgments
45-
Thank you very much for the extension for postgrsql: https://github.com/okbob/url_encode, its sources were very useful.
66+
Thank you very much for the extension for PostgreSQL: https://github.com/okbob/url_encode, its sources were very useful.

gpcontrib/gp_url_tools/gp_url_tools.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# gp_url_tools extension
2-
comment = 'Greenplum extension providing functionality for working with URL addresses'
2+
comment = 'Functions for working with URL-s'
33
default_version = '1.0'
44
module_pathname = '$libdir/gp_url_tools'
55
relocatable = true

gpcontrib/gp_url_tools/sql/gp_url_tools--1.0.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
\echo Use "CREATE EXTENSION gp_url_tools" to load this file. \quit
55

66
CREATE SCHEMA IF NOT EXISTS url_tools_schema;
7+
GRANT USAGE ON SCHEMA url_tools_schema TO public;
78

89
CREATE FUNCTION url_tools_schema.encode_url(text)
910
RETURNS text
@@ -24,4 +25,3 @@ CREATE FUNCTION url_tools_schema.decode_uri(text)
2425
RETURNS text
2526
AS 'MODULE_PATHNAME', 'decode_uri'
2627
LANGUAGE C IMMUTABLE STRICT;
27-

0 commit comments

Comments
 (0)