LakshSingla commented on code in PR #14534:
URL: https://github.com/apache/druid/pull/14534#discussion_r1255233312
##########
sql/src/main/java/org/apache/druid/sql/calcite/external/ExternalOperatorConversion.java:
##########
@@ -106,28 +106,72 @@ public ExternalTableSpec apply(
}
final RowSignature rowSignature;
if (columns != null) {
- rowSignature = Columns.convertSignature(columns);
+ try {
+ rowSignature = Columns.convertSignature(columns);
+ }
+ catch (IAE e) {
+ throw new ArgumentAndException("columns", e);
+ }
} else {
- rowSignature = jsonMapper.readValue(sigValue, RowSignature.class);
+ try {
+ rowSignature = jsonMapper.readValue(sigValue, RowSignature.class);
+ }
+ catch (JsonProcessingException e) {
+ throw new ArgumentAndException("rowSignature", e);
+ }
}
String inputSrcStr = CatalogUtils.getString(args, INPUT_SOURCE_PARAM);
- InputSource inputSource = jsonMapper.readValue(inputSrcStr,
InputSource.class);
+ InputSource inputSource;
+ try {
+ inputSource = jsonMapper.readValue(inputSrcStr, InputSource.class);
+ }
+ catch (JsonProcessingException e) {
+ throw new ArgumentAndException("rowSignature", e);
+ }
+ InputFormat inputFormat;
+ try {
+ inputFormat = jsonMapper.readValue(CatalogUtils.getString(args,
INPUT_FORMAT_PARAM), InputFormat.class);
+ }
+ catch (JsonProcessingException e) {
+ throw new ArgumentAndException("inputFormat", e);
+ }
return new ExternalTableSpec(
inputSource,
- jsonMapper.readValue(CatalogUtils.getString(args,
INPUT_FORMAT_PARAM), InputFormat.class),
+ inputFormat,
rowSignature,
inputSource::getTypes
);
}
- catch (JsonProcessingException e) {
- throw DruidException.forPersona(DruidException.Persona.USER)
- .ofCategory(DruidException.Category.INVALID_INPUT)
- .build(e, e.getMessage());
+ catch (ArgumentAndException e) { // We can triage out the error to one
of the argument passed to the EXTERN function
Review Comment:
Ah yes! Will update the test
--
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]