a method to reset PartitionReaer

Moderator: NorbertKrupa

Post Reply
kyle
Newbie
Newbie
Posts: 13
Joined: Fri Mar 08, 2013 4:05 am

a method to reset PartitionReaer

Post by kyle » Tue Nov 12, 2013 8:43 pm

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.

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: a method to reset PartitionReaer

Post by id10t » Tue Nov 12, 2013 11:39 pm

Hi!

[DELETED]
Last edited by id10t on Sat May 09, 2015 3:30 pm, edited 1 time in total.

kyle
Newbie
Newbie
Posts: 13
Joined: Fri Mar 08, 2013 4:05 am

Re: a method to reset PartitionReaer

Post by kyle » Tue Nov 12, 2013 11:58 pm

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 :(

Post Reply

Return to “Vertica User Defined Functions (UDFs)”