satishd commented on code in PR #13103:
URL: https://github.com/apache/pinot/pull/13103#discussion_r1598341320
##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/recordtransformer/RecordTransformerTest.java:
##########
@@ -272,6 +273,42 @@ record = transformer.transform(record);
assertEquals(record.getValue("mvString2"), new Object[]{"123", "123",
"123.0", "123.0", "123"});
assertNull(record.getValue("$virtual"));
assertTrue(record.getNullValueFields().isEmpty());
+
assertTrue(record.getFieldToValueMap().containsKey(GenericRow.INCOMPLETE_RECORD_KEY));
+ }
+
+ // scenario where string contains null
+ IngestionConfig ingestionConfig = new IngestionConfig();
+ ingestionConfig.setFailOnTrimmedStringLength(true);
+ TableConfig tableConfig =
+ new
TableConfigBuilder(TableType.OFFLINE).setTableName("testTable").setIngestionConfig(ingestionConfig).build();
+ transformer = new SanitizationTransformer(tableConfig, SCHEMA);
+ record = getRecord();
+ for (int i = 0; i < NUM_ROUNDS; i++) {
+ try {
+ record = transformer.transform(record);
+ } catch (Exception e) {
+ assertEquals(e.getMessage(), "Throwing exception as value: 1\0002\0003
for column "
Review Comment:
Can you also check for the `IllegalStateException` type?
##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/recordtransformer/RecordTransformerTest.java:
##########
@@ -272,6 +273,42 @@ record = transformer.transform(record);
assertEquals(record.getValue("mvString2"), new Object[]{"123", "123",
"123.0", "123.0", "123"});
assertNull(record.getValue("$virtual"));
assertTrue(record.getNullValueFields().isEmpty());
+
assertTrue(record.getFieldToValueMap().containsKey(GenericRow.INCOMPLETE_RECORD_KEY));
+ }
+
+ // scenario where string contains null
+ IngestionConfig ingestionConfig = new IngestionConfig();
+ ingestionConfig.setFailOnTrimmedStringLength(true);
+ TableConfig tableConfig =
+ new
TableConfigBuilder(TableType.OFFLINE).setTableName("testTable").setIngestionConfig(ingestionConfig).build();
+ transformer = new SanitizationTransformer(tableConfig, SCHEMA);
+ record = getRecord();
+ for (int i = 0; i < NUM_ROUNDS; i++) {
+ try {
+ record = transformer.transform(record);
+ } catch (Exception e) {
+ assertEquals(e.getMessage(), "Throwing exception as value: 1\0002\0003
for column "
+ + "svStringWithNullCharacters contains null character.");
+ }
+ }
+
+ // scenario where string length exceeds max length
+ Schema schema = new
Schema.SchemaBuilder().addSingleValueDimension("svInt", DataType.INT)
+ .addSingleValueDimension("svDouble", DataType.DOUBLE)
+ .addSingleValueDimension("svStringWithLengthLimit",
DataType.STRING).build();
+ schema.getFieldSpecFor("svStringWithLengthLimit").setMaxLength(2);
+ transformer = new SanitizationTransformer(tableConfig, schema);
+ record = new GenericRow();
+ record.putValue("svInt", (byte) 123);
+ record.putValue("svLong", (char) 123);
+ record.putValue("svStringWithLengthLimit", "123");
+ for (int i = 0; i < NUM_ROUNDS; i++) {
+ try {
+ record = transformer.transform(record);
+ } catch (Exception e) {
+ assertEquals(e.getMessage(), "Throwing exception as value: 123 for
column svStringWithLengthLimit "
Review Comment:
Can you also check for the `IllegalStateException` type?
--
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]