From fc5913d176b3b7215c67486e614b7d1f5ab1056b Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 30 Jan 2024 16:14:36 -0700 Subject: [PATCH] Per #2805, update STATAnalysisJob::dump_stat_line() to take an optional argument to indicate whether the set_hdr options should be applied. Update Stat-Analysis to only call dump_stat_line() with set_hdr for filter jobs. --- src/libcode/vx_analysis_util/stat_job.cc | 51 +++++++++++++++---- src/libcode/vx_analysis_util/stat_job.h | 7 ++- .../core/stat_analysis/stat_analysis_job.cc | 2 +- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index 515200d984..ea781a5fc0 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -1450,14 +1450,6 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { i+=2; } else if(jc_array[i] == "-set_hdr") { - n = METHdrTable.header(met_version, "STAT", na_str)->col_offset(to_upper(jc_array[i+1]).c_str()); - if(is_bad_data(n)) { - mlog << Error << "\nSTATAnalysisJob::parse_job_command() -> " - << "no match found for header column named: \"" - << to_upper((string)jc_array[i+1]) << "\"\n\n"; - if(line) { delete [] line; line = (char *) 0; } - throw(1); - } hdr_name.add_css(to_upper(jc_array[i+1])); hdr_value.add_css(jc_array[i+2]); i+=2; @@ -1650,6 +1642,28 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) { } // end for + // Validate set_hdr column names + if(hdr_name.n() > 0) { + + string lt_str = (line_type.n() == 1 ? + line_type[0] : na_str); + + for(i=0; i + col_offset(hdr_name[i].c_str()); + + if(is_bad_data(n)) { + mlog << Error << "\nSTATAnalysisJob::parse_job_command() -> " + << "no match found for " + << (line_type.n() == 1 ? line_type[0] : "header") + << " column named \"" << hdr_name[i] << "\"\n\n"; + if(line) { delete [] line; line = (char *) 0; } + throw(1); + } + } // end for + } + // Expand out_eclv_points if(out_eclv_points.n() == 1) { for(i=2; i*out_eclv_points[0] < 1.0; i++) out_eclv_points.add(i*out_eclv_points[0]); @@ -2130,7 +2144,8 @@ void STATAnalysisJob::close_stat_file() { //////////////////////////////////////////////////////////////////////// -void STATAnalysisJob::dump_stat_line(const STATLine &line) { +void STATAnalysisJob::dump_stat_line(const STATLine &line, + bool do_set_hdr) { int i; // @@ -2268,8 +2283,24 @@ void STATAnalysisJob::dump_stat_line(const STATLine &line) { // Store the data line // for(i=0; i