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

[jira] [Commented] (SPARK-35205) Simplify operationType.getOperationType by using a hashMap.

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

Apache Spark commented on SPARK-35205:
--------------------------------------

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

> Simplify operationType.getOperationType by using a hashMap.
> -----------------------------------------------------------
>
>                 Key: SPARK-35205
>                 URL: https://issues.apache.org/jira/browse/SPARK-35205
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.0.1
>            Reporter: akiyamaneko
>            Priority: Minor
>
> SImply the *getOperationType* method.
>  Introduce a *HashMap* to cache the existed enumeration types, so as to avoid a linear search in a for loop.
>  `*OperationType.getOperationType*` can be called in OperationHandler.constructor:
>  
> {code:java}
>  
> public OperationHandle(TOperationHandle tOperationHandle, TProtocolVersion protocol) {
>   super(tOperationHandle.getOperationId());
>   this.opType = OperationType.getOperationType(tOperationHandle.getOperationType());
>   this.hasResultSet = tOperationHandle.isHasResultSet();
>   this.protocol = protocol;
> }
>  
> {code}
> `*OperationHandle* ` is widely used, It's better to improve the execution efficiency of `OperationType.getOperationType`



--
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