Page 1 of 1

a method to reset PartitionReaer

Posted: Tue Nov 12, 2013 8:43 pm
by kyle
Hi I got a question while writing a UDF with C++ language.
Is there a API to reset the PartitionReader iterator?

In the below code,

Code: Select all

    virtual void processPartition(ServerInterface &srvInterface,
                                  PartitionReader &input_reader,
                                  PartitionWriter &output_writer) {
  do{
  // do something with input_reader
  } while (input_reader.next());

  // Later, I want to access input_reader again from the beginning.
  do{
  // do something with input_reader again
  } while (input_reader.next());
}
Is there a API to reset input_reader iterator to reuse it from the beginning again? thx.

Re: a method to reset PartitionReaer

Posted: Tue Nov 12, 2013 11:39 pm
by id10t
Hi!

[DELETED]

Re: a method to reset PartitionReaer

Posted: Tue Nov 12, 2013 11:58 pm
by kyle
Hi sKwa,

What I tried to do is that in the first do-while loop, I scan the entire rows to create the overall data-distribution. In the second do-while loop, I do a real computation using the input rows and data-distribution calculated in the first do-while block. For the time-being, I do it by storing the entire rows in the first do-while loop in the local variable for further processing :(