Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-16329

[Java][C++] Keep more context when marshalling errors through JNI

    XMLWordPrintableJSON

Details

    Description

      When errors are propagated through the JNI barrier, two mechanisms are involved:

      • the Status CheckException(JNIEnv* env) function for Java-to-C++ error translation
      • the JniAssertOkOrThrow(arrow::Status status) and T JniGetOrThrow(arrow::Result<T> result) functions for C++-to-Java error translation

      Currently, both mechanisms lose most context about the original error, such as its type and any additional state, such as the optional StatusDetail in C++ or any properties in Java (which I'm sure exist on some exception classes).

      We should improve these mechanisms to retain as much context as possible. For example, in a hypothetical Java-to-C++-to-Java error propagation scenario, the original Java exception from inner code should ideally be re-thrown in the outer Java context (we already support this in Python btw).

      Attachments

        Issue Links

          Activity

            People

              zhztheplayer Hongze Zhang
              apitrou Antoine Pitrou
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 5.5h
                  5.5h