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

Liya Fan commented on ARROW-5264:
---------------------------------

I totally agree with you. Making the flag non-final will miss many optimization 
opportunities. 

I can see 3 ways to override the flag: 
1) provide the system property from the command line. The command line may not 
be accessible. 
2) control the order of class loading so the static initialization for 
BoundaryChecking class is executed after the system property is set.
3) override the flag by reflection (this may not feasible in some cases)

In my opinion, none of the these options are reliable. I think an environmental 
variable may be a better choice.
What do you think? Do you have any other suggestions?

Best,
Liya Fan

> [Java] Allow enabling/disabling boundary checking dynamically in the code
> -------------------------------------------------------------------------
>
>                 Key: ARROW-5264
>                 URL: https://issues.apache.org/jira/browse/ARROW-5264
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Java
>            Reporter: Liya Fan
>            Assignee: Liya Fan
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: screenshot-1.png
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The flag BoundsChecking#BOUNDS_CHECKING_ENABLED determines if boundary 
> checking is enabled/disabled in vector/arrow buffer APIs. 
> It has significant performance implications, since boundary checking is a 
> frequent operation.
> This issue address 2 problems with the flag for boundary checking in Java API:
> 1. This flag is final and initialized in a static block. That means, the only 
> reliable way to override it is in the JVM command line, by providing some 
> system properties. However, for some scenarios, it is difficult or even 
> impossible to get access to the JVM command line. Therefore, it is desirable 
> to provide a way to override it dynamically in the program code. 
> 2. There is an old and a new system property for this flag. To disable 
> boundary checking, both the old and new properties must be set to true, which 
> is undesirable:
>  !screenshot-1.png! 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to