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
3 changes: 3 additions & 0 deletions be/src/vec/exec/format/json/new_json_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,9 @@ Status NewJsonReader::_simdjson_set_column_value(simdjson::ondemand::object* val
// This key is not exist in slot desc, just ignore
continue;
}
if (_seen_columns[column_index]) {
continue;
}
simdjson::ondemand::value val = field.value();
auto* column_ptr = block.get_by_position(column_index).column->assume_mutable().get();
RETURN_IF_ERROR(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"k1" : 10, "k1" : 100}
2 changes: 2 additions & 0 deletions regression-test/data/load_p0/stream_load/test_json_load.out
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,5 @@ android \N \N \N \N \N
-- !select28 --
test k2_value

-- !select29 --
10 \N
Original file line number Diff line number Diff line change
Expand Up @@ -853,4 +853,29 @@ suite("test_json_load", "p0") {
} finally {
try_sql("DROP TABLE IF EXISTS ${testTable}")
}

// add duplicate json entry case
try {
sql "DROP TABLE IF EXISTS ${testTable}"
sql """CREATE TABLE IF NOT EXISTS ${testTable}
(
`k1` varchar(1024) NULL,
`k2` varchar(1024) NULL
)
DUPLICATE KEY(`k1`)
COMMENT ''
DISTRIBUTED BY RANDOM BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);"""

load_json_data.call("${testTable}", "${testTable}_case29", 'false', 'true', 'json', '', '',
'', '', '', 'test_duplicate_json_keys.json', false, 1)

sql "sync"
qt_select29 "select * from ${testTable}"

} finally {
try_sql("DROP TABLE IF EXISTS ${testTable}")
}
}