Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-16196

Cast transform doesn't handle invalid whole value casts gracefully

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.8.0
    • connect
    • None

    Description

      The Cast transform currently doesn't handle invalid whole value casts gracefully. A whole value cast is configured like {"spec": "int8"} as opposed to a field level cast like {"spec": "field1:int8"}.

       

      If an invalid field level cast is specified (for instance - {"spec": "field1:invalid"}), this results in a ConfigException being thrown here - https://github.com/apache/kafka/blob/5f410ceb04878ca44d2d007655155b5303a47907/connect/transforms/src/main/java/org/apache/kafka/connect/transforms/Cast.java#L416 which is handled gracefully as a validation error here - https://github.com/apache/kafka/blob/5f410ceb04878ca44d2d007655155b5303a47907/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java#L605-L609

       

      However, invalid whole value casts (for instance - {"spec": "invalid"}) aren't handled appropriately and result in an 
      IllegalArgumentException being thrown, which surfaces as an uncaught exception and a 500 Internal Server Error response from the connector create / update / config validation REST API endpoint.

      Attachments

        Issue Links

          Activity

            People

              yash.mayya Yash Mayya
              yash.mayya Yash Mayya
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: