From 91895424646b7afd805886006a7eda78a6cbd3f9 Mon Sep 17 00:00:00 2001 From: Gisli Magnusson Date: Sun, 8 Feb 2026 00:50:09 +0000 Subject: [PATCH 1/2] fix(ENGKNOW-3014): Fix norif context, and allow single column -dh for norif. --- .../gorsat/Utilities/gorsatUtilities.scala | 18 +++++++++++++----- gortools/src/test/java/gorsat/UTestNorif.java | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gortools/src/main/scala/gorsat/Utilities/gorsatUtilities.scala b/gortools/src/main/scala/gorsat/Utilities/gorsatUtilities.scala index 404e68a8..ec557715 100644 --- a/gortools/src/main/scala/gorsat/Utilities/gorsatUtilities.scala +++ b/gortools/src/main/scala/gorsat/Utilities/gorsatUtilities.scala @@ -56,12 +56,20 @@ object Utilities { // return an iterator that only delivers the header defined with -dh. val header = stringValueOfOption(args, "-dh") val headerCols = header.split(",") - if (headerCols.length < 2 || headerCols(0).isEmpty || headerCols(1).isEmpty) { - throw new GorParsingException("-dh requires at least 2 non-empty comma-separated values") - } val inputSource = RowListIterator(List()) - if (isNor) inputSource.setHeader(HEADER_PREFIX + headerCols.mkString("\t")) else inputSource.setHeader(headerCols.mkString("\t")) - InputSourceParsingResult(inputSource, header, isNorContext = false) + if (isNor) { + if (headerCols.length < 1 || headerCols(0).isEmpty) { + throw new GorParsingException("For NOR -dh requires at least 1 non-empty value") + } + inputSource.setHeader(HEADER_PREFIX + headerCols.mkString("\t")) + } else { + if (headerCols.length < 2 || headerCols(0).isEmpty || headerCols(1).isEmpty) { + throw new GorParsingException("For GOR -dh requires at least 2 non-empty comma-separated values") + } + inputSource.setHeader(headerCols.mkString("\t")) + } + + InputSourceParsingResult(inputSource, header, isNorContext = isNor) } } diff --git a/gortools/src/test/java/gorsat/UTestNorif.java b/gortools/src/test/java/gorsat/UTestNorif.java index e08e2de6..b426fb4f 100644 --- a/gortools/src/test/java/gorsat/UTestNorif.java +++ b/gortools/src/test/java/gorsat/UTestNorif.java @@ -80,9 +80,10 @@ public static Collection data() throws IOException { {"Nested query started with norif", "norif <(nor " + testTsvFile1 + ")", expectedHeader + "chrN\t0\tA\t1\tA\n", null}, {"Invalid file path", "norif -dh col1,col2 not_exists.tsv", HEADER_PREFIX+ "col1\tcol2\n", null}, + {"Invalid file path, single col", "norif -dh col1 not_exists.tsv", HEADER_PREFIX+ "col1\n", null}, {"Invalid file path missing -dh", "norif not_exists.tsv", null, GorParsingException.class}, {"Empty file missing -dh", "norif " + testEmptyFile, null, GorParsingException.class}, - {"Invalid file path with invalid -dh value", "norif -dh col1 not_exists.tsv", null, GorParsingException.class}, + {"Invalid file path with invalid -dh value", "norif not_exists.tsv -dh ", null, GorParsingException.class}, {"Both invalid and valid file path", "norif " + testTsvFile1 + " not_exists.tsv", expectedHeader + "chrN\t0\tA\t1\tA\n", null}, }); From ee0843855ea98c6299ff8191c7209804e57acb1b Mon Sep 17 00:00:00 2001 From: Gisli Magnusson Date: Thu, 26 Feb 2026 12:16:24 +0000 Subject: [PATCH 2/2] fix(ENGKNOW-3014): Fix nor output. --- .../src/main/scala/gorsat/Commands/CommandParseUtilities.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model/src/main/scala/gorsat/Commands/CommandParseUtilities.scala b/model/src/main/scala/gorsat/Commands/CommandParseUtilities.scala index 9246426b..ea2aff27 100644 --- a/model/src/main/scala/gorsat/Commands/CommandParseUtilities.scala +++ b/model/src/main/scala/gorsat/Commands/CommandParseUtilities.scala @@ -802,7 +802,9 @@ object CommandParseUtilities { val INPUT_TO_EXTENSION: Map[String, String] = Map( ("CMD -N", TXT_EXTENSION), ("NORCMD", TXT_EXTENSION), + ("EXEC", TXT_EXTENSION), ("NOR", TSV_EXTENSION), + ("NORIF", TSV_EXTENSION), ("SDL", TSV_EXTENSION), ("NORSQL", TSV_EXTENSION), ("NORSTDIN", TSV_EXTENSION),