prestodb/presto · error · PrestoException
INVALID_FUNCTION_ARGUMENT
INVALID_FUNCTION_ARGUMENT
Error message
Key-value delimiter must appear exactly once in each entry. Bad input:
What it means
split_to_multimap (like split_to_map but producing a multimap) requires each entry to contain the key-value delimiter at least once. When indexOf(keyValueDelimiter) < 0 for a pair, the entry cannot be decomposed into key and value, so INVALID_FUNCTION_ARGUMENT is thrown with the bad pair.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/SplitToMultimapFunction.java:71
Multimap<Slice, Slice> multimap = ArrayListMultimap.create();
int entryStart = 0;
while (entryStart < string.length()) {
// Extract key-value pair based on current index
// then add the pair if it can be split by keyValueDelimiter
Slice keyValuePair;
int entryEnd = string.indexOf(entryDelimiter, entryStart);
if (entryEnd >= 0) {
keyValuePair = string.slice(entryStart, entryEnd - entryStart);
}
else {
// The rest of the string is the last possible pair.
keyValuePair = string.slice(entryStart, string.length() - entryStart);
}
int keyEnd = keyValuePair.indexOf(keyValueDelimiter);
if (keyEnd < 0) {
throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Key-value delimiter must appear exactly once in each entry. Bad input: " + keyValuePair.toStringUtf8());
}
int valueStart = keyEnd + keyValueDelimiter.length();
Slice key = keyValuePair.slice(0, keyEnd);
Slice value = keyValuePair.slice(valueStart, keyValuePair.length() - valueStart);
if (value.indexOf(keyValueDelimiter) >= 0) {
throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Key-value delimiter must appear exactly once in each entry. Bad input: " + keyValuePair.toStringUtf8());
}
multimap.put(key, value);
if (entryEnd < 0) {
// No more pairs to add
break;
}
// Next possible pair is placed next to the current entryDelimiter
entryStart = entryEnd + entryDelimiter.length();
}View on GitHub (pinned to 55bb57d202)
Solutions
- Ensure every entry contains the key-value delimiter; clean input first (remove empty/bare tokens).
- Use the correct delimiter for the data format.
- Wrap the call in try() to degrade to NULL on malformed entries.
- Pre-split manually (split → unnest → filter entries containing '=' → rebuild) to skip bad pairs.
Example fix
-- before
SELECT split_to_multimap('a=1,b', '=', ',');
-- after
SELECT split_to_multimap('a=1,b=2', '=', ','); Defensive patterns
Strategy: validation
Validate before calling
SELECT split_to_multimap(array_join(filter(split(s, ','), e -> contains(e, '=')), ','), '=', ',')
Try / catch
SELECT try(split_to_multimap(s, '=', ',')) AS mm;
When it happens
Trigger: split_to_multimap('a=1,b', '=', ',') — entry 'b' has no '='; empty entries produced by trailing delimiters; wrong key-value delimiter passed.
Common situations: Malformed 'k=v' lists from configs or URLs (bare tokens, trailing separators), delimiter mismatch after data format change.
Related errors
- INVALID_FUNCTION_ARGUMENT
- INVALID_FUNCTION_ARGUMENT
- INVALID_TABLE_PROPERTY
- INVALID_FUNCTION_ARGUMENT
- Invalid time from server:
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/37977dd4472c5dea.
Report an issue: GitHub.