Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-10961

RuntimeException: Could not extract key when using closure

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.7.0
    • Fix Version/s: None
    • Labels:
      None
    • Release Note:
      couldn't reproduce it on 1.8.0 version . seems to be solved

      Description

      I am getting this exception when I tried to extract the key using external value e.g

      val partitionFactor = 10
      val domainsSrc = env
      .addSource(kafkaConsumer)
      .keyBy(_.id.hashCode % partitionFactor
      .map(...) 
      
      

      I am getting this exception

      java.lang.RuntimeException: Could not extract key from Foo("some-uuid","text",1540348398,1)
      ....
      Caused by: java.lang.ArithmeticException: / by zero
      
      

      however when I simply use it like

      val domainsSrc = env
      .addSource(kafkaConsumer)
      .keyBy(_.id.hashCode % 10
      .map(...) 
      
      

      it works fine

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              avilevi Avi Levi
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: