|
@@ -9718,6 +9718,8 @@ void HqlCppTranslator::buildFormatCrcFunction(BuildCtx & ctx, const char * name,
|
|
{
|
|
{
|
|
IHqlExpression * payload = expr ? expr->queryAttribute(_payload_Atom) : NULL;
|
|
IHqlExpression * payload = expr ? expr->queryAttribute(_payload_Atom) : NULL;
|
|
OwnedHqlExpr exprToCrc = getSerializedForm(dataset->queryRecord(), diskAtom);
|
|
OwnedHqlExpr exprToCrc = getSerializedForm(dataset->queryRecord(), diskAtom);
|
|
|
|
+
|
|
|
|
+ //MORE: Should this take FILEPOSITION(FALSE) into account?
|
|
unsigned payloadSize = 1;
|
|
unsigned payloadSize = 1;
|
|
if (payload)
|
|
if (payload)
|
|
payloadSize = (unsigned)getIntValue(payload->queryChild(0)) + payloadDelta;
|
|
payloadSize = (unsigned)getIntValue(payload->queryChild(0)) + payloadDelta;
|
|
@@ -9729,10 +9731,10 @@ void HqlCppTranslator::buildFormatCrcFunction(BuildCtx & ctx, const char * name,
|
|
doBuildUnsignedFunction(ctx, name, crc);
|
|
doBuildUnsignedFunction(ctx, name, crc);
|
|
}
|
|
}
|
|
|
|
|
|
-static void createOutputIndexRecord(HqlMapTransformer & mapper, HqlExprArray & fields, IHqlExpression * record, bool isMainRecord, bool allowTranslate)
|
|
|
|
|
|
+static void createOutputIndexRecord(HqlMapTransformer & mapper, HqlExprArray & fields, IHqlExpression * record, bool hasFileposition, bool allowTranslate)
|
|
{
|
|
{
|
|
unsigned numFields = record->numChildren();
|
|
unsigned numFields = record->numChildren();
|
|
- unsigned max = isMainRecord ? numFields-1 : numFields;
|
|
|
|
|
|
+ unsigned max = hasFileposition ? numFields-1 : numFields;
|
|
for (unsigned idx=0; idx < max; idx++)
|
|
for (unsigned idx=0; idx < max; idx++)
|
|
{
|
|
{
|
|
IHqlExpression * cur = record->queryChild(idx);
|
|
IHqlExpression * cur = record->queryChild(idx);
|
|
@@ -9799,10 +9801,10 @@ static void createOutputIndexRecord(HqlMapTransformer & mapper, HqlExprArray & f
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static void createOutputIndexTransform(HqlExprArray & assigns, IHqlExpression * self, IHqlExpression * tgtRecord, IHqlExpression * srcRecord, IHqlExpression* srcDataset, bool isMainRecord, bool allowTranslate)
|
|
|
|
|
|
+static void createOutputIndexTransform(HqlExprArray & assigns, IHqlExpression * self, IHqlExpression * tgtRecord, IHqlExpression * srcRecord, IHqlExpression* srcDataset, bool hasFileposition, bool allowTranslate)
|
|
{
|
|
{
|
|
unsigned numFields = srcRecord->numChildren();
|
|
unsigned numFields = srcRecord->numChildren();
|
|
- unsigned max = isMainRecord ? numFields-1 : numFields;
|
|
|
|
|
|
+ unsigned max = hasFileposition ? numFields-1 : numFields;
|
|
for (unsigned idx=0; idx < max; idx++)
|
|
for (unsigned idx=0; idx < max; idx++)
|
|
{
|
|
{
|
|
IHqlExpression * cur = srcRecord->queryChild(idx);
|
|
IHqlExpression * cur = srcRecord->queryChild(idx);
|
|
@@ -9847,19 +9849,19 @@ static void createOutputIndexTransform(HqlExprArray & assigns, IHqlExpression *
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-void HqlCppTranslator::doBuildIndexOutputTransform(BuildCtx & ctx, IHqlExpression * record, SharedHqlExpr & rawRecord)
|
|
|
|
|
|
+void HqlCppTranslator::doBuildIndexOutputTransform(BuildCtx & ctx, IHqlExpression * record, SharedHqlExpr & rawRecord, bool hasFileposition)
|
|
{
|
|
{
|
|
OwnedHqlExpr srcDataset = createDataset(no_anon, LINK(record));
|
|
OwnedHqlExpr srcDataset = createDataset(no_anon, LINK(record));
|
|
|
|
|
|
HqlExprArray fields;
|
|
HqlExprArray fields;
|
|
HqlExprArray assigns;
|
|
HqlExprArray assigns;
|
|
HqlMapTransformer mapper;
|
|
HqlMapTransformer mapper;
|
|
- createOutputIndexRecord(mapper, fields, record, true, true);
|
|
|
|
|
|
+ createOutputIndexRecord(mapper, fields, record, hasFileposition, true);
|
|
|
|
|
|
OwnedHqlExpr newRecord = createRecord(fields);
|
|
OwnedHqlExpr newRecord = createRecord(fields);
|
|
rawRecord.set(newRecord);
|
|
rawRecord.set(newRecord);
|
|
OwnedHqlExpr self = getSelf(newRecord);
|
|
OwnedHqlExpr self = getSelf(newRecord);
|
|
- createOutputIndexTransform(assigns, self, newRecord, record, srcDataset, true, true);
|
|
|
|
|
|
+ createOutputIndexTransform(assigns, self, newRecord, record, srcDataset, hasFileposition, true);
|
|
|
|
|
|
OwnedHqlExpr tgtDataset = createDataset(no_anon, newRecord.getLink());
|
|
OwnedHqlExpr tgtDataset = createDataset(no_anon, newRecord.getLink());
|
|
OwnedHqlExpr transform = createValue(no_newtransform, makeTransformType(newRecord->getType()), assigns);
|
|
OwnedHqlExpr transform = createValue(no_newtransform, makeTransformType(newRecord->getType()), assigns);
|
|
@@ -9876,8 +9878,12 @@ void HqlCppTranslator::doBuildIndexOutputTransform(BuildCtx & ctx, IHqlExpressio
|
|
doTransform(subctx, transform, selfCursor);
|
|
doTransform(subctx, transform, selfCursor);
|
|
|
|
|
|
OwnedHqlExpr fposVar = createVariable("filepos", makeIntType(8, false));
|
|
OwnedHqlExpr fposVar = createVariable("filepos", makeIntType(8, false));
|
|
- OwnedHqlExpr fposField = createSelectExpr(LINK(srcDataset), LINK(queryLastField(record)));
|
|
|
|
- buildAssignToTemp(subctx, fposVar, fposField);
|
|
|
|
|
|
+ OwnedHqlExpr fposValue;
|
|
|
|
+ if (hasFileposition)
|
|
|
|
+ fposValue.setown(createSelectExpr(LINK(srcDataset), LINK(queryLastField(record))));
|
|
|
|
+ else
|
|
|
|
+ fposValue.setown(getSizetConstant(0));
|
|
|
|
+ buildAssignToTemp(subctx, fposVar, fposValue);
|
|
|
|
|
|
buildReturnRecordSize(subctx, selfCursor);
|
|
buildReturnRecordSize(subctx, selfCursor);
|
|
|
|
|
|
@@ -10031,6 +10037,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityOutputIndex(BuildCtx & ctx, IH
|
|
IHqlExpression * compressAttr = expr->queryAttribute(compressedAtom);
|
|
IHqlExpression * compressAttr = expr->queryAttribute(compressedAtom);
|
|
IHqlExpression * widthExpr = queryAttributeChild(expr, widthAtom, 0);
|
|
IHqlExpression * widthExpr = queryAttributeChild(expr, widthAtom, 0);
|
|
bool hasTLK = !expr->hasAttribute(noRootAtom);
|
|
bool hasTLK = !expr->hasAttribute(noRootAtom);
|
|
|
|
+ bool hasFileposition = getBoolAttribute(expr, filepositionAtom, true);
|
|
bool singlePart = expr->hasAttribute(fewAtom);
|
|
bool singlePart = expr->hasAttribute(fewAtom);
|
|
if (matchesConstantValue(widthExpr, 1))
|
|
if (matchesConstantValue(widthExpr, 1))
|
|
{
|
|
{
|
|
@@ -10115,7 +10122,7 @@ ABoundActivity * HqlCppTranslator::doBuildActivityOutputIndex(BuildCtx & ctx, IH
|
|
}
|
|
}
|
|
|
|
|
|
OwnedHqlExpr rawRecord;
|
|
OwnedHqlExpr rawRecord;
|
|
- doBuildIndexOutputTransform(instance->startctx, record, rawRecord);
|
|
|
|
|
|
+ doBuildIndexOutputTransform(instance->startctx, record, rawRecord, hasFileposition);
|
|
buildFormatCrcFunction(instance->classctx, "getFormatCrc", rawRecord, expr, 0);
|
|
buildFormatCrcFunction(instance->classctx, "getFormatCrc", rawRecord, expr, 0);
|
|
|
|
|
|
if (compressAttr && compressAttr->hasAttribute(rowAtom))
|
|
if (compressAttr && compressAttr->hasAttribute(rowAtom))
|