Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions be/src/vec/functions/array/function_array_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,6 @@ class FunctionArrayElement : public IFunction {
auto val_arr =
ColumnArray::create(map_column.get_values_ptr(), map_column.get_offsets_ptr());

const auto& offsets = map_column.get_offsets();
const size_t rows = offsets.size();
if (rows <= 0) {
return nullptr;
}
if (key_arr->is_nullable()) {
}
ColumnPtr matched_indices = _get_mapped_idx(*key_arr, arguments[1]);
if (!matched_indices) {
return nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ value1
-- !sql --
20

-- !element_at_short_circuit_evaluation_test --
\N
\N

-- !sql --
0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,29 @@ suite("map-md", "p0") {
qt_sql """ SELECT {'Alice': 20}['Alice']; """

qt_sql """ SELECT ELEMENT_AT({'Alice': 20}, 'Alice');"""


// test whether ELEMENT_AT executes normally in short-circuit-evaluation
sql """ DROP TABLE IF EXISTS test_map_sc; """
sql """ CREATE TABLE test_map_sc (
id INT,
join_key DATE,
col_map MAP<DATEV2, DATEV2>
)PROPERTIES ("replication_num" = "1");
"""
sql """INSERT INTO test_map_sc VALUES
(1, '2024-01-01', {'2024-01-01': '2024-01-02'}),
(2, '2024-01-02', {'2024-01-01': '2024-01-03'});
"""
sql """ SET short_circuit_evaluation = true; """
qt_element_at_short_circuit_evaluation_test """
SELECT
CASE
WHEN id > 0 THEN 1
ELSE element_at(col_map, DATE '2024-01-01')
END
FROM test_map_sc;
"""
sql """ SET short_circuit_evaluation = false; """

qt_sql """ DROP TABLE IF EXISTS ${tableName}; """
sql """
Expand Down
Loading