From 168d8355c9922f439bfe1bb5307a0be5b10fd500 Mon Sep 17 00:00:00 2001 From: James McMullan Date: Mon, 23 Sep 2024 21:58:42 -0400 Subject: [PATCH] HPCC4J-650 DFSClient should retain integer subtypes - Modified record translation code to maintain integer subtype - Fixed record translation test case - Added index record translation to test case Signed-off-by: James McMullan James.McMullan@lexisnexis.com --- .../hpccsystems/commons/ecl/HpccSrcType.java | 6 +++ .../ecl/RecordDefinitionTranslator.java | 27 ++++++++++-- .../commons/ecl/TestFieldDefinitions.java | 23 ++++++++++ .../commons/ecl/RecordDefinitionTests.java | 42 ++++++++++--------- 4 files changed, 76 insertions(+), 22 deletions(-) diff --git a/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/HpccSrcType.java b/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/HpccSrcType.java index 678c90de1..e0615fc36 100644 --- a/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/HpccSrcType.java +++ b/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/HpccSrcType.java @@ -36,6 +36,12 @@ public enum HpccSrcType "little endian", false ), BINARY_CODED_DECIMAL ( "Binary coded decimal", false + ), KEYED_INTEGER ( + "Non-payload integer field within a key", false + ), SWAPPED_INTEGER ( + "Byte swapped integer, used within keys", false + ), BIAS_SWAPPED_INTEGER ( + "Byte swapped integer, deprecated", false ), UNKNOWN ( "Unkown", false ); diff --git a/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/RecordDefinitionTranslator.java b/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/RecordDefinitionTranslator.java index 7db62895c..543e9fe0a 100644 --- a/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/RecordDefinitionTranslator.java +++ b/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/RecordDefinitionTranslator.java @@ -134,9 +134,12 @@ private static HpccSrcType getSourceType(int typeID) case type_int: case type_real: return HpccSrcType.LITTLE_ENDIAN; - case type_swapint: case type_biasedswapint: + return HpccSrcType.BIAS_SWAPPED_INTEGER; + case type_swapint: + return HpccSrcType.SWAPPED_INTEGER; case type_keyedint: + return HpccSrcType.KEYED_INTEGER; case type_filepos: return HpccSrcType.BIG_ENDIAN; case type_utf8: @@ -272,7 +275,7 @@ private static String getEClTypeDefinition(FieldDef field, HashMap