Skip to content

Commit

Permalink
bumb version to 1.4.0, cleanup the istore related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ildus committed Dec 12, 2022
1 parent 9b682a5 commit a2cd63d
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 815 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(clickhouse_fdw VERSION 1.3.0 LANGUAGES C)
project(clickhouse_fdw VERSION 1.4.0 LANGUAGES C)

set(CMAKE_COLOR_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
Expand Down Expand Up @@ -53,8 +53,6 @@ LIST(APPEND REGRESS_TESTS
http
binary
import_schema
istore
istore_binary
binary_queries
binary_inserts
functions
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ uses UTC timezone.
###### Installing `clickhouse_fdw`

```
git clone <repository_link>.git
git clone git@github.com:ildus/clickhouse_fdw.git
cd clickhouse_fdw
mkdir build && cd build
cmake ..
Expand Down
5 changes: 0 additions & 5 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ make clean
make -j10
make install

git clone https://github.com/adjust/istore.git
pushd istore
make && make install
popd

# check build
status=$?
if [ $status -ne 0 ]; then exit $status; fi
Expand Down
6 changes: 4 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(clickhouse_fdw VERSION 1.2.0 LANGUAGES C CXX)
project(clickhouse_fdw VERSION 1.4.0 LANGUAGES C CXX)

include (clickhouse-cpp/cmake/cpp17.cmake)

Expand Down Expand Up @@ -76,14 +76,15 @@ set(sql_out "${CMAKE_BINARY_DIR}/clickhouse_fdw--${EXT_VERSION}.sql")
set(sql_migration_11 "${CMAKE_CURRENT_SOURCE_DIR}/sql/clickhouse_fdw--1.0--1.1.sql")
set(sql_migration_12 "${CMAKE_CURRENT_SOURCE_DIR}/sql/clickhouse_fdw--1.1--1.2.sql")
set(sql_migration_13 "${CMAKE_CURRENT_SOURCE_DIR}/sql/clickhouse_fdw--1.2--1.3.sql")
set(sql_migration_14 "${CMAKE_CURRENT_SOURCE_DIR}/sql/clickhouse_fdw--1.3--1.4.sql")

add_custom_command(
OUTPUT ${sql_out}
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/sql/init.sql ${CMAKE_CURRENT_SOURCE_DIR}/sql/functions.sql> ${sql_out}
DEPENDS sql/init.sql sql/functions.sql
)
add_custom_target(clickhouse_fdw_sql
ALL DEPENDS ${sql_out} ${sql_migration_11} ${sql_migration_12} ${sql_migration_13})
ALL DEPENDS ${sql_out} ${sql_migration_11} ${sql_migration_12} ${sql_migration_13} ${sql_migration_14})
add_dependencies(clickhouse_fdw clickhouse_fdw_sql)

#------------------------------------------------------------------------------
Expand All @@ -94,6 +95,7 @@ set (install_files
"${sql_migration_11}"
"${sql_migration_12}"
"${sql_migration_13}"
"${sql_migration_14}"
"${CMAKE_SOURCE_DIR}/src/clickhouse_fdw.control"
)

Expand Down
2 changes: 1 addition & 1 deletion src/clickhouse_fdw.control
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
comment = 'foreign-data wrapper for remote ClickHouse servers'
default_version = '1.3'
default_version = '1.4'
module_pathname = '$libdir/clickhouse_fdw'
relocatable = true
1 change: 1 addition & 0 deletions src/sql/clickhouse_fdw--1.3--1.4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP FUNCTION chfdw_install_adjust_functions();
100 changes: 0 additions & 100 deletions tests/expected/engines.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CREATE EXTENSION clickhouse_fdw;
CREATE EXTENSION istore;
CREATE SERVER loopback FOREIGN DATA WRAPPER clickhouse_fdw OPTIONS(dbname 'regression');
CREATE USER MAPPING FOR CURRENT_USER SERVER loopback;
SELECT clickhousedb_raw_query('drop database if exists regression');
Expand Down Expand Up @@ -223,104 +222,6 @@ SELECT a, sum(b) FROM t2 GROUP BY a ORDER BY a;
9 | 540
(10 rows)

/* istore tests */
ALTER TABLE t3_aggr ALTER COLUMN b SET DATA TYPE istore;
SELECT sum(b) FROM t3_aggr;
sum
----------------------------------------------------------------------------------------------------------------
"1"=>"110", "2"=>"10", "3"=>"10", "4"=>"10", "5"=>"10", "6"=>"10", "7"=>"10", "8"=>"10", "9"=>"10", "10"=>"10"
(1 row)

EXPLAIN (VERBOSE, COSTS OFF) SELECT sum(b) FROM t3_aggr;
QUERY PLAN
-------------------------------------------------------------
Foreign Scan
Output: (sum(b))
Relations: Aggregate on (t3_aggr)
Remote SQL: SELECT sumMapMerge(b) FROM regression.t3_aggr
(4 rows)

EXPLAIN (VERBOSE, COSTS OFF) SELECT a, sum(accumulate(b)) FROM t3_aggr GROUP BY a;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Foreign Scan
Output: a, (sum(accumulate(b)))
Relations: Aggregate on (t3_aggr)
Remote SQL: SELECT a, sumMap((mapFill((finalizeAggregation(b) as _tmp1).1, _tmp1.2) as _tmp3).1, arrayCumSum(_tmp3.2)) FROM regression.t3_aggr GROUP BY a
(4 rows)

EXPLAIN (VERBOSE, COSTS OFF) SELECT a, sum(sum_up(b)) FROM t3_aggr GROUP BY a;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------
Foreign Scan
Output: a, (sum(sum_up(b)))
Relations: Aggregate on (t3_aggr)
Remote SQL: SELECT a, sum(arraySum((finalizeAggregation(b) as _tmp1).2)) FROM regression.t3_aggr GROUP BY a
(4 rows)

SELECT a, sum(sum_up(b)) FROM t3_aggr GROUP BY a;
a | sum
---+-----
0 | 20
4 | 20
3 | 20
2 | 20
5 | 20
1 | 20
6 | 20
7 | 20
9 | 20
8 | 20
(10 rows)

EXPLAIN (VERBOSE, COSTS OFF) SELECT a, sum(sum_up(b, 5)) FROM t3_aggr GROUP BY a;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------
Foreign Scan
Output: a, (sum(sum_up(b, 5)))
Relations: Aggregate on (t3_aggr)
Remote SQL: SELECT a, sum(arraySum(arrayFilter((v, k) -> k <= (5),(finalizeAggregation(b) as _tmp1).2, _tmp1.1))) FROM regression.t3_aggr GROUP BY a
(4 rows)

SELECT a, sum(sum_up(b, 5)) FROM t3_aggr GROUP BY a;
a | sum
---+-----
0 | 20
4 | 20
3 | 20
2 | 20
5 | 10
1 | 20
6 | 10
7 | 10
9 | 10
8 | 10
(10 rows)

EXPLAIN (VERBOSE, COSTS OFF) SELECT a, sum(b->1) FROM t3_aggr GROUP BY a;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------
Foreign Scan
Output: a, (sum((b -> 1)))
Relations: Aggregate on (t3_aggr)
Remote SQL: SELECT a, sum(((finalizeAggregation(b) as _tmp1).2)[nullif(indexOf(_tmp1.1, 1), 0)]) FROM regression.t3_aggr GROUP BY a
(4 rows)

SELECT a, sum(b->1) FROM t3_aggr GROUP BY a;
a | sum
---+-----
0 | 20
4 | 10
3 | 10
2 | 10
5 | 10
1 | 10
6 | 10
7 | 10
9 | 10
8 | 10
(10 rows)

DROP USER MAPPING FOR CURRENT_USER SERVER loopback;
SELECT clickhousedb_raw_query('DROP DATABASE regression');
clickhousedb_raw_query
Expand All @@ -337,4 +238,3 @@ drop cascades to foreign table t2
drop cascades to foreign table t3
drop cascades to foreign table t3_aggr
drop cascades to foreign table t4
DROP EXTENSION IF EXISTS istore CASCADE;
Loading

0 comments on commit a2cd63d

Please sign in to comment.