This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.2 by this push:
new fb9c03ce04b branch-4.2: [fix](orc) Preserve signed zero equivalence in
Bloom pruning #70862 (#70900)
fb9c03ce04b is described below
commit fb9c03ce04ba7307681bf664de8ee5bd3726db98
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Nov 25 08:22:03 2026 +0800
branch-4.2: [fix](orc) Preserve signed zero equivalence in Bloom pruning
#70862 (#70900)
Cherry-picked from #70862
Co-authored-by: Gabriel <[email protected]>
---
be/src/format_v2/orc/orc_search_argument.cpp | 33 ++--
be/test/format_v2/orc/orc_search_argument_test.cpp | 218 +++++++++++++++++++++
.../tvf/test_data/GenerateOrcSignedZeroBloom.cpp | 65 ++++++
.../tvf/test_data/signed_zero_bloom_row_groups.orc | Bin 0 -> 65829 bytes
.../tvf/test_data/signed_zero_bloom_stripes.orc | Bin 0 -> 66423 bytes
.../tvf/test_orc_signed_zero_bloom.out | 13 ++
.../tvf/test_orc_signed_zero_bloom.groovy | 120 ++++++++++++
7 files changed, 438 insertions(+), 11 deletions(-)
diff --git a/be/src/format_v2/orc/orc_search_argument.cpp
b/be/src/format_v2/orc/orc_search_argument.cpp
index 5cee9cf46c1..238bffbe8ae 100644
--- a/be/src/format_v2/orc/orc_search_argument.cpp
+++ b/be/src/format_v2/orc/orc_search_argument.cpp
@@ -1334,6 +1334,25 @@ bool can_emit_timestamp_sarg(const OrcSargColumn&
column, const cctz::time_zone&
return TimezoneUtils::try_get_fixed_offset_seconds(timezone,
&offset_seconds);
}
+OrcSargNode make_in_node(OrcSargColumn column, std::vector<::orc::Literal>
literals) {
+ DORIS_CHECK(!literals.empty());
+ // SQL equates signed zeros, but ORC Bloom filters hash their different
bit patterns.
+ // Keep both in one IN leaf: separate x = +0 and x = -0 leaves are merged
by ORC.
+ if (column.predicate_type == ::orc::PredicateDataType::FLOAT) {
+ const auto zero = std::ranges::find_if(
+ literals, [](const auto& literal) { return literal.getFloat()
== 0.0; });
+ if (zero != literals.end()) {
+ literals.emplace_back(-zero->getFloat());
+ }
+ }
+ return OrcSargNode {
+ .kind = literals.size() == 1 ? OrcSargNodeKind::EQUALS :
OrcSargNodeKind::IN,
+ .column = column,
+ .literals = std::move(literals),
+ .children = {},
+ };
+}
+
OrcSargNode make_comparison_node(OrcSargComparison comparison) {
OrcSargNodeKind kind;
bool negate = false;
@@ -1365,23 +1384,15 @@ OrcSargNode make_comparison_node(OrcSargComparison
comparison) {
__builtin_unreachable();
}
- auto node = make_literal_node(kind, comparison.column,
std::move(comparison.literal));
+ auto node = kind == OrcSargNodeKind::EQUALS
+ ? make_in_node(comparison.column, {comparison.literal})
+ : make_literal_node(kind, comparison.column,
comparison.literal);
if (negate) {
return make_not_node(std::move(node));
}
return node;
}
-OrcSargNode make_in_node(OrcSargColumn column, std::vector<::orc::Literal>
literals) {
- DORIS_CHECK(!literals.empty());
- return OrcSargNode {
- .kind = literals.size() == 1 ? OrcSargNodeKind::EQUALS :
OrcSargNodeKind::IN,
- .column = column,
- .literals = std::move(literals),
- .children = {},
- };
-}
-
OrcSargNode make_is_null_node(OrcSargColumn column) {
return OrcSargNode {
.kind = OrcSargNodeKind::IS_NULL,
diff --git a/be/test/format_v2/orc/orc_search_argument_test.cpp
b/be/test/format_v2/orc/orc_search_argument_test.cpp
new file mode 100644
index 00000000000..426fb42a9e4
--- /dev/null
+++ b/be/test/format_v2/orc/orc_search_argument_test.cpp
@@ -0,0 +1,218 @@
+// 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.
+
+#include "format_v2/orc/orc_search_argument.h"
+
+#include <gtest/gtest.h>
+
+#include <memory>
+#include <numeric>
+#include <orc/OrcFile.hh>
+#include <orc/sargs/SearchArgument.hh>
+#include <string>
+#include <tuple>
+#include <vector>
+
+#include "core/data_type/data_type_nullable.h"
+#include "core/data_type/data_type_number.h"
+#include "core/field.h"
+#include "exprs/vectorized_fn_call.h"
+#include "exprs/vin_predicate.h"
+#include "exprs/vliteral.h"
+#include "exprs/vslot_ref.h"
+#include "format/orc/orc_memory_stream_test.h"
+
+namespace doris {
+namespace {
+
+class OrcSearchArgumentSignedZeroTest : public
testing::TestWithParam<std::tuple<bool, bool>> {
+protected:
+ static constexpr int64_t ROWS_PER_GROUP = 1000;
+
+ void SetUp() override {
+ const auto [use_float, multiple_stripes] = GetParam();
+ _value_type = use_float ?
DataTypePtr(std::make_shared<DataTypeFloat32>())
+ :
DataTypePtr(std::make_shared<DataTypeFloat64>());
+ _type = ::orc::Type::buildTypeFromString(use_float ?
"struct<id:bigint,value:float>"
+ :
"struct<id:bigint,value:double>");
+ MemoryOutputStream output(1024 * 1024);
+ ::orc::WriterOptions options;
+ options.setRowIndexStride(ROWS_PER_GROUP)
+ .setStripeSize(multiple_stripes ? 1 : 1024 * 1024)
+ .setColumnsUseBloomFilter({2})
+ .setBloomFilterFPP(0.000001)
+ .setCompression(::orc::CompressionKind_NONE);
+ auto writer = ::orc::createWriter(*_type, &output, options);
+ auto batch = writer->createRowBatch(ROWS_PER_GROUP);
+ auto& root = dynamic_cast<::orc::StructVectorBatch&>(*batch);
+ auto& ids = dynamic_cast<::orc::LongVectorBatch&>(*root.fields[0]);
+ auto& values =
dynamic_cast<::orc::DoubleVectorBatch&>(*root.fields[1]);
+ for (int64_t group = 0; group < 4; ++group) {
+ root.numElements = ids.numElements = values.numElements =
ROWS_PER_GROUP;
+ values.hasNulls = group == 3;
+ for (int64_t row = 0; row < ROWS_PER_GROUP; ++row) {
+ ids.data[row] = group * ROWS_PER_GROUP + row;
+ values.notNull[row] = group != 3;
+ // Separate signs into different Bloom filters; min/max alone
keeps both zeros.
+ if (group == 0) {
+ values.data[row] = -0.0;
+ } else if (group == 1) {
+ values.data[row] = 0.0;
+ } else {
+ values.data[row] = row % 2 ? 1.0 : 3.0;
+ }
+ }
+ writer->add(*batch);
+ }
+ writer->close();
+ _file.assign(output.getData(), output.getLength());
+ auto reader = create_orc_reader();
+ ASSERT_EQ(reader->getNumberOfStripes(), multiple_stripes ? 4 : 1);
+ }
+
+ std::unique_ptr<::orc::Reader> create_orc_reader() const {
+ return
::orc::createReader(std::make_unique<MemoryInputStream>(_file.data(),
_file.size()),
+ ::orc::ReaderOptions());
+ }
+
+ VExprSPtr literal(double value) const {
+ const auto field = std::get<0>(GetParam())
+ ?
Field::create_field<TYPE_FLOAT>(static_cast<float>(value))
+ : Field::create_field<TYPE_DOUBLE>(value);
+ return VLiteral::create_shared(_value_type, field);
+ }
+
+ VExprSPtr predicate(TExprOpcode::type op, std::vector<VExprSPtr> values,
+ bool literal_on_left = false) const {
+ const bool is_in = op == TExprOpcode::FILTER_IN;
+ TExprNode node;
+ auto node_type = TExprNodeType::BINARY_PRED;
+ if (is_in) {
+ node_type = TExprNodeType::IN_PRED;
+ } else if (op == TExprOpcode::EQ_FOR_NULL) {
+ node_type = TExprNodeType::NULL_AWARE_BINARY_PRED;
+ }
+ node.__set_node_type(node_type);
+ node.__set_opcode(op);
+
node.__set_type(make_nullable(std::make_shared<DataTypeUInt8>())->to_thrift());
+ node.__set_is_nullable(true);
+ node.in_predicate.__set_is_not_in(false);
+ VExprSPtr expr = is_in ? VExprSPtr(VInPredicate::create_shared(node))
+ :
VExprSPtr(VectorizedFnCall::create_shared(node));
+ auto slot = VSlotRef::create_shared(1, 1, -1,
make_nullable(_value_type), "value");
+ if (literal_on_left) {
+ expr->add_child(values.front());
+ expr->add_child(slot);
+ } else {
+ expr->add_child(slot);
+ for (const auto& value : values) {
+ expr->add_child(value);
+ }
+ }
+ return expr;
+ }
+
+ std::vector<int64_t> selected_ids(const VExprSPtr& expr) const {
+ format::FileScanRequest request;
+ request.local_positions.emplace(format::LocalColumnId(1),
format::LocalIndex(1));
+ auto builder = ::orc::SearchArgumentFactory::newBuilder();
+ const bool pushed = format::orc::build_orc_search_argument(
+ request, *_type, cctz::utc_time_zone(), {}, expr, builder);
+ EXPECT_TRUE(pushed);
+ if (!pushed) {
+ return {};
+ }
+ ::orc::RowReaderOptions options;
+ options.searchArgument(builder->build());
+ auto reader = create_orc_reader();
+ auto row_reader = reader->createRowReader(options);
+ auto batch = row_reader->createRowBatch(512);
+ auto& root = dynamic_cast<::orc::StructVectorBatch&>(*batch);
+ auto& ids = dynamic_cast<::orc::LongVectorBatch&>(*root.fields[0]);
+ std::vector<int64_t> result;
+ while (row_reader->next(*batch)) {
+ for (uint64_t row = 0; row < batch->numElements; ++row) {
+ result.push_back(ids.data[row]);
+ }
+ }
+ return result;
+ }
+
+ static std::vector<int64_t> group_ids(int64_t first, int64_t count) {
+ std::vector<int64_t> ids(count * ROWS_PER_GROUP);
+ std::iota(ids.begin(), ids.end(), first * ROWS_PER_GROUP);
+ return ids;
+ }
+
+ DataTypePtr _value_type;
+ std::unique_ptr<::orc::Type> _type;
+ std::string _file;
+};
+
+TEST_P(OrcSearchArgumentSignedZeroTest, EqualityKeepsBothSigns) {
+ for (double zero : {0.0, -0.0}) {
+ for (bool literal_on_left : {false, true}) {
+ EXPECT_EQ(selected_ids(predicate(TExprOpcode::EQ, {literal(zero)},
literal_on_left)),
+ group_ids(0, 2));
+ }
+ }
+}
+
+TEST_P(OrcSearchArgumentSignedZeroTest, NullSafeEqualityKeepsBothSigns) {
+ for (double zero : {0.0, -0.0}) {
+ for (bool literal_on_left : {false, true}) {
+ EXPECT_EQ(selected_ids(predicate(TExprOpcode::EQ_FOR_NULL,
{literal(zero)},
+ literal_on_left)),
+ group_ids(0, 2));
+ }
+ }
+}
+
+TEST_P(OrcSearchArgumentSignedZeroTest, InKeepsBothSigns) {
+ for (double zero : {0.0, -0.0}) {
+ EXPECT_EQ(selected_ids(predicate(TExprOpcode::FILTER_IN,
{literal(zero)})),
+ group_ids(0, 2));
+ EXPECT_EQ(selected_ids(predicate(TExprOpcode::FILTER_IN,
{literal(2.0), literal(zero)})),
+ group_ids(0, 2));
+ EXPECT_EQ(selected_ids(predicate(TExprOpcode::FILTER_IN,
+ {literal(zero), literal(-zero),
literal(2.0)})),
+ group_ids(0, 2));
+ auto null_literal =
VLiteral::create_shared(make_nullable(_value_type), Field());
+ EXPECT_EQ(selected_ids(predicate(TExprOpcode::FILTER_IN,
{literal(zero), null_literal})),
+ group_ids(0, 2));
+ }
+}
+
+TEST_P(OrcSearchArgumentSignedZeroTest, NullSafeNullStillSelectsOnlyNullGroup)
{
+ auto null_literal = VLiteral::create_shared(make_nullable(_value_type),
Field());
+ EXPECT_EQ(selected_ids(predicate(TExprOpcode::EQ_FOR_NULL,
{null_literal})), group_ids(3, 1));
+}
+
+TEST_P(OrcSearchArgumentSignedZeroTest, NonzeroBloomPruningIsPreserved) {
+ // 2 is inside the [1, 3] bounds, so only Bloom can reject this nonzero
candidate.
+ EXPECT_TRUE(selected_ids(predicate(TExprOpcode::EQ,
{literal(2.0)})).empty());
+ EXPECT_TRUE(
+ selected_ids(predicate(TExprOpcode::FILTER_IN, {literal(2.0),
literal(2.5)})).empty());
+ EXPECT_EQ(selected_ids(predicate(TExprOpcode::EQ, {literal(1.0)})),
group_ids(2, 1));
+ EXPECT_EQ(selected_ids(predicate(TExprOpcode::LE, {literal(0.0)})),
group_ids(0, 2));
+}
+
+INSTANTIATE_TEST_SUITE_P(FloatAndDoubleRowGroupsAndStripes,
OrcSearchArgumentSignedZeroTest,
+ testing::Combine(testing::Bool(), testing::Bool()));
+
+} // namespace
+} // namespace doris
diff --git
a/regression-test/data/external_table_p0/tvf/test_data/GenerateOrcSignedZeroBloom.cpp
b/regression-test/data/external_table_p0/tvf/test_data/GenerateOrcSignedZeroBloom.cpp
new file mode 100644
index 00000000000..179d290b47b
--- /dev/null
+++
b/regression-test/data/external_table_p0/tvf/test_data/GenerateOrcSignedZeroBloom.cpp
@@ -0,0 +1,65 @@
+// 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.
+
+#include <memory>
+#include <orc/OrcFile.hh>
+#include <orc/Writer.hh>
+
+// Link against Doris's ORC library. Pass the row-group fixture path followed
by
+// the multi-stripe fixture path. Signed zeros must remain in separate Bloom
filters.
+int main(int argc, char** argv) {
+ if (argc != 3) {
+ return 1;
+ }
+ constexpr int64_t rows = 1000;
+ for (int fixture = 1; fixture <= 2; ++fixture) {
+ auto output = orc::writeLocalFile(argv[fixture]);
+ auto type =
orc::Type::buildTypeFromString("struct<id:int,f:float,d:double>");
+ orc::WriterOptions options;
+ options.setRowIndexStride(rows)
+ .setStripeSize(fixture == 1 ? 1024 * 1024 : 1)
+ .setColumnsUseBloomFilter({2, 3})
+ .setBloomFilterFPP(0.000001)
+ .setCompression(orc::CompressionKind_NONE);
+ auto writer = orc::createWriter(*type, output.get(), options);
+ auto batch = writer->createRowBatch(rows);
+ auto& root = dynamic_cast<orc::StructVectorBatch&>(*batch);
+ auto& ids = dynamic_cast<orc::LongVectorBatch&>(*root.fields[0]);
+ auto& floats = dynamic_cast<orc::DoubleVectorBatch&>(*root.fields[1]);
+ auto& doubles = dynamic_cast<orc::DoubleVectorBatch&>(*root.fields[2]);
+ for (int64_t group = 0; group < 4; ++group) {
+ root.numElements = ids.numElements = floats.numElements =
doubles.numElements = rows;
+ floats.hasNulls = doubles.hasNulls = group == 3;
+ for (int64_t row = 0; row < rows; ++row) {
+ ids.data[row] = group * rows + row;
+ floats.notNull[row] = doubles.notNull[row] = group != 3;
+ // Nonzero values straddle 2, so rejecting x = 2 requires
Bloom rather than bounds.
+ double value = row % 2 ? 1.0 : 3.0;
+ if (group == 0) {
+ value = -0.0;
+ } else if (group == 1) {
+ value = 0.0;
+ }
+ floats.data[row] = doubles.data[row] = value;
+ }
+ writer->add(*batch);
+ }
+ writer->close();
+ output->close();
+ }
+ return 0;
+}
diff --git
a/regression-test/data/external_table_p0/tvf/test_data/signed_zero_bloom_row_groups.orc
b/regression-test/data/external_table_p0/tvf/test_data/signed_zero_bloom_row_groups.orc
new file mode 100644
index 00000000000..cfd9d3f2c2f
Binary files /dev/null and
b/regression-test/data/external_table_p0/tvf/test_data/signed_zero_bloom_row_groups.orc
differ
diff --git
a/regression-test/data/external_table_p0/tvf/test_data/signed_zero_bloom_stripes.orc
b/regression-test/data/external_table_p0/tvf/test_data/signed_zero_bloom_stripes.orc
new file mode 100644
index 00000000000..b65148aeb27
Binary files /dev/null and
b/regression-test/data/external_table_p0/tvf/test_data/signed_zero_bloom_stripes.orc
differ
diff --git
a/regression-test/data/external_table_p0/tvf/test_orc_signed_zero_bloom.out
b/regression-test/data/external_table_p0/tvf/test_orc_signed_zero_bloom.out
new file mode 100644
index 00000000000..dadaa9a805f
--- /dev/null
+++ b/regression-test/data/external_table_p0/tvf/test_orc_signed_zero_bloom.out
@@ -0,0 +1,13 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !fixture --
+0 -0.0 -0
+1000 0.0 0
+2000 3.0 3
+3000 \N \N
+
+-- !fixture --
+0 -0.0 -0
+1000 0.0 0
+2000 3.0 3
+3000 \N \N
+
diff --git
a/regression-test/suites/external_table_p0/tvf/test_orc_signed_zero_bloom.groovy
b/regression-test/suites/external_table_p0/tvf/test_orc_signed_zero_bloom.groovy
new file mode 100644
index 00000000000..c0cf5a2590f
--- /dev/null
+++
b/regression-test/suites/external_table_p0/tvf/test_orc_signed_zero_bloom.groovy
@@ -0,0 +1,120 @@
+// 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.
+
+import com.azure.storage.blob.BlobClientBuilder
+import com.azure.storage.common.StorageSharedKeyCredential
+
+suite("test_orc_signed_zero_bloom", "p0,external") {
+ String provider = getS3Provider()
+ String endpoint = getS3Endpoint()
+ if (provider.equalsIgnoreCase("AZURE")) {
+ if (endpoint == "azure-endpoint") {
+ endpoint = "https://${getS3AK()}.blob.core.windows.net"
+ } else if (!endpoint.contains("://")) {
+ endpoint = "https://${endpoint}"
+ }
+ }
+ String bucket = context.config.otherConfigs.get("s3BucketName")
+ String prefix = "orc_signed_zero_bloom/${UUID.randomUUID()}"
+ Map<String, String> originalSettings = [:]
+ for (String variable : ["enable_orc_filter_by_min_max",
"enable_orc_lazy_materialization",
+ "enable_sql_cache", "enable_query_cache",
"enable_condition_cache"]) {
+ originalSettings[variable] = sql("SHOW VARIABLES LIKE
'${variable}'")[0][1].toString()
+ }
+ try {
+ sql "SET enable_sql_cache = false"
+ sql "SET enable_query_cache = false"
+ sql "SET enable_condition_cache = false"
+ for (String layout : ["row_groups", "stripes"]) {
+ String key = "${prefix}/${layout}.orc"
+ File fixture = new File(context.dataPath,
"test_data/signed_zero_bloom_${layout}.orc")
+ def blobClient = null
+ def s3Client = null
+ boolean uploaded = false
+ try {
+ if (provider.equalsIgnoreCase("AZURE")) {
+ blobClient = new
BlobClientBuilder().endpoint(endpoint).containerName(bucket)
+ .blobName(key).credential(new
StorageSharedKeyCredential(getS3AK(), getS3SK()))
+ .buildClient()
+ blobClient.uploadFromFile(fixture.absolutePath)
+ } else {
+ s3Client = getS3Client()
+ s3Client.putObject(bucket, key, fixture)
+ }
+ uploaded = true
+ String source = """S3('uri'='s3://${bucket}/${key}',
'format'='orc',
+ 'provider'='${provider}', 's3.endpoint'='${endpoint}',
's3.region'='${getS3Region()}',
+ 's3.access_key'='${getS3AK()}',
's3.secret_key'='${getS3SK()}')"""
+ for (boolean sarg : [false, true]) {
+ sql "SET enable_orc_filter_by_min_max = ${sarg}"
+ for (boolean lazy : [false, true]) {
+ sql "SET enable_orc_lazy_materialization = ${lazy}"
+ for (String column : ["f", "d"]) {
+ String type = column == "f" ? "FLOAT" : "DOUBLE"
+ String positive = "CAST('0.0' AS ${type})"
+ String negative = "CAST('-0.0' AS ${type})"
+ // IDs are an independent oracle: negative zeros
[0,1000), positive
+ // zeros [1000,2000), alternating 3/1 [2000,3000),
NULLs [3000,4000).
+ def cases = [
+ ["${column} = ${positive}", "id < 2000"],
+ ["${column} = ${negative}", "id < 2000"],
+ ["${negative} = ${column}", "id < 2000"],
+ ["${column} <=> ${positive}", "id < 2000"],
+ ["${negative} <=> ${column}", "id < 2000"],
+ ["${column} IN (${negative})", "id <
2000"],
+ ["${column} IN (${positive}, 2.0)", "id <
2000"],
+ ["${column} IN (2.0, ${negative})", "id <
2000"],
+ ["${column} IN (${positive}, ${negative},
NULL)", "id < 2000"],
+ ["${column} != ${negative}", "id >= 2000
AND id < 3000"],
+ ["NOT (${column} = ${positive})", "id >=
2000 AND id < 3000"],
+ ["${column} NOT IN (${negative}, 2.0)",
"id >= 2000 AND id < 3000"],
+ ["${column} NOT IN (${positive}, NULL)",
"FALSE"],
+ ["(${column} = ${negative} AND id >= 1000)
OR ${column} = 3.0",
+ "(id >= 1000 AND id < 2000) OR (id >=
2000 AND id < 3000 AND id % 2 = 0)"],
+ ["(${column} IN (${positive}, 2.0) OR
${column} IS NULL)",
+ "id < 2000 OR id >= 3000"],
+ ["(${column} <=> ${negative}) OR id =
3999", "id < 2000 OR id = 3999"],
+ ["CAST(${column} AS DOUBLE) =
${positive}", "id < 2000"],
+ ["${column} = 1.0", "id >= 2000 AND id <
3000 AND id % 2 = 1"],
+ ["${column} IN (2.0, 2.5)", "FALSE"],
+ ["${column} <= ${negative}", "id < 2000"],
+ ["${column} <=> CAST(NULL AS ${type})",
"id >= 3000"]
+ ]
+ cases.eachWithIndex { testCase, index ->
+
quickTest("${layout}_${sarg}_${lazy}_${column}_${index}",
+ "SELECT id FROM ${source} WHERE
${testCase[0]} ORDER BY id",
+ "SELECT id FROM (SELECT number AS id
FROM numbers('number'='4000')) ids " +
+ "WHERE ${testCase[1]} ORDER BY
id")
+ }
+ }
+ }
+ }
+ order_qt_fixture "SELECT id, f, d FROM ${source} WHERE id IN
(0, 1000, 2000, 3000)"
+ } finally {
+ if (uploaded) {
+ if (blobClient != null) {
+ blobClient.delete()
+ } else {
+ s3Client.deleteObject(bucket, key)
+ }
+ }
+ }
+ }
+ } finally {
+ originalSettings.each { variable, value -> sql "SET ${variable} =
${value}" }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]