timescaledb/tsl/test/shared/sql/CMakeLists.txt
Nikhil 425cdd16e4 Add "SELECT DISTINCT" pushdown in multi-node
Construct "SELECT DISTINCT target_list" or "SELECT DISTINCT ON (col1,
col..) target_list" statement to push down the DISTINCT clause to the
remote side.

We only allow references to basic "Vars" or constants in the DISTINCT
exprs

So, "SELECT DISTINCT col1" is fine but "SELECT DISTINCT 2*col1" is not.

"SELECT DISTINCT col1, 'const1', NULL, col2" which is a mix of column
references and constants is also supported. Everything else is not
supported.

This pushdown also needs to work when
timescaledb.enable_per_data_node_queries is disabled.

All existing test cases in which "SELECT DISTINCT" is now being pushed
down have been modified. New test cases have been added to check that
the remote side uses "Skip Scans" as is suitable in some cases.
2021-04-21 12:53:53 +05:30

61 lines
1.9 KiB
CMake

set(TEST_FILES_SHARED
constraint_exclusion_prepared.sql
decompress_placeholdervar.sql
dist_gapfill.sql
dist_insert.sql
dist_distinct.sql
)
set(TEST_TEMPLATES_SHARED
constify_timestamptz_op_interval.sql.in
gapfill.sql.in
ordered_append.sql.in
ordered_append_join.sql.in
)
if ((${PG_VERSION_MAJOR} GREATER_EQUAL "12"))
list(APPEND TEST_TEMPLATES_SHARED
generated_columns.sql.in
)
endif()
# Regression tests that vary with PostgreSQL version. Generated test
# files are put in the original source directory since all tests must
# be in the same directory. These files are updated when the template
# is edited, but not when the output file is deleted. If the output is
# deleted either recreate it manually, or rerun cmake on the root dir.
foreach(TEMPLATE_FILE ${TEST_TEMPLATES_SHARED})
string(LENGTH ${TEMPLATE_FILE} TEMPLATE_NAME_LEN)
math(EXPR TEMPLATE_NAME_LEN ${TEMPLATE_NAME_LEN}-7)
string(SUBSTRING ${TEMPLATE_FILE} 0 ${TEMPLATE_NAME_LEN} TEMPLATE)
set(TEST_FILE ${TEMPLATE}-${TEST_VERSION_SUFFIX}.sql)
configure_file(${TEMPLATE_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_FILE} COPYONLY)
list(APPEND TEST_FILES_SHARED ${TEST_FILE})
endforeach(TEMPLATE_FILE)
if(DEFINED EXT_GIT_COMMIT_TAG OR DEFINED EXT_GIT_COMMIT_HASH OR DEFINED EXT_GIT_COMMIT_TIME)
list(APPEND TEST_FILES_SHARED build_info.sql)
endif()
if (TEST_FILES_SHARED)
list(SORT TEST_FILES_SHARED)
endif()
file(REMOVE ${TEST_SCHEDULE_SHARED})
if(NOT TEST_GROUP_SIZE)
set(PARALLEL_GROUP_SIZE 20)
else()
set(PARALLEL_GROUP_SIZE ${TEST_GROUP_SIZE})
endif()
set(GROUP_MEMBERS 0)
foreach(TEST_FILE ${TEST_FILES_SHARED})
string(REGEX REPLACE "(.+)\.sql" "\\1" TESTS_TO_RUN ${TEST_FILE})
if(GROUP_MEMBERS EQUAL 0)
file(APPEND ${TEST_SCHEDULE_SHARED} "\ntest: ")
endif()
file(APPEND ${TEST_SCHEDULE_SHARED} "${TESTS_TO_RUN} ")
MATH(EXPR GROUP_MEMBERS "(${GROUP_MEMBERS}+1)%${PARALLEL_GROUP_SIZE}")
endforeach(TEST_FILE)
file(APPEND ${TEST_SCHEDULE_SHARED} "\n")