Trying to develop custom operator, very lost (no tutorials?)


I have been reading any documentation I can find (which does not exist for the source code as far as I can tell) and the SciDB source for literally days, and I am still at a complete loss of how to implement a custom operator. I’m not having trouble getting a custom operator to run–I was able to compile and run the example_udo from this website just fine–but I don’t even know where to start when it comes to changing anything.

I started with the logical.cpp file, and I do not understand how inferSchema is supposed to be written. While this is not the only part I do not understand, at the moment I’m just trying to do this one step at a time, and I figured getting the inferSchema to work before tackling execute would be prudent. I’m trying to write a histogram operator, and the output schema is supposed to look like this: there are two attributes–one with a string that contains the range a bucket stores, and one with a count of the number of items in the bucket–and one dimension which is the size of the number of buckets. I attempted to base my code off of example_udo’s inferSchema, but that is getting me nowhere.

For the attributes I am simply doing this:

Attributes outputAttrs; outputAttrs.push_back(AttributeDesc(0, "bin", TID_STRING, 0, 0)); outputAttrs.push_back(AttributeDesc(1, "count", TID_INT64, 0, 0));
Which I think should work. However, I don’t know if it does, since I can’t get the next part to compile.

For the dimension I am trying to do this:

Dimensions outputDims; outputDims.push_back(DimensionDesc("i", 0, _parameters.get(PARAM_NUM_BINS)., 1, 0));
In order to make the dimension the right length, I am asking for the number of buckets the user wants as an int64 parameter and am trying to set the parameter’s value to the max range. I do not understand how to get the value the user entered out of the _parameters vector. The whole _parameters.get(PARAM_NUM_BINS) was my attempt to get that info, but it obviously didn’t like getting an OperatorParam instead of an integer. I’m honestly not even sure if using that value for the dimension’s max range would make the dimension that size or not.

Like I said before, I have many more questions than just this, but they seem like they should have such obvious answers that I feel like I must have missed some sort of tutorial or documentation… If I could be pointed toward some sort of guide or way I can figure this out on my own, it’d be fantastic, but at the moment any help would be greatly appreciated.


Hey have you taken a look at the examples/example_udos/ directory in the source tree? There are four examples, heavily commented, that start with simple and go on to more and more complex. Did you see it?


I have the examples folder and have looked through it heavily, but I do not have an example_udos folder in my source…


Is that the source for 13.6? It was first introduced there.


No, it is the source for 13.3, and that must be the issue! Thank you very much, I will download the 13.6 source now and check those out. I really appreciate the very speedy reply; I’ve been tearing my hair out, haha!