Docs: Document the ONCE workflow service

Description

Example:

x := SomeFunction() : ONCE;

This code appears in a few examples but is not documented, as far as I can tell. How does it differ from INDEPENDENT?

Conclusion

None

Activity

Show:

Richard Chapman April 8, 2019 at 8:57 AM

BTW random() is not really a good test for ONCE - the way random works is bizzarre enough to add rather than reduce confusion. The purpose for ONCE would be, for example, to load a dictionary from a file, that takes a bit of time upfront but saves time each time it is referenced.

Richard Chapman April 8, 2019 at 8:55 AM

Agree - any comment?

Dan Camper April 6, 2019 at 8:16 PM

I tested your code on the lastest 7.2.x branch and it fails with the error you described. I think that error is worth another Jira.

Richard Taylor April 5, 2019 at 6:56 PM

OK, I just tried running this code on 7.0.24-1 VM (7.2.0-1 IDE/compiler), and got the same runtime error ("assert(match) failed - file: hqlttcpp.cpp, line 6093") with targets Thor, hThor, and Roxie. Switch comments on the H definition and the code runs fine. I'd have tried the 7.2 VM but it's not available for download yet.

I := RANDOM() : INDEPENDENT; //calculated once, period
G := RANDOM() : GLOBAL; //calculated once in each graph
// H := 0;
H := RANDOM() : ONCE;

ds := DATASET([{1,0,0,0,0},{2,0,0,0,0}],{UNSIGNED1 rec,UNSIGNED Ival, UNSIGNED Gval , UNSIGNED Hval, UNSIGNED Aval });

RECORDOF(ds) XF(ds L) := TRANSFORM
SELF.Ival := I;
SELF.Gval := G;
SELF.Hval := H;
SELF.Aval := RANDOM(); //calculated each time used
SELF := L;
END;

P1 := PROJECT(ds,XF(left)) : PERSIST('~RTTEST::PERSIST::IndependentVsGlobal1');
P2 := PROJECT(ds,XF(left)) : PERSIST('~RTTEST::PERSIST::IndependentVsGlobal2');

OUTPUT(P1);
OUTPUT(P2); //this gets the same Ival values as P1, but the Gval value is different than P1

OUTPUT(P1);
OUTPUT(P2); //this gets the same Ival values as P1, but the Gval value is different than P1

Richard Chapman April 5, 2019 at 12:03 PM

ONCE is only really relevant for Roxie. For other platform's it's the same as GLOBAL I think.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Components

Assignee

Reporter

Priority

Compatibility

Major

Fix versions

Labels

Created August 14, 2018 at 3:05 PM
Updated April 10, 2019 at 2:06 PM
Resolved April 10, 2019 at 2:06 PM

Flag notifications