Skip to content

query via UI causes uncaught exception in cpp sdk code #355

@antonkovalenko

Description

@antonkovalenko
Member

when I run a query via cli (sql or yql command) it works as expected

Query run via UI causes a node failure

episodes is a table from basic example from docs.


$f = ($a) -> {
    return AsTuple("abc", $a.season_id);
};

select $f(TableRow()) from episodes;

Dec  6 18:31:45 xxx0215 kikimr_31003[4049706]: ======= terminate() call stack ========
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 0. /-S/contrib/ydb/public/sdk/cpp/client/ydb_types/fatal_error_handlers/handlers.cpp:7: NYdb::ThrowFatalError(TBasicString<char, std::__y1::char_traits<char>> const&) @ 0x55652D05816C
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 1. /-S/contrib/ydb/public/sdk/cpp/client/ydb_value/value.cpp:26: NYdb::CheckKind(NYdb::TTypeParser::ETypeKind, NYdb::TTypeParser::ETypeKind, TBasicString<char, std::__y1::char_traits<char>> const&) @ 0x55652DC6F85A
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 2. /-S/contrib/ydb/public/sdk/cpp/client/ydb_value/value.cpp:202: bool NYdb::TTypeParser::TImpl::TryNext<(NYdb::TTypeParser::ETypeKind)4>() @ 0x55652DC668A6
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 3. /-S/contrib/ydb/public/sdk/cpp/client/ydb_value/value.cpp:424: NYdb::TTypeParser::TryNextElement() @ 0x55652DC6D7D5
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 4. /-S/contrib/ydb/public/sdk/cpp/client/ydb_value/value.cpp:1344: NYdb::TValueParser::TImpl::TryNextElement() @ 0x55652DC6D7D5
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 5. /-S/contrib/ydb/core/viewer/viewer_query.h:448: NKikimr::NViewer::TJsonQuery::ColumnValueToJsonValue(NYdb::TValueParser&) @ 0x556539BFF3D0
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 6. /-S/contrib/ydb/core/viewer/viewer_query.h:701: NKikimr::NViewer::TJsonQuery::MakeOkReply(NJson::TJsonValue&, NKikimrKqp::TEvQueryResponse&) @ 0x556539BFC0DC
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 7. /-S/contrib/ydb/core/viewer/viewer_query.h:499: NKikimr::NViewer::TJsonQuery::HandleReply(TAutoPtr<NActors::TEventHandle<NKikimr::NKqp::NPrivateEvents::TEvQueryResponse>, TDelete>&) @ 0x556539BFC0DC
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 8. /-S/contrib/ydb/core/viewer/viewer_query.h:187: NKikimr::NViewer::TJsonQuery::StateWork(TAutoPtr<NActors::IEventHandle, TDelete>&) @ 0x556539BFC0DC
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 9. /-S/contrib/ydb/library/actors/core/executor_thread.cpp:251: NActors::TGenericExecutorThread::TProcessingResult NActors::TGenericExecutorThread::Execute<NActors::TMailboxTable::THTSwapMailbox>(NActors::TMailboxTable::THTSwapMailbox*, unsigned int, bool) @ 0x55652A44EB2A
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 10. /-S/contrib/ydb/library/actors/core/executor_thread.cpp:439: NActors::TGenericExecutorThread::ProcessExecutorPool(NActors::IExecutorPool*)::$_0::operator()(unsigned int, bool) const @ 0x55652A444BCA
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 11. /-S/contrib/ydb/library/actors/core/executor_thread.cpp:492: NActors::TGenericExecutorThread::ProcessExecutorPool(NActors::IExecutorPool*) @ 0x55652A44441F
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 12. /-S/contrib/ydb/library/actors/core/executor_thread.cpp:523: NActors::TExecutorThread::ThreadProc() @ 0x55652A445804
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 13. /-S/util/system/thread.cpp:244: (anonymous namespace)::TPosixThread::ThreadProxy(void*) @ 0x556529ED1859
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 14. ??:0: ?? @ 0x7FF88F827608
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: 15. ??:0: ?? @ 0x7FF88F747352
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: =======================================
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]: uncaught exception:
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]:     address -> 0x549d7b53e210
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]:     what() -> "TryNext(): invalid state, expected type: Tuple, actual: Optional"
Dec  6 18:31:53 xxx0215 kikimr_31003[4049706]:     type -> NYdb::TContractViolation

Activity

Gazizonoki

Gazizonoki commented on Dec 13, 2024

@Gazizonoki
Collaborator

Hello, I didn't quite understand what you mean. The fact that the exception wasn't caught is not an SDK issue. The user should handle it. Specifically, this exception was thrown by the SDK because TValue was assembled incorrectly. Most likely, TType with Optional was passed to it, but it was assembled as a Tuple. However, we need to take a closer look at the UI code here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @antonkovalenko@Gazizonoki

        Issue actions

          query via UI causes uncaught exception in cpp sdk code · Issue #355 · ydb-platform/ydb-cpp-sdk