walterddr commented on a change in pull request #7692:
URL: https://github.com/apache/pinot/pull/7692#discussion_r743172970



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/common/datatable/DataTableImplV3.java
##########
@@ -175,8 +175,11 @@ public DataTableImplV3(ByteBuffer byteBuffer)
   }
 
   @Override
-  public void addException(ProcessingException processingException) {
-    _errCodeToExceptionMap.put(processingException.getErrorCode(), 
processingException.getMessage());
+  public void addException(Exception exception) {
+    if (exception instanceof ProcessingException) {
+      ProcessingException processingException = (ProcessingException) 
exception;
+      _errCodeToExceptionMap.put(processingException.getErrorCode(), 
processingException.getMessage());

Review comment:
       This is a workaround for the fact that. ProcessingException is a 
generated class that we can't include in spi --> because it will pull in 
unnecessary dependencies to the SPI module
   
   So instead I opted to relax the interface signature but tighten it during 
impl.

##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/data/DataTable.java
##########
@@ -33,7 +32,7 @@
   // TODO: remove this when we stop supporting DataTable V2.
   String EXCEPTION_METADATA_KEY = "Exception";
 
-  void addException(ProcessingException processingException);
+  void addException(Exception processingException);

Review comment:
       yes. at first I thought i would've been weird to add a generic for the 
exception. But now that I think about it. the exception is part of the data 
transferred between pinot components. it make sense to genericfy the exception 
type to be handled.

##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/data/DataTable.java
##########
@@ -33,7 +32,7 @@
   // TODO: remove this when we stop supporting DataTable V2.
   String EXCEPTION_METADATA_KEY = "Exception";
 
-  void addException(ProcessingException processingException);
+  void addException(Exception processingException);

Review comment:
       actually my bad. it doesn't work since most of the place doesn't rely on 
datatable to have type erasure. so I added the generic exception handling 
instead. 

##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/common/datatable/DataTableImplV2.java
##########
@@ -148,8 +151,13 @@ public DataTableImplV2(ByteBuffer byteBuffer)
   }
 
   @Override
-  public void addException(ProcessingException processingException) {

Review comment:
       oh yeah. that sounds better
   

##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/common/datatable/DataTableImplV3.java
##########
@@ -175,8 +175,11 @@ public DataTableImplV3(ByteBuffer byteBuffer)
   }
 
   @Override
-  public void addException(ProcessingException processingException) {
-    _errCodeToExceptionMap.put(processingException.getErrorCode(), 
processingException.getMessage());
+  public void addException(Exception exception) {
+    if (exception instanceof ProcessingException) {
+      ProcessingException processingException = (ProcessingException) 
exception;
+      _errCodeToExceptionMap.put(processingException.getErrorCode(), 
processingException.getMessage());

Review comment:
       This is a workaround for the fact that. ProcessingException is a 
generated class that we can't include in spi --> because it will pull in 
unnecessary dependencies to the SPI module
   
   So instead I opted to relax the interface signature but tighten it during 
impl.

##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/data/DataTable.java
##########
@@ -33,7 +32,7 @@
   // TODO: remove this when we stop supporting DataTable V2.
   String EXCEPTION_METADATA_KEY = "Exception";
 
-  void addException(ProcessingException processingException);
+  void addException(Exception processingException);

Review comment:
       yes. at first I thought i would've been weird to add a generic for the 
exception. But now that I think about it. the exception is part of the data 
transferred between pinot components. it make sense to genericfy the exception 
type to be handled.

##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/data/DataTable.java
##########
@@ -33,7 +32,7 @@
   // TODO: remove this when we stop supporting DataTable V2.
   String EXCEPTION_METADATA_KEY = "Exception";
 
-  void addException(ProcessingException processingException);
+  void addException(Exception processingException);

Review comment:
       actually my bad. it doesn't work since most of the place doesn't rely on 
datatable to have type erasure. so I added the generic exception handling 
instead. 

##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/common/datatable/DataTableImplV2.java
##########
@@ -148,8 +151,13 @@ public DataTableImplV2(ByteBuffer byteBuffer)
   }
 
   @Override
-  public void addException(ProcessingException processingException) {

Review comment:
       oh yeah. that sounds better
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to