You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yang Jie (Jira)" <ji...@apache.org> on 2021/04/12 12:53:00 UTC

[jira] [Created] (SPARK-35029) Extract `tryOrFetchFailedException` method to eliminate duplicate code in `BufferReleasingInputStream`

Yang Jie created SPARK-35029:
--------------------------------

             Summary: Extract `tryOrFetchFailedException` method to eliminate duplicate code in `BufferReleasingInputStream`
                 Key: SPARK-35029
                 URL: https://issues.apache.org/jira/browse/SPARK-35029
             Project: Spark
          Issue Type: Improvement
          Components: Spark Core
    Affects Versions: 3.2.0
            Reporter: Yang Jie


There are some duplicate code patterns in `BufferReleasingInputStream`, such as 

 
{code:java}
override def read(): Int = { try { delegate.read() } catch { case e: IOException if detectCorruption => IOUtils.closeQuietly(this) iterator.throwFetchFailedException(blockId, mapIndex, address, e) } }
{code}
, 

 
{code:java}
override def read(b: Array[Byte]): Int = {    try {      delegate.read(b)    } catch {      case e: IOException if detectCorruption =>        IOUtils.closeQuietly(this)        iterator.throwFetchFailedException(blockId, mapIndex, address, e)    }  }
{code}
 

and

 
{code:java}
override def read(b: Array[Byte], off: Int, len: Int): Int = {    try {      delegate.read(b, off, len)    } catch {      case e: IOException if detectCorruption =>        IOUtils.closeQuietly(this)        iterator.throwFetchFailedException(blockId, mapIndex, address, e)    }  }
{code}
 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org