-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### Rationale for this change This helps debug Arrow conversion errors from JDBC by exposing the JdbcFieldInfo for the related column and the ArrowType for the corresponding vector. ### What changes are included in this PR? A new JdbcConsumerException which is thrown by the CompositeJdbcConsumer while consuming data for a specific vector. ### Are these changes tested? N/A ### Are there any user-facing changes? Users can now catch `JdbcConsumerException`s and extract the related ArrowType and JdbcFieldInfo from it for debugging. * Closes: #39355 Authored-by: Diego Fernandez <[email protected]> Signed-off-by: David Li <[email protected]>
- Loading branch information
Showing
4 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...rc/main/java/org/apache/arrow/adapter/jdbc/consumer/exceptions/JdbcConsumerException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.arrow.adapter.jdbc.consumer.exceptions; | ||
|
||
import org.apache.arrow.adapter.jdbc.JdbcFieldInfo; | ||
import org.apache.arrow.vector.types.pojo.ArrowType; | ||
|
||
/** | ||
* Exception while consuming JDBC data. This exception stores the JdbcFieldInfo for the column and the | ||
* ArrowType for the corresponding vector for easier debugging. | ||
*/ | ||
public class JdbcConsumerException extends RuntimeException { | ||
final JdbcFieldInfo fieldInfo; | ||
final ArrowType arrowType; | ||
|
||
/** | ||
* Construct JdbcConsumerException with all fields. | ||
* | ||
* @param message error message | ||
* @param cause original exception | ||
* @param fieldInfo JdbcFieldInfo for the column | ||
* @param arrowType ArrowType for the corresponding vector | ||
*/ | ||
public JdbcConsumerException(String message, Throwable cause, JdbcFieldInfo fieldInfo, ArrowType arrowType) { | ||
super(message, cause); | ||
this.fieldInfo = fieldInfo; | ||
this.arrowType = arrowType; | ||
} | ||
|
||
public ArrowType getArrowType() { | ||
return this.arrowType; | ||
} | ||
|
||
public JdbcFieldInfo getFieldInfo() { | ||
return this.fieldInfo; | ||
} | ||
} |