Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Map] Rework MAP creation method behavior when input is NULL #11730

Merged
merged 9 commits into from
Apr 20, 2024
Prev Previous commit
Next Next commit
removed unused enum constants
  • Loading branch information
Tishj committed Apr 19, 2024
commit 8838f07cb47885cdcd9e3a467df048154d4eb9d8
10 changes: 0 additions & 10 deletions src/common/enum_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3802,14 +3802,10 @@ const char* EnumUtil::ToChars<MapInvalidReason>(MapInvalidReason value) {
switch(value) {
case MapInvalidReason::VALID:
return "VALID";
case MapInvalidReason::NULL_KEY_LIST:
return "NULL_KEY_LIST";
case MapInvalidReason::NULL_KEY:
return "NULL_KEY";
case MapInvalidReason::DUPLICATE_KEY:
return "DUPLICATE_KEY";
case MapInvalidReason::NULL_VALUE_LIST:
return "NULL_VALUE_LIST";
case MapInvalidReason::NOT_ALIGNED:
return "NOT_ALIGNED";
case MapInvalidReason::INVALID_PARAMS:
Expand All @@ -3824,18 +3820,12 @@ MapInvalidReason EnumUtil::FromString<MapInvalidReason>(const char *value) {
if (StringUtil::Equals(value, "VALID")) {
return MapInvalidReason::VALID;
}
if (StringUtil::Equals(value, "NULL_KEY_LIST")) {
return MapInvalidReason::NULL_KEY_LIST;
}
if (StringUtil::Equals(value, "NULL_KEY")) {
return MapInvalidReason::NULL_KEY;
}
if (StringUtil::Equals(value, "DUPLICATE_KEY")) {
return MapInvalidReason::DUPLICATE_KEY;
}
if (StringUtil::Equals(value, "NULL_VALUE_LIST")) {
return MapInvalidReason::NULL_VALUE_LIST;
}
if (StringUtil::Equals(value, "NOT_ALIGNED")) {
return MapInvalidReason::NOT_ALIGNED;
}
Expand Down
4 changes: 0 additions & 4 deletions src/common/types/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2089,10 +2089,6 @@ void MapVector::EvalMapInvalidReason(MapInvalidReason reason) {
throw InvalidInputException("Map keys must be unique.");
case MapInvalidReason::NULL_KEY:
throw InvalidInputException("Map keys can not be NULL.");
case MapInvalidReason::NULL_KEY_LIST:
throw InvalidInputException("The list of map keys must not be NULL.");
case MapInvalidReason::NULL_VALUE_LIST:
throw InvalidInputException("The list of map values must not be NULL.");
case MapInvalidReason::NOT_ALIGNED:
throw InvalidInputException("The map key list does not align with the map value list.");
case MapInvalidReason::INVALID_PARAMS:
Expand Down
3 changes: 0 additions & 3 deletions src/function/table/arrow_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,6 @@ static void ArrowToDuckDBMapVerify(Vector &vector, idx_t count) {
case MapInvalidReason::NULL_KEY: {
throw InvalidInputException("Arrow map contains NULL as map key, which isn't supported by DuckDB map type");
}
case MapInvalidReason::NULL_KEY_LIST: {
throw InvalidInputException("Arrow map contains NULL as key list, which isn't supported by DuckDB map type");
}
default: {
throw InternalException("MapInvalidReason not implemented");
}
Expand Down
10 changes: 1 addition & 9 deletions src/include/duckdb/common/types/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,7 @@ struct FSSTVector {
DUCKDB_API static idx_t GetCount(Vector &vector);
};

enum class MapInvalidReason : uint8_t {
VALID,
NULL_KEY_LIST,
NULL_KEY,
DUPLICATE_KEY,
NULL_VALUE_LIST,
NOT_ALIGNED,
INVALID_PARAMS
};
enum class MapInvalidReason : uint8_t { VALID, NULL_KEY, DUPLICATE_KEY, NOT_ALIGNED, INVALID_PARAMS };

struct MapVector {
DUCKDB_API static const Vector &GetKeys(const Vector &vector);
Expand Down
Loading