You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zuozhi Wang (Jira)" <ji...@apache.org> on 2019/10/04 21:07:00 UTC

[jira] [Updated] (CALCITE-3386) CyclicMetadataException gives misleading stack trace

     [ https://issues.apache.org/jira/browse/CALCITE-3386?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zuozhi Wang updated CALCITE-3386:
---------------------------------
    Description: 
Calcite currently reuses the same instance when throwing CyclicMetadataException as shown below. 
{code:java}
/** Singleton instance. Since this exception is thrown for signaling purposes, * rather than on an actual error, re-using a singleton instance saves the * effort of constructing an exception instance. */ 
@SuppressWarnings("ThrowableInstanceNeverThrown") 
public static final CyclicMetadataException INSTANCE = new CyclicMetadataException();
{code}
 

Reusing the same exception instance gives the wrong stack trace, see: [https://stackoverflow.com/questions/15090664/is-it-safe-to-store-an-instance-of-an-exception-and-reuse-it]

The misleading stack trace causes many confusions when debugging. The potential performance impact because of object construction is minor compared to the spent on debugging. Therefore it should be changed to not reuse the singleton instance.

A pull request have been opened to fix this issue: [https://github.com/apache/calcite/pull/1484/files]

 

  was:
Calcite currently reuses the same instance when throwing CyclicMetadataException as shown below. 
{code:java}
/** Singleton instance. Since this exception is thrown for signaling purposes, * rather than on an actual error, re-using a singleton instance saves the * effort of constructing an exception instance. */ 
@SuppressWarnings("ThrowableInstanceNeverThrown") 
public static final CyclicMetadataException INSTANCE = new CyclicMetadataException();
{code}
 

Reusing the same exception instance gives the wrong stack trace, see: [https://stackoverflow.com/questions/15090664/is-it-safe-to-store-an-instance-of-an-exception-and-reuse-it]

The misleading stack trace causes many confusions when debugging. The potential performance impact because of object construction is minor compared to the spent on debugging. Therefore it should be changed to not reuse the singleton instance.

 

 


> CyclicMetadataException gives misleading stack trace
> ----------------------------------------------------
>
>                 Key: CALCITE-3386
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3386
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Zuozhi Wang
>            Priority: Major
>
> Calcite currently reuses the same instance when throwing CyclicMetadataException as shown below. 
> {code:java}
> /** Singleton instance. Since this exception is thrown for signaling purposes, * rather than on an actual error, re-using a singleton instance saves the * effort of constructing an exception instance. */ 
> @SuppressWarnings("ThrowableInstanceNeverThrown") 
> public static final CyclicMetadataException INSTANCE = new CyclicMetadataException();
> {code}
>  
> Reusing the same exception instance gives the wrong stack trace, see: [https://stackoverflow.com/questions/15090664/is-it-safe-to-store-an-instance-of-an-exception-and-reuse-it]
> The misleading stack trace causes many confusions when debugging. The potential performance impact because of object construction is minor compared to the spent on debugging. Therefore it should be changed to not reuse the singleton instance.
> A pull request have been opened to fix this issue: [https://github.com/apache/calcite/pull/1484/files]
>  



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