[ 
https://issues.apache.org/jira/browse/SPARK-35029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17319449#comment-17319449
 ] 

Apache Spark commented on SPARK-35029:
--------------------------------------

User 'LuciferYang' has created a pull request for this issue:
https://github.com/apache/spark/pull/32130

> Extract a new 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
>            Priority: Minor
>
> 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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to