fix(gpt): fix error.

This commit is contained in:
Haojun Liao 2025-03-21 17:31:15 +08:00
parent b4e5aafac2
commit f2e9193a95
3 changed files with 6 additions and 6 deletions

View File

@ -327,7 +327,7 @@ static int32_t anomalyParseJson(SJson* pJson, SArray* pWindows, const char* pId)
qError("%s failed to exec forecast, msg:%s", pId, pMsg); qError("%s failed to exec forecast, msg:%s", pId, pMsg);
} }
return TSDB_CODE_ANA_INTERNAL_ERROR; return TSDB_CODE_ANA_ANODE_RETURN_ERROR;
} else if (rows == 0) { } else if (rows == 0) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -235,7 +235,7 @@ static int32_t forecastAnalysis(SForecastSupp* pSupp, SSDataBlock* pBlock, const
} }
tjsonDelete(pJson); tjsonDelete(pJson);
return TSDB_CODE_ANA_INTERNAL_ERROR; return TSDB_CODE_ANA_ANODE_RETURN_ERROR;
} }
if (code < 0) { if (code < 0) {

View File

@ -17,7 +17,7 @@ class UtilTest(unittest.TestCase):
def test_generate_anomaly_window(self): def test_generate_anomaly_window(self):
# Test case 1: Normal input # Test case 1: Normal input
wins = convert_results_to_windows([1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1], wins = convert_results_to_windows([1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1],
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], 1)
print(f"The result window is:{wins}") print(f"The result window is:{wins}")
# Assert the number of windows # Assert the number of windows
@ -30,15 +30,15 @@ class UtilTest(unittest.TestCase):
self.assertListEqual(wins[1], [12, 12]) self.assertListEqual(wins[1], [12, 12])
# Test case 2: Anomaly input list is empty # Test case 2: Anomaly input list is empty
wins = convert_results_to_windows([], [1, 2]) wins = convert_results_to_windows([], [1, 2], 1)
self.assertListEqual(wins, []) self.assertListEqual(wins, [])
# Test case 3: Anomaly input list is None # Test case 3: Anomaly input list is None
wins = convert_results_to_windows([], None) wins = convert_results_to_windows([], None, 1)
self.assertListEqual(wins, []) self.assertListEqual(wins, [])
# Test case 4: Timestamp list is None # Test case 4: Timestamp list is None
wins = convert_results_to_windows(None, []) wins = convert_results_to_windows(None, [], 1)
self.assertListEqual(wins, []) self.assertListEqual(wins, [])
def test_validate_input_data(self): def test_validate_input_data(self):