Skip to content

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
baomingyu committed May 23, 2024
1 parent 2fcd8fe commit f1412df
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,16 @@ public static class Builder extends TextFormatBuilder<Builder> {
private String timeFieldName = DEFAULT_TIME_FIELD_NAME;
private String attributesFieldName = DEFAULT_ATTRIBUTES_FIELD_NAME;
private Character delimiter = DEFAULT_DELIMITER;
private boolean isIncludeFirstSegment = true;
private boolean isIncludeFirstSegment = false;
public Builder(RowFormatInfo rowFormatInfo) {
super(rowFormatInfo);
}

public Builder setIsIncludeFirstSegment(boolean isIncludeFirstSegment) {
this.isIncludeFirstSegment = isIncludeFirstSegment;
return this;
}

public Builder setTimeFieldName(String timeFieldName) {
this.timeFieldName = timeFieldName;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ public class InLongMsgTlogCsvFormatDeserializerTest {

private static final RowFormatInfo TEST_ROW_INFO =
new RowFormatInfo(
new String[]{"__addcol1_", "__addcol2_", "f1", "f2", "f3", "f4"},
new String[]{"__addcol1_", "__addcol2_", "f1", "f2", "f3"},
new FormatInfo[]{
IntFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE,
IntFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE
Expand All @@ -75,7 +74,7 @@ public void testExceptionHandler() throws Exception {
null,
null,
null,
true,
false,
errorHandler);

InLongMsg inLongMsg1 = InLongMsg.newInLongMsg(true);
Expand Down Expand Up @@ -195,10 +194,12 @@ public void testUnmatchedFields1() throws Exception {
"field1",
"field2",
"field3");

List<Row> expectedRows = new ArrayList<>();
expectedRows.add(expectedRow1);
expectedRows.add(expectedRow2);
testRowDeserialization(
inLongMsg1.buildArray(),
Arrays.asList(expectedRow1, expectedRow2));
expectedRows);
}

@Test
Expand Down Expand Up @@ -240,6 +241,7 @@ private void testRowDeserialization(
new InLongMsgTlogCsvFormatDeserializer.Builder(TEST_ROW_INFO)
.setTimeFieldName("inlongmsg_time")
.setAttributesFieldName("inlongmsg_attributes")
.setIsIncludeFirstSegment(false)
.build();

List<Row> actualRows = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ public class InLongMsgTlogCsvFormatDeserializerTest {

private static final RowFormatInfo TEST_ROW_INFO =
new RowFormatInfo(
new String[]{"__addcol1_", "__addcol2_", "f1", "f2", "f3", "f4"},
new String[]{"__addcol1_", "__addcol2_", "f1", "f2", "f3"},
new FormatInfo[]{
IntFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE,
IntFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE,
StringFormatInfo.INSTANCE
Expand Down Expand Up @@ -260,6 +259,7 @@ public void testRowType() {
new InLongMsgTlogCsvFormatDeserializer.Builder(TEST_ROW_INFO)
.setTimeFieldName("inlongmsg_time")
.setAttributesFieldName("inlongmsg_attributes")
.setIncludeFirstSegment(false)
.setMetadataKeys(Collections.singletonList(STREAMID.getKey()))
.build();

Expand Down

0 comments on commit f1412df

Please sign in to comment.