Skip to content

Commit

Permalink
Fix some bugs in jsonpath (#9146) (#9442)
Browse files Browse the repository at this point in the history
Co-authored-by: Vadim Averin <avevad@ydb.tech>
  • Loading branch information
uzhastik and avevad authored Sep 18, 2024
1 parent ae0f030 commit d40fa72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions ydb/library/yql/minikql/jsonpath/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ ui32 TValue::GetSize() const {
return value->GetDictLength();
}
} else {
Y_ABORT("Unexpected variant case in GetString");
Y_ABORT("Unexpected variant case in GetSize");
}
}

Expand All @@ -287,9 +287,9 @@ TValue TValue::GetElement(ui32 index) const {
if (const auto* value = std::get_if<TContainerCursor>(&Value)) {
return TValue(value->GetElement(index));
} else if (const auto* value = std::get_if<TUnboxedValue>(&Value)) {
return TValue(value->GetElement(index));
return TValue(value->Lookup(TUnboxedValuePod(index)));
} else {
Y_ABORT("Unexpected variant case in GetString");
Y_ABORT("Unexpected variant case in GetElement");
}
}

Expand All @@ -304,7 +304,7 @@ TArrayIterator TValue::GetArrayIterator() const {
}
return TArrayIterator(value->GetListIterator());
} else {
Y_ABORT("Unexpected variant case in GetString");
Y_ABORT("Unexpected variant case in GetArrayIterator");
}
}

Expand Down Expand Up @@ -332,7 +332,7 @@ TMaybe<TValue> TValue::Lookup(const TStringBuf key) const {
return Nothing();
}
} else {
Y_ABORT("Unexpected variant case in GetString");
Y_ABORT("Unexpected variant case in Lookup");
}
}

Expand All @@ -347,7 +347,7 @@ TObjectIterator TValue::GetObjectIterator() const {
}
return TObjectIterator(value->GetDictIterator());
} else {
Y_ABORT("Unexpected variant case in GetString");
Y_ABORT("Unexpected variant case in GetObjectIterator");
}
}

Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/udfs/common/yson2/yson2_udf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ TUnboxedValuePod LookupImpl(TUnboxedValuePod dict, const TUnboxedValuePod key, c
if (index < 0)
index += size;
if constexpr (Converter != nullptr) {
return Converter(dict.GetElement(index).Release(), valueBuilder, pos);
return Converter(dict.Lookup(TUnboxedValuePod(index)).Release(), valueBuilder, pos);
}
return dict.GetElement(index).Release();
return dict.Lookup(TUnboxedValuePod(index)).Release();
}
}
}
Expand Down

0 comments on commit d40fa72

Please sign in to comment.