Skip to content

Commit

Permalink
[INLONG-11372][SDK] LocalTimeFunction may fail in some situation
Browse files Browse the repository at this point in the history
  • Loading branch information
emptyOVO committed Oct 18, 2024
1 parent 396ca13 commit 3fdee2a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;
import java.util.HashMap;
import java.util.List;

Expand All @@ -41,7 +43,13 @@ public void testLocalTimeFunction() throws Exception {
TransformProcessor<String, String> processor1 = TransformProcessor
.create(config1, SourceDecoderFactory.createCsvDecoder(csvSource),
SinkEncoderFactory.createKvEncoder(kvSink));
DateTimeFormatter fomatter = DateTimeFormatter.ofPattern("HH:mm:ss");
DateTimeFormatter fomatter = new DateTimeFormatterBuilder()
.appendPattern("HH:mm")
.optionalStart()
.appendPattern(":ss")
.optionalEnd()
.parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0)
.toFormatter();
// case1: localTime()
List<String> output1 = processor1.transform("", new HashMap<>());
LocalTime expectedTime1 = LocalTime.now().withNano(0);
Expand Down

0 comments on commit 3fdee2a

Please sign in to comment.