Skip to content

Commit

Permalink
Column name in parse exceptions (#16529)
Browse files Browse the repository at this point in the history
* first pass

* more changes

* fix tests and formatting

* fix kinesis failing tests

* fix kafka tests

* add dimension name to float parse errors

* double and convertToType handling of dimensionName can report parse errors with dimension name

* fix checkstyle issue

* fix tests

* more cases to have better parse exception messages

* fix test

* fix tests

* partially address comments

* annotate method parameter with nullable

* address comments

* fix tests

* let float, double, long dimensionIndexer pass dimensionName down to dimensionHandlerUtils

* fix compilation error and clean up formatting

* clean up whitespace

* address feedback. undo change, pass down report parse exception for convertToType

* fix test
  • Loading branch information
TSFenwick authored Jun 25, 2024
1 parent e01f155 commit 52c9929
Show file tree
Hide file tree
Showing 13 changed files with 272 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1634,8 +1634,8 @@ public void testMultipleParseExceptionsSuccess() throws Exception

List<String> expectedMessages = Arrays.asList(
"Unable to parse value[notanumber] for field[met1]",
"could not convert value [notanumber] to float",
"could not convert value [notanumber] to long",
"Could not convert value [notanumber] to float for dimension [dimFloat].",
"Could not convert value [notanumber] to long for dimension [dimLong].",
"Unable to parse [] as the intermediateRow resulted in empty input row (Record: 1)",
"Unable to parse row [unparseable] (Record: 1)",
"Encountered row with timestamp[246140482-04-24T15:36:27.903Z] that cannot be represented as a long: [{timestamp=246140482-04-24T15:36:27.903Z, dim1=x, dim2=z, dimLong=10, dimFloat=20.0, met1=1.0}] (Record: 1)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1201,8 +1201,8 @@ public void testMultipleParseExceptionsSuccess() throws Exception

List<String> expectedMessages = Arrays.asList(
"Unable to parse value[notanumber] for field[met1]",
"could not convert value [notanumber] to float",
"could not convert value [notanumber] to long",
"Could not convert value [notanumber] to float for dimension [dimFloat].",
"Could not convert value [notanumber] to long for dimension [dimLong].",
"Timestamp[null] is unparseable! Event: {} (Record: 1)",
"Unable to parse [] as the intermediateRow resulted in empty input row (Record: 1)",
"Unable to parse row [unparseable] (Record: 1)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void testDimensionParseExceptions()
);
result = InputRowSerde.toBytes(InputRowSerde.getTypeHelperMap(dimensionsSpec), in, aggregatorFactories);
Assert.assertEquals(
Collections.singletonList("could not convert value [d1v] to long"),
Collections.singletonList("Could not convert value [d1v] to long."),
result.getParseExceptionMessages()
);

Expand All @@ -231,7 +231,7 @@ public void testDimensionParseExceptions()
);
result = InputRowSerde.toBytes(InputRowSerde.getTypeHelperMap(dimensionsSpec), in, aggregatorFactories);
Assert.assertEquals(
Collections.singletonList("could not convert value [d1v] to float"),
Collections.singletonList("Could not convert value [d1v] to float."),
result.getParseExceptionMessages()
);

Expand All @@ -242,7 +242,7 @@ public void testDimensionParseExceptions()
);
result = InputRowSerde.toBytes(InputRowSerde.getTypeHelperMap(dimensionsSpec), in, aggregatorFactories);
Assert.assertEquals(
Collections.singletonList("could not convert value [d1v] to double"),
Collections.singletonList("Could not convert value [d1v] to double."),
result.getParseExceptionMessages()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,8 @@ public void testMultipleParseExceptionsSuccess() throws Exception
tmpFile.toURI()
),
"Unable to parse value[notnumber] for field[val]",
"could not convert value [notnumber] to float",
"could not convert value [notnumber] to long",
"Could not convert value [notnumber] to float for dimension [dimFloat].",
"Could not convert value [notnumber] to long for dimension [dimLong].",
StringUtils.format(
"Timestamp[unparseable] is unparseable! Event: {time=unparseable, dim=a, dimLong=2, dimFloat=3.0, val=1} (Path: %s, Record: 1, Line: 1)",
tmpFile.toURI()
Expand Down
Loading

0 comments on commit 52c9929

Please sign in to comment.