Tue Jun 28, 2022 6:19 pm
Login Register Lost Password? Contact Us

Please Note: The HPCC Systems forums are moving to Stack Overflow. We invite you to post your questions on Stack Overflow utilizing the tag hpcc-ecl (https://stackoverflow.com/search?tab=newest&q=hpcc-ecl). This legacy forum will be active and monitored during our transition to Stack Overflow but will become read only beginning September 1, 2022.


Comments and questions related to the Enterprise Control Language

Sun Aug 02, 2020 12:29 pm Change Time Zone

Please help me understand the difference on why it fails on method 1

"message": "2305: The index record contains fields with no mappings - cannot build an index on it",

Code: Select all
Rec  := RECORD
   UNSIGNED1 id;
   STRING10 col1;

ds1:= DATASET([{1,'a'}],Rec);

/* Method 1 - NOT WORKING */
//idx1:= BUILD(ds1,{ds1.id},{ds1},'~thor::test::file1::202007284_idx',OVERWRITE);
//idx2:= INDEX(ds1,{UNSIGNED1 id,STRING10 col1},rec,'~thor::test::file1::202007284_idx');
//newidx := INDEX(idx2,'~thor::test::file1::202007285_idx_new'); //DUPLICATE INDEX DEFN
//BUILDINDEX(newidx ); //FAILS

/* Method 2 WORKING */
idx_1:= INDEX(ds1,{id},{ds1},'~thor::test::file1::202007281_idx_1');
newidx_1:= INDEX(idx_1,'~thor::test::file1::202007281_idx_2'); //DUPLICATE INDEX DEFN
Posts: 4
Joined: Fri May 29, 2020 2:50 am

Tue Aug 04, 2020 1:18 pm Change Time Zone


The first way doesn't work because the structure you defined for the INDEX does not match the structure you specified in your BUILD.

Code: Select all
idx1:= BUILD(ds1,{ds1.id},{ds1},'~RTtest::file1::202007284_idx',OVERWRITE);
This BUILD is creating a payload INDEX with the id field as the search term and the col1 field as the only payload (because it's the only other field in the RECORD structure for ds1 that isn't already specified as a search term).

Code: Select all
idx2:= INDEX(ds1,{UNSIGNED1 id,STRING10 col1},rec,'~RTtest::file1::202007284_idx');
But this INDEX declaration is not defining the same structure as the BUILD, because you have both the id and col1 fields defined as search terms. The rec "payload" parameter is irrelevant because all the fields are already defined as search terms.

To duplicate the result of your BUILD you need to define it like this:
Code: Select all
idx2:= INDEX(ds1,{UNSIGNED1 id},{STRING10 col1},'~RTtest::file1::202007284_idx');
That makes the id field the only search term, and the col1 field the only payload, duplicating the file structure built by the BUILD.


Community Advisory Board Member
Community Advisory Board Member
Posts: 1619
Joined: Wed Oct 26, 2011 7:40 pm

Tue Aug 04, 2020 1:38 pm Change Time Zone

Thank you Richard for the clarification
Posts: 4
Joined: Fri May 29, 2020 2:50 am

Return to ECL

Who is online

Users browsing this forum: No registered users and 1 guest