Skip to content

Commit 7dd26c1

Browse files
committed
fix: run tests (#949)
Signed-off-by: Louis Mandel <[email protected]>
1 parent c684621 commit 7dd26c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+138
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"input": {"source_code": "@SuppressWarnings(\"unchecked\")\npublic static Map<String, String> deserializeOffsetMap(String lastSourceOffset) throws IOException {\n Map<String, String> offsetMap;\n if (lastSourceOffset == null || lastSourceOffset.isEmpty()) { \n offsetMap = new HashMap<>(); \n } else {\n offsetMap = JSON_MAPPER.readValue(lastSourceOffset, Map.class); \n }\n return offsetMap;\n}\n", "repo_info": {"repo": "streamsets/datacollector", "path": "stagesupport/src/main/java/com/.../OffsetUtil.java", "function_name": "OffsetUtil.deserializeOffsetMap"}}, "output": "The provided Java code is a static method named `deserializeOffsetMap` within the `OffsetUtil` class in the StreamSets DataCollector repository's `stagesupport/src/main/java/com/` directory, specifically at `com.streamsets.datacollector.onprem.plugin.kafka.offset.OffsetUtil.java`. This method is designed to deserialize a JSON string containing offset information into a `Map<String, String>` object.\n\nHere's an explanation of the code:\n\n1. **Method Signature:**\n ```java\n @SuppressWarnings(\"unchecked\")\n public static Map<String, String> deserializeOffsetMap(String lastSourceOffset) throws IOException;\n ```\n - The method is declared as `public`, `static`, and returns a `Map<String, String>`.\n - It takes one parameter: `lastSourceOffset` of type `String`.\n - The method throws an `IOException`.\n\n2. **Null and Empty Check:**\n ```java\n if (lastSourceOffset == null || lastSourceOffset.isEmpty()) {\n offsetMap = new HashMap<>(); \n } else {\n // ...\n }\n ```\n - If the input string is either `null` or empty, a new `HashMap<String, String>` named `offsetMap` is created and assigned to it.\n\n3. **Deserialization:**\n ```java\n offsetMap = JSON_MAPPER.readValue(lastSourceOffset, Map.class);\n ```\n - If the input string isn't null or empty, the method uses a `JSON_MAPPER` object (assumed to be an instance of a JSON parser like Jackson's `ObjectMapper`) to deserialize it into a `Map<String, String>`. The `readValue()` function is called with two arguments:\n 1. The input string (`lastSourceOffset`).\n 2. A type argument `Map.class`, indicating that the method expects a map as output.\n\n4. **Return Statement:**\n ```java\n return offsetMap;\n ```\n - After processing, the deserialized or default-constructed `offsetMap` is returned.\n\nIn summary, this function takes a JSON string representing an offset map and returns it as a `Map<String, String>`. If no input string is provided (null or empty), it creates a new empty map; otherwise, it deserializes the given JSON string into a map using a JSON parser. The `@SuppressWarnings(\"unchecked\")` annotation warns about potential unchecked casts in the code but doesn't affect its functionality since `Map<String, String>` is a known type.", "metric": 0.19340463458110513}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. When searching for a birthday for a person, simply ask for the name of that person.
2+
Thought: I need to find out who discovered the Hudson River and then calculate how many years ago their birthdate was.
3+
Action:
4+
[{"name": "Search", "arguments": {"topic": "Henry Hudson"}}]
5+
Observation: Henry Hudson (c. 1565 – disappeared 23 June 1611) was an English sea explorer and navigator during the early 17th century, best known for his explorations of present-day Canada and parts of the Northeastern United States.
6+
In 1607 and 1608, Hudson made two attempts on behalf of English merchants to find a rumoured Northeast Passage to Cathay via a route above the Arctic Circle. In 1609, he landed in North America on behalf of the Dutch East India Company and explored the region around the modern New York metropolitan area. Looking for a Northwest Passage to Asia on his ship Halve Maen ("Half Moon"), he sailed up the Hudson River, which was later named after him, and thereby laid the foundation for Dutch colonization of the region. His contributions to the exploration of the New World were significant and lasting. His voyages helped to establish European contact with the native peoples of North America and contributed to the development of trade and commerce.
7+
On his final expedition, while still searching for the Northwest Passage, Hudson became the first European to see Hudson Strait and the immense Hudson Bay. In 1611, after wintering on the shore of James Bay, Hudson wanted to press on to the west, but most of his crew mutinied. The mutineers cast Hudson, his son, and six others adrift; what then happened to the Hudsons and their companions is unknown.
8+
Thought: Henry Hudson discovered the Hudson River in 1609. I need to find out when he was born.
9+
10+
Action:
11+
[{"name": "Search", "arguments": {"topic": "Henry Hudson birthdate"}}]
12+
Observation: Page id "henry hudson birthday" does not match any pages. Try another id!
13+
Apologies for the confusion, but it seems there's no specific information available about Henry Hudson's exact birthdate. However, he is estimated to have been born around 1565.
14+
15+
16+
Thought: Since I can't find an exact birthdate, I'll use the approximate year and calculate based on that.
17+
18+
19+
Action:
20+
[{"name": "Calc", "arguments": {"expr": "2025 - 1565"}}]
21+
Observation: 460
22+
In the year 2025, it would be approximately 460 years ago that Henry Hudson was born.Action:
23+
[{"name": "Finish", "arguments": {"topic": "460"}}]
24+
Observation:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Answer the questions to the best of your abilities.
2+
3+
Result: {'answer': '1. Jacob earns $6 per hour.\n2. Jake earns thrice what Jacob does, so Jake earns 3 * $6 = $18 per hour.\n3. Jake works 8 hours a day, so he earns $18 * 8 = $144 per day.\n4. Jake works 5 days, so he earns $144 * 5 = $720 in 5 days.\nThe answer is $720.'}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Result: {'answer': '$720'}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Result: {'answer': 'Jake earns $18 per hour. In 5 days, working 8 hours a day, Jake works 5 * 8 = 40 hours. Therefore, Jake earns 40 * $18 = $720 in 5 days.\n\nAnswer: $720'}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. When searching for a birthday for a person, simply ask for the name of that person.
2+
Thought: I need to find out who discovered the Hudson River and then calculate how many years ago their birthdate was.
3+
Action:
4+
[{"name": "Search", "arguments": {"topic": "Henry Hudson"}}]
5+
Observation: Henry Hudson (c. 1565 – disappeared 23 June 1611) was an English sea explorer and navigator during the early 17th century, best known for his explorations of present-day Canada and parts of the Northeastern United States.
6+
In 1607 and 1608, Hudson made two attempts on behalf of English merchants to find a rumoured Northeast Passage to Cathay via a route above the Arctic Circle. In 1609, he landed in North America on behalf of the Dutch East India Company and explored the region around the modern New York metropolitan area. Looking for a Northwest Passage to Asia on his ship Halve Maen ("Half Moon"), he sailed up the Hudson River, which was later named after him, and thereby laid the foundation for Dutch colonization of the region. His contributions to the exploration of the New World were significant and lasting. His voyages helped to establish European contact with the native peoples of North America and contributed to the development of trade and commerce.
7+
On his final expedition, while still searching for the Northwest Passage, Hudson became the first European to see Hudson Strait and the immense Hudson Bay. In 1611, after wintering on the shore of James Bay, Hudson wanted to press on to the west, but most of his crew mutinied. The mutineers cast Hudson, his son, and six others adrift; what then happened to the Hudsons and their companions is unknown.
8+
Thought: Henry Hudson discovered the Hudson River in 1609. I need to find out when he was born.
9+
10+
Action:
11+
[{"name": "Search", "arguments": {"topic": "Henry Hudson birthdate"}}]
12+
Observation: Page id "henry hudson birthday" does not match any pages. Try another id!
13+
Apologies for the confusion, but it seems there's no specific information available about Henry Hudson's exact birthdate. However, he is estimated to have been born around 1565.
14+
15+
16+
Thought: Since I can't find an exact birthdate, I'll use the approximate year and calculate based on that.
17+
18+
19+
Action:
20+
[{"name": "Calc", "arguments": {"expr": "2025 - 1565"}}]
21+
Observation: 460
22+
In the year 2025, it would be approximately 460 years ago that Henry Hudson was born.Action:
23+
[{"name": "Finish", "arguments": {"topic": "460"}}]

0 commit comments

Comments
 (0)