Skip to content

Commit

Permalink
Merge branch 'feature' into return_files
Browse files Browse the repository at this point in the history
  • Loading branch information
lnkuiper committed May 23, 2024
2 parents 6af686d + 67debbb commit 447e5d8
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 63 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/LinuxRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -381,63 +381,6 @@ jobs:
shell: bash
run: python3 scripts/exported_symbols_check.py build/release/src/libduckdb*.so

linux-httpfs:
name: Linux HTTPFS
if: ${{ inputs.skip_tests != 'true' }}
runs-on: ubuntu-20.04
needs: linux-release-64
env:
BUILD_HTTPFS: 1
BUILD_TPCH: 1
BUILD_TPCDS: 1
BUILD_PARQUET: 1
BUILD_JSON: 1
S3_TEST_SERVER_AVAILABLE: 1
AWS_DEFAULT_REGION: eu-west-1
AWS_ACCESS_KEY_ID: minio_duckdb_user
AWS_SECRET_ACCESS_KEY: minio_duckdb_user_password
DUCKDB_S3_ENDPOINT: duckdb-minio.com:9000
DUCKDB_S3_USE_SSL: false

GEN: ninja

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.git_ref }}

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Ninja
shell: bash
run: sudo apt-get update -y -qq && sudo apt-get install -y -qq ninja-build

- name: Setup Ccache
uses: hendrikmuhs/ccache-action@main
with:
key: ${{ github.job }}
save: ${{ github.ref == 'refs/heads/main' || github.repository != 'duckdb/duckdb' }}

- name: Build
shell: bash
run: make

- name: Start test server & run tests
shell: bash
run: |
sudo ./scripts/install_s3_test_server.sh
./scripts/generate_presigned_url.sh
source ./scripts/run_s3_test_server.sh
source ./scripts/set_s3_test_server_variables.sh
sleep 60
python3 scripts/get_test_list.py --file-contains 'require httpfs' --list '"*"' > test.list
python3 scripts/run_tests_one_by_one.py ./build/release/test/unittest '-f test.list'
python3 scripts/run_tests_one_by_one.py ./build/release/test/unittest '[secret]'
amalgamation-tests:
name: Amalgamation Tests
if: ${{ inputs.skip_tests != 'true' }}
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/NightlyTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -891,3 +891,57 @@ jobs:
pyodide:
uses: ./.github/workflows/Pyodide.yml
secrets: inherit

linux-httpfs:
name: Linux HTTPFS
runs-on: ubuntu-20.04
env:
BUILD_HTTPFS: 1
BUILD_TPCH: 1
BUILD_TPCDS: 1
BUILD_PARQUET: 1
BUILD_JSON: 1
S3_TEST_SERVER_AVAILABLE: 1
AWS_DEFAULT_REGION: eu-west-1
AWS_ACCESS_KEY_ID: minio_duckdb_user
AWS_SECRET_ACCESS_KEY: minio_duckdb_user_password
DUCKDB_S3_ENDPOINT: duckdb-minio.com:9000
DUCKDB_S3_USE_SSL: false

GEN: ninja

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Ninja
shell: bash
run: sudo apt-get update -y -qq && sudo apt-get install -y -qq ninja-build

- name: Setup Ccache
uses: hendrikmuhs/ccache-action@main
with:
key: ${{ github.job }}
save: ${{ github.ref == 'refs/heads/main' || github.repository != 'duckdb/duckdb' }}

- name: Build
shell: bash
run: make

- name: Start test server & run tests
shell: bash
run: |
sudo ./scripts/install_s3_test_server.sh
./scripts/generate_presigned_url.sh
source ./scripts/run_s3_test_server.sh
source ./scripts/set_s3_test_server_variables.sh
sleep 60
python3 scripts/get_test_list.py --file-contains 'require httpfs' --list '"*"' > test.list
python3 scripts/run_tests_one_by_one.py ./build/release/test/unittest '-f test.list'
python3 scripts/run_tests_one_by_one.py ./build/release/test/unittest '[secret]'
1 change: 1 addition & 0 deletions scripts/test_docker_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ make clean
# Currently not working due to cmake version being too low
# docker run -i --rm -v $(pwd):/duckdb --workdir /duckdb amazonlinux:2 <<< "yum install gcc gcc-c++ git make cmake ninja-build -y && GEN=ninja make && $TEST" 2>&1

docker run -i --rm -v $(pwd):/duckdb --workdir /duckdb alpine:latest <<< "apk add g++ git make cmake ninja python3 && cmake -Bbuild . && cmake --build build && cmake --install build && g++ -std=c++11 examples/embedded-c++/main.cpp"
docker run -i --rm -v $(pwd):/duckdb --workdir /duckdb amazonlinux:latest <<< "yum install clang git make cmake ninja-build -y && GEN=ninja make && $TEST" 2>&1
docker run -i --platform linux/arm64 --rm -v $(pwd):/duckdb --workdir /duckdb alpine:latest <<< "apk add g++ git make cmake ninja && GEN=ninja make && $TEST" 2>&1
docker run -i --platform linux/amd64 --rm -v $(pwd):/duckdb --workdir /duckdb alpine:latest <<< "apk add g++ git make cmake ninja && GEN=ninja make && $TEST" 2>&1
Expand Down
5 changes: 5 additions & 0 deletions src/common/local_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,14 @@ int64_t LocalFileSystem::Write(FileHandle &handle, void *buffer, int64_t nr_byte

bool LocalFileSystem::Trim(FileHandle &handle, idx_t offset_bytes, idx_t length_bytes) {
#if defined(__linux__)
// FALLOC_FL_PUNCH_HOLE requires glibc 2.18 or up
#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 18)
return false;
#else
int fd = handle.Cast<UnixFileHandle>().fd;
int res = fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, offset_bytes, length_bytes);
return res == 0;
#endif
#else
return false;
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/include/duckdb/common/shared_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ struct compatible_with_t : std::is_convertible<U *, T *> {}; // NOLINT: invalid

} // namespace duckdb

#include "duckdb/common/shared_ptr.ipp"
#include "duckdb/common/weak_ptr.ipp"
#include "duckdb/common/enable_shared_from_this.ipp"
#include "duckdb/common/shared_ptr_ipp.hpp"
#include "duckdb/common/weak_ptr_ipp.hpp"
#include "duckdb/common/enable_shared_from_this_ipp.hpp"

namespace duckdb {

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions src/optimizer/rule/move_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ unique_ptr<Expression> MoveConstantsRule::Apply(LogicalOperator &op, vector<refe
D_ASSERT(arithmetic.return_type.IsIntegral());
D_ASSERT(arithmetic.children[0]->return_type.IsIntegral());
if (inner_constant.value.IsNull() || outer_constant.value.IsNull()) {
if (comparison.type == ExpressionType::COMPARE_DISTINCT_FROM ||
comparison.type == ExpressionType::COMPARE_NOT_DISTINCT_FROM) {
return nullptr;
}
return make_uniq<BoundConstantExpression>(Value(comparison.return_type));
}
auto &constant_type = outer_constant.return_type;
Expand Down
5 changes: 2 additions & 3 deletions src/planner/binder/statement/bind_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,6 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
case CatalogType::INDEX_ENTRY: {
auto &base = stmt.info->Cast<CreateIndexInfo>();

auto catalog = BindCatalog(base.catalog);
properties.modified_databases.insert(catalog);

// visit the table reference
auto table_ref = make_uniq<BaseTableRef>();
table_ref->catalog_name = base.catalog;
Expand All @@ -631,6 +628,8 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
if (table.temporary) {
stmt.info->temporary = true;
}
properties.modified_databases.insert(table.catalog.GetName());

// create a plan over the bound table
auto plan = CreatePlan(*bound_table);
if (plan->type != LogicalOperatorType::LOGICAL_GET) {
Expand Down
22 changes: 22 additions & 0 deletions test/optimizer/issue_12181.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# name: test/optimizer/issue_12181.test
# description: Test move constants optimization involving DISTINCT FROM comparison
# group: [optimizer]

statement ok
CREATE TABLE t0(c0 INT)

statement ok
CREATE TABLE t1(c0 INT, c1 INT)

statement ok
INSERT INTO t1(c0, c1) VALUES (0, 1)

query I
SELECT NULL IS DISTINCT FROM (1 + t1.c1) FROM t1 NATURAL LEFT JOIN t0
----
true

query II
SELECT * FROM t0 NATURAL RIGHT JOIN t1 WHERE (CASE t0.c0 WHEN t0.c0 THEN 1 ELSE NULL END) IS DISTINCT FROM (1 + (CASE t1.c1 WHEN t1.c1 THEN 2 ELSE NULL END))
----
0 1
14 changes: 14 additions & 0 deletions test/sql/attach/attach_create_index.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# name: test/sql/attach/attach_create_index.test
# description: Test create index on an attached database with an alias
# group: [attach]

require skip_reload

statement ok
ATTACH '' AS tmp;

statement ok
CREATE TABLE tmp.t1(id int);

statement ok
CREATE INDEX idx ON tmp.t1(id);

0 comments on commit 447e5d8

Please sign in to comment.