From 1567f6c2c0204f4f377b8a2289732bdc2017e997 Mon Sep 17 00:00:00 2001 From: James McMullan Date: Wed, 25 Sep 2024 09:45:10 -0400 Subject: [PATCH] Wip --- .../org/hpccsystems/commons/ecl/FieldDef.java | 7 +++- .../ecl/RecordDefinitionTranslator.java | 32 ++++++++++++++----- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/FieldDef.java b/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/FieldDef.java index d13d79c5c..b8f735bcc 100644 --- a/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/FieldDef.java +++ b/commons-hpcc/src/main/java/org/hpccsystems/commons/ecl/FieldDef.java @@ -172,6 +172,11 @@ public HpccSrcType getSourceType() return this.srcType; } + public void setSourceType(HpccSrcType srcType) + { + this.srcType = srcType; + } + /** * Length of data or minimum length if variable. * @@ -307,7 +312,7 @@ public boolean isUnsigned() /** * Is the underlying value biased? * - * @return true when biased + * @return true when biased */ public boolean isBiased() { 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 543e9fe0a..80e8001d8 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 @@ -517,11 +517,6 @@ private static int getTypeID(FieldDef field) throws Exception case INTEGER: { typeID = type_int; - if (field.isUnsigned()) - { - typeID |= FLAG_UNSIGNED; - } - HpccSrcType srcType = field.getSourceType(); if (srcType == HpccSrcType.KEYED_INTEGER) { @@ -535,6 +530,12 @@ else if (srcType == HpccSrcType.BIAS_SWAPPED_INTEGER) { typeID = type_biasedswapint; } + + if (field.isUnsigned()) + { + typeID |= FLAG_UNSIGNED; + } + break; } case DECIMAL: @@ -642,7 +643,7 @@ else if (srcType == HpccSrcType.UTF16LE || srcType == HpccSrcType.UTF16BE) */ private static int getTypeHash(FieldDef field) throws Exception { - int numHashComponents = 2 + field.getNumDefs(); + int numHashComponents = 4 + field.getNumDefs(); if (field.getFieldType() == FieldType.DECIMAL) { numHashComponents += 2; @@ -651,8 +652,10 @@ private static int getTypeHash(FieldDef field) throws Exception long[] hashComponents = new long[numHashComponents]; hashComponents[0] = getTypeID(field); hashComponents[1] = field.getDataLen(); + hashComponents[2] = field.getSourceType().ordinal(); + hashComponents[3] = field.getAdditionalFlags(); - int hashCompIndex = 2; + int hashCompIndex = 4; for (int i = 0; i < field.getNumDefs(); i++, hashCompIndex++) { hashComponents[hashCompIndex] = getTypeHash(field.getDef(i)); @@ -760,7 +763,8 @@ private static int getJsonTypeDefinition(FieldDef field, HashMap