Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
Browse files Browse the repository at this point in the history
…9.4.x
  • Loading branch information
jakesmith committed Jan 9, 2025
2 parents d5d9d17 + 9a90c8e commit f90a494
Show file tree
Hide file tree
Showing 15 changed files with 163 additions and 42 deletions.
3 changes: 2 additions & 1 deletion esp/src/src-react/components/ECLPlayground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,11 @@ export const ECLPlayground: React.FunctionComponent<ECLPlaygroundProps> = (props
useOnEvent(document, "eclwatch-theme-toggle", handleThemeToggle);

const submissionComplete = React.useMemo(() => {
if (!workunit?.Wuid) return true;
return workunit?.StateID === WUStateID.Completed ||
workunit?.StateID === WUStateID.Failed ||
(workunit?.ActionEx === "compile" && workunit?.StateID === WUStateID.Compiled);
}, [workunit?.StateID, workunit?.ActionEx]);
}, [workunit?.StateID, workunit?.ActionEx, workunit?.Wuid]);

const handleEclChange = React.useMemo(() => debounce((evt) => {
if (editor.hasFocus()) {
Expand Down
8 changes: 3 additions & 5 deletions esp/src/src-react/components/WorkunitSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,10 @@ export const WorkunitSummary: React.FunctionComponent<WorkunitSummaryProps> = ({
</MessageBar>
}
</Sticky>
<Sticky stickyPosition={StickyPositionType.Header}>
<div style={{ position: "sticky", zIndex: 2, top: 44, display: "flex", flexDirection: "row", justifyContent: "space-between" }}>
<WorkunitPersona wuid={wuid} />
<div style={{ width: "512px", height: "64px", float: "right" }}>
<WUStatus wuid={wuid}></WUStatus>
</div>
</Sticky>
<WUStatus wuid={wuid}></WUStatus>
</div>
<TableGroup fields={{
"wuid": { label: nlsHPCC.WUID, type: "string", value: wuid, readonly: true },
"otTraceId": { label: nlsHPCC.Trace, type: "string", value: otTraceId, readonly: true },
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/components/controls/StateIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export const WorkunitPersona: React.FunctionComponent<WorkunitPersonaProps> = ({
}
}, [workunit, workunit?.StateID, theme.semanticColors.errorIcon, theme.semanticColors.successIcon, theme.semanticColors.warningIcon]);

return <FluentProvider theme={themeV9} style={{ marginRight: 4, display: "inline-block" }}>
return <FluentProvider theme={themeV9} style={{ paddingTop: 4, flexGrow: 1, height: 26 }}>
<ThemeProvider theme={theme} title={workunit?.State}>
{showProtected &&
<span style={{ marginLeft: 8, marginRight: 2 }}>
Expand Down
9 changes: 5 additions & 4 deletions esp/src/src/DataPatternsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import "dijit/TooltipDialog";
import "hpcc/TableContainer";
import "hpcc/TargetSelectWidget";

import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";
import { WUStatus } from "./WUStatus";

type _TabContainerWidget = {
Expand All @@ -50,11 +50,10 @@ type _TabContainerWidget = {

export const supportedFileType = (contentType: string): boolean => ["flat", "csv", "thor"].indexOf((contentType || "").toLowerCase()) >= 0;

export interface DataPatternsWidget extends _TabContainerWidget {
interface _DataPatternsWidget extends _TabContainerWidget {
}

@declareDecorator("DataPatternsWidget", _TabContainerWidget)
export class DataPatternsWidget {
class _DataPatternsWidget {
templateString = template;
static baseClass = "DataPatternsWidget";
i18n = nlsHPCC;
Expand Down Expand Up @@ -296,3 +295,5 @@ export class DataPatternsWidget {
;
}
}

export const DataPatternsWidget = declareMixin(_DataPatternsWidget, "DataPatternsWidget", _TabContainerWidget);
5 changes: 5 additions & 0 deletions esp/src/src/DeclareDecorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ export function declareDecorator(classID: string, ...mixins: object[]) {
return declare(classID, mixins, target.prototype);
};
}

type Constructor<T = object> = new (...args: any[]) => T;
export function declareMixin<T extends Constructor>(target: T, classID: string, ...mixins: object[]): T {
return declare(classID, mixins, target.prototype);
}
9 changes: 5 additions & 4 deletions esp/src/src/ECLArchiveWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { themeIsDark } from "./Utility";
import * as template from "dojo/text!hpcc/templates/ECLArchiveWidget.html";
// @ts-ignore
import * as _Widget from "hpcc/_Widget";
import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";

const TIME_NAMES = ["TimeMaxLocalExecute", "TimeAvgLocalExecute", "TimeLocalExecute"];

Expand All @@ -36,11 +36,10 @@ type _Widget = {
setDisabled(id: string, disabled: boolean, icon?: string, disabledIcon?: string);
};

export interface ECLArchiveWidget extends _Widget {
interface _ECLArchiveWidget extends _Widget {
}

@declareDecorator("ECLArchiveWidget", _Widget)
export class ECLArchiveWidget {
class _ECLArchiveWidget {
protected templateString = template;
static baseClass = "ECLArchiveWidget";
protected i18n = nlsHPCC;
Expand Down Expand Up @@ -714,3 +713,5 @@ export class ECLArchiveWidget {
}
}
}
export const ECLArchiveWidget = declareMixin(_ECLArchiveWidget, "ECLArchiveWidget", _Widget);

8 changes: 4 additions & 4 deletions esp/src/src/ESPSearch.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as Observable from "dojo/store/Observable";
import * as ESPWorkunit from "src/ESPWorkunit";
import * as ESPDFUWorkunit from "src/ESPDFUWorkunit";
import * as ESPLogicalFile from "src/ESPLogicalFile";
import * as ESPQuery from "src/ESPQuery";
import * as ESPWorkunit from "./ESPWorkunit";
import * as ESPDFUWorkunit from "./ESPDFUWorkunit";
import * as ESPLogicalFile from "./ESPLogicalFile";
import * as ESPQuery from "./ESPQuery";
import { Memory } from "./store/Memory";
import * as WsWorkunits from "./WsWorkunits";
import * as FileSpray from "./FileSpray";
Expand Down
8 changes: 4 additions & 4 deletions esp/src/src/Graph7Widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import "dijit/layout/ContentPane";
import "dijit/Toolbar";
import "dijit/ToolbarSeparator";

import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";
import nlsHPCC from "./nlsHPCC";
import { WUScopeController } from "./WUScopeController";

Expand All @@ -33,11 +33,10 @@ type _Widget = {
setDisabled(id: string, disabled: boolean, icon?: string, disabledIcon?: string);
};

export interface Graph7Widget extends _Widget {
interface _Graph7Widget extends _Widget {
}

@declareDecorator("Graph7Widget", _Widget)
export class Graph7Widget {
class _Graph7Widget {
templateString = template;
static baseClass = "Graph7Widget";
i18n = nlsHPCC;
Expand Down Expand Up @@ -252,3 +251,4 @@ export class Graph7Widget {
;
}
}
export const Graph7Widget = declareMixin(_Graph7Widget, "Graph7Widget", _Widget);
11 changes: 6 additions & 5 deletions esp/src/src/GraphTree7Widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { hashSum } from "@hpcc-js/util";

// @ts-ignore
import * as _Widget from "hpcc/_Widget";
import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";
import { Grid, maximizeWidget } from "./ESPUtil";
import { GraphStore, GraphTreeStore } from "./GraphStore";
import nlsHPCC from "./nlsHPCC";
Expand Down Expand Up @@ -88,11 +88,10 @@ type _Widget = {
setDisabled(id: string, disabled: boolean, icon?: string, disabledIcon?: string);
};

export interface GraphTree7Widget extends _Widget {
interface _GraphTree7Widget extends _Widget {
}

@declareDecorator("GraphTree7Widget", _Widget)
export class GraphTree7Widget {
class _GraphTree7Widget {
templateString = template;
static baseClass = "GraphTree7Widget";
i18n = nlsHPCC;
Expand Down Expand Up @@ -761,7 +760,7 @@ export class GraphTree7Widget {
}
}

GraphTree7Widget.prototype._syncSelectionFrom = debounce(function (this: GraphTree7Widget, sourceControlOrGlobalIDs) {
_GraphTree7Widget.prototype._syncSelectionFrom = debounce(function (this: _GraphTree7Widget, sourceControlOrGlobalIDs) {
this.inSyncSelectionFrom = true;
const sourceControl = sourceControlOrGlobalIDs instanceof Array ? null : sourceControlOrGlobalIDs;
let selectedGlobalIDs = sourceControlOrGlobalIDs instanceof Array ? sourceControlOrGlobalIDs : [];
Expand Down Expand Up @@ -846,3 +845,5 @@ GraphTree7Widget.prototype._syncSelectionFrom = debounce(function (this: GraphTr
}
this.inSyncSelectionFrom = false;
}, 500, false);

export const GraphTree7Widget = declareMixin(_GraphTree7Widget, "GraphTree7Widget", _Widget);
8 changes: 4 additions & 4 deletions esp/src/src/GraphTreeWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ import "dijit/ToolbarSeparator";
import "hpcc/JSGraphWidget";
import "hpcc/TimingTreeMapWidget";

import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";

type _Widget = any;
export interface GraphTreeWidget extends _Widget { }
interface _GraphTreeWidget extends _Widget { }

@declareDecorator("GraphTreeWidget", _Widget)
export class GraphTreeWidget {
class _GraphTreeWidget {
templateString = template;
baseClass = "GraphTreeWidget";
i18n = nlsHPCC;
Expand Down Expand Up @@ -796,3 +795,4 @@ export class GraphTreeWidget {
this.setDisabled(this.id + "ActivityMetric", tab.id !== this.id + "ActivitiesTreeMap");
}
}
export const GraphTreeWidget = declareMixin(_GraphTreeWidget, "GraphTreeWidget", _Widget);
2 changes: 1 addition & 1 deletion esp/src/src/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as topic from "dojo/topic";
import { format as d3Format } from "@hpcc-js/common";
import { SMCService } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import { cookieKeyValStore, sessionKeyValStore, userKeyValStore } from "src/KeyValStore";
import { cookieKeyValStore, sessionKeyValStore, userKeyValStore } from "./KeyValStore";
import { singletonDebounce } from "../src-react/util/throttle";
import { parseSearch, replaceUrl } from "../src-react/util/history";
import { ModernMode } from "./BuildInfo";
Expand Down
12 changes: 6 additions & 6 deletions esp/src/src/Utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as arrayUtil from "dojo/_base/array";
import * as domConstruct from "dojo/dom-construct";
import * as entities from "dojox/html/entities";
import { darkTheme } from "../src-react/themes";
import nlsHPCC from "src/nlsHPCC";
import nlsHPCC from "./nlsHPCC";

declare const dojoConfig;
declare const ActiveXObject;
Expand Down Expand Up @@ -631,7 +631,7 @@ export function resolve(hpccWidget, callback) {
require(["hpcc/viz/DojoD3NDChart"], doLoad);
break;
case "DataPatternsWidget":
require(["src/DataPatternsWidget"], doLoad);
require(["./DataPatternsWidget"], doLoad);
break;
case "DynamicESDLDefinitionDetailsWidget":
require(["hpcc/DynamicESDLDefinitionDetailsWidget"], doLoad);
Expand All @@ -655,7 +655,7 @@ export function resolve(hpccWidget, callback) {
require(["hpcc/ECLPlaygroundWidget"], doLoad);
break;
case "ECLArchiveWidget":
require(["src/ECLArchiveWidget"], doLoad);
require(["./ECLArchiveWidget"], doLoad);
break;
case "ECLSourceWidget":
require(["hpcc/ECLSourceWidget"], doLoad);
Expand Down Expand Up @@ -710,13 +710,13 @@ export function resolve(hpccWidget, callback) {
require(["hpcc/GraphsLFWidget"], doLoad);
break;
case "GraphTreeWidget":
require(["src/GraphTreeWidget"], doLoad);
require(["./GraphTreeWidget"], doLoad);
break;
case "GraphTree7Widget":
require(["src/GraphTree7Widget"], doLoad);
require(["./GraphTree7Widget"], doLoad);
break;
case "Graph7Widget":
require(["src/Graph7Widget"], doLoad);
require(["./Graph7Widget"], doLoad);
break;
case "GridDetailsWidget":
require(["hpcc/GridDetailsWidget"], doLoad);
Expand Down
4 changes: 2 additions & 2 deletions esp/src/src/WsTopology.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Connection, ResourcesService, Topology } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import { containerized } from "src/BuildInfo";
import { Memory } from "src/store/Memory";
import { containerized } from "./BuildInfo";
import { Memory } from "./store/Memory";
import * as arrayUtil from "dojo/_base/array";
import * as Deferred from "dojo/_base/Deferred";
import * as lang from "dojo/_base/lang";
Expand Down
1 change: 0 additions & 1 deletion esp/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"noUnusedLocals": true,
"strictNullChecks": false,
"importHelpers": true,
"experimentalDecorators": true,
"allowJs": true,
"skipLibCheck": true,
"noImplicitUseStrict": true,
Expand Down
115 changes: 115 additions & 0 deletions testing/unittests/jlibtests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4550,6 +4550,121 @@ class HashFuncTests : public CppUnit::TestFixture
}
};

CPPUNIT_TEST_SUITE_REGISTRATION( HashFuncTests );
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( HashFuncTests, "HashFuncTests" );
class HashFuncTests : public CppUnit::TestFixture
{
public:
virtual void setUp() override
{
generateFixedRandomNullTermiantedStrings();
}

CPPUNIT_TEST_SUITE(HashFuncTests);
CPPUNIT_TEST(fnvTests);
CPPUNIT_TEST_SUITE_END();

protected:
static constexpr unsigned maxCalls = 10'000'000;
static constexpr unsigned minLen = 5, maxLen = 100;
static constexpr unsigned lenRange = maxLen - minLen + 1;
static constexpr unsigned randomSeed = 42;
static constexpr size_t testBufferSize = 1'000'000;
CCycleTimer timer;
std::vector<unsigned char> buffer;

unsigned getOffsetLenHash(unsigned offset, unsigned hash)
{
hash ^= (offset * 0x27D4EB2D); // use MurMurHash3 multiplier to introduce more randomness
hash *= fnvPrime32;
return hash;
}
void generateFixedRandomNullTermiantedStrings()
{
buffer.resize(testBufferSize);
std::mt19937 rng(randomSeed);
std::uniform_int_distribution<unsigned char> dist(1, 255);

unsigned offset = 0;
unsigned lenHash = fnvInitialHash32;
while (offset < testBufferSize)
{
// create str lengths between min and max based on offset,
// so that we can predictably read them back
lenHash = getOffsetLenHash(offset, lenHash);
unsigned len = (lenHash % lenRange) + minLen;

if (offset + len + 1 >= testBufferSize)
break;

for (unsigned i=0; i<len; i++)
buffer[offset + i] = dist(rng);
buffer[offset + len] = '\0';

offset += len + 1;
}
}
template <unsigned (*HASHCFUNC)(const unsigned char *, unsigned, unsigned)>
void testHashc()
{
unsigned hashResult = fnvInitialHash32;

unsigned offset = 0;
for (unsigned i=0; i<maxCalls; i++)
{
unsigned len = (i % 100) + 5;
if (offset + len > buffer.size())
offset = 0;

hashResult ^= HASHCFUNC(&buffer[offset], len, hashResult);
offset += len;
}
CPPUNIT_ASSERT(hashResult != 0);
}
template <unsigned (*HASHCZFUNC)(const unsigned char *, unsigned)>
void testHashcz()
{
unsigned hashResult = fnvInitialHash32;

unsigned lenHash = fnvInitialHash32;
unsigned offset = 0;
for (unsigned i=0; i<maxCalls; i++)
{
// get next length, as populated by generate function
lenHash = getOffsetLenHash(offset, lenHash);
unsigned len = (lenHash % lenRange) + minLen;

if (offset + (len + 1) > buffer.size())
{
offset = 0;
lenHash = getOffsetLenHash(offset, fnvInitialHash32);
len = (lenHash % lenRange) + minLen;
}
dbgassertex(len == strlen((const char *)&buffer[offset]));
hashResult ^= HASHCZFUNC(&buffer[offset], hashResult);
offset += len + 1;
}
CPPUNIT_ASSERT(hashResult != 0);
}
void measure(const char *funcName, const std::function<void(void)> &func)
{
timer.reset();
func();
unsigned elapsed = timer.elapsedMs();
double throughput = static_cast<double>(maxCalls) / elapsed * 1000;
PROGLOG("%s: %u calls took %u ms (%.2f hashes/sec)", funcName, maxCalls, elapsed, throughput);
}
void fnvTests()
{
measure("deprecatedHashc (fnv1)", [this]() { testHashc<deprecatedHashc>(); });
measure("deprecatedHashcz (fnv1)", [this]() { testHashcz<deprecatedHashcz>(); });
measure("hashc (fnv1)", [this]() { testHashc<hashc>(); });
measure("hashcz (fnv1)", [this]() { testHashcz<hashcz>(); });
measure("hashc_fnv1a", [this]() { testHashc<hashc_fnv1a>(); });
measure("hashcz_fnv1a", [this]() { testHashcz<hashcz_fnv1a>(); });
}
};

CPPUNIT_TEST_SUITE_REGISTRATION( HashFuncTests );
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( HashFuncTests, "HashFuncTests" );

Expand Down

0 comments on commit f90a494

Please sign in to comment.