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

RuntimeException: Could not extract key when using closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 1.7.0
    • None
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: