|
abhishek dodda
2012-06-07, 12:44
abhishek dodda
2012-06-07, 12:50
shashwat shriparv
2012-06-07, 13:22
shashwat shriparv
2012-06-07, 13:22
Ashish
2012-06-07, 13:27
Harsh J
2012-06-07, 14:12
abhishek dodda
2012-06-07, 14:38
abhishek dodda
2012-06-07, 14:39
|
-
Reg:Sequence id generationabhishek dodda 2012-06-07, 12:44
hi all,
I have a scenario where i should generate the sequence id . All my tables are in DB2
-
Re: Reg:Sequence id generationabhishek dodda 2012-06-07, 12:50
Hi all,
I have a scenario where all my tables are in DB2 and after dumping them into HDFS. A unique sequence id (or) unique identifier an extra column should be added at beginning or at the end of the table can anyone help me on this please. Thanks Regards Abhi.
-
Re: Reg:Sequence id generationshashwat shriparv 2012-06-07, 13:22
Try something like this :
public class MyUniqueNumber { private static MyUniqueNumber myUniqueNumber; int number; int seedValue=365432; //custom seed value to begin with private MyUniqueNumber(){ //Singleton !!! number=seedValue; //init to zero } public static MyUniqueNumber getInstance(){ if(myUniqueNumber==null){ myUniqueNumber=new MyUniqueNumber(); } return myUniqueNumber; } public int getUniqueNumber(){ number+=1; //simple increment by 1 , you can modify this further return number; } public static void main(String[] args) { MyUniqueNumber myUniqueNumber=MyUniqueNumber.getInstance(); for(int n=0;n<=5;n++){ System.out.println("read number: "+myUniqueNumber.getUniqueNumber()); } } } On Thu, Jun 7, 2012 at 6:14 PM, abhishek dodda <[EMAIL PROTECTED]>wrote: > hi all, > > I have a scenario where i should generate the sequence id . All > my tables are in DB2 > -- ∞ Shashwat Shriparv
-
Re: Reg:Sequence id generationshashwat shriparv 2012-06-07, 13:22
or some string + timestamp+ lastrow +1
On Thu, Jun 7, 2012 at 6:52 PM, shashwat shriparv <[EMAIL PROTECTED] > wrote: > Try something like this : > > > public class MyUniqueNumber > { > private static MyUniqueNumber myUniqueNumber; > int number; > int seedValue=365432; //custom seed value to begin with > > private MyUniqueNumber(){ //Singleton !!! > number=seedValue; //init to zero > } > > public static MyUniqueNumber getInstance(){ > if(myUniqueNumber==null){ > myUniqueNumber=new MyUniqueNumber(); > } > return myUniqueNumber; > } > > public int getUniqueNumber(){ > number+=1; //simple increment by 1 , you can modify this further > return number; > } > public static void main(String[] args) > { > MyUniqueNumber myUniqueNumber=MyUniqueNumber.getInstance(); > for(int n=0;n<=5;n++){ > System.out.println("read number: > "+myUniqueNumber.getUniqueNumber()); > } > } > } > > > On Thu, Jun 7, 2012 at 6:14 PM, abhishek dodda <[EMAIL PROTECTED]>wrote: > >> hi all, >> >> I have a scenario where i should generate the sequence id . All >> my tables are in DB2 >> > > > > -- > > > ∞ > Shashwat Shriparv > > > -- ∞ Shashwat Shriparv
-
Re: Reg:Sequence id generationAshish 2012-06-07, 13:27
Can try snowflake https://github.com/twitter/snowflake
On Thu, Jun 7, 2012 at 6:20 PM, abhishek dodda <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a scenario where all my tables are in DB2 and after dumping > them into HDFS. > A unique sequence id (or) unique identifier an extra column should be > added at beginning or at the end of the table can anyone help me on > this please. > > Thanks > > Regards > Abhi. -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
-
Re: Reg:Sequence id generationHarsh J 2012-06-07, 14:12
Ashish - Note though that Twitter's Snowflake is only roughly
sequential in generation. Abhishek - Do you really require proper sequence IDs? Why not just keep and work with timestamps? On Thu, Jun 7, 2012 at 6:57 PM, Ashish <[EMAIL PROTECTED]> wrote: > Can try snowflake https://github.com/twitter/snowflake > > On Thu, Jun 7, 2012 at 6:20 PM, abhishek dodda > <[EMAIL PROTECTED]> wrote: >> Hi all, >> >> I have a scenario where all my tables are in DB2 and after dumping >> them into HDFS. >> A unique sequence id (or) unique identifier an extra column should be >> added at beginning or at the end of the table can anyone help me on >> this please. >> >> Thanks >> >> Regards >> Abhi. > > > > -- > thanks > ashish > > Blog: http://www.ashishpaliwal.com/blog > My Photo Galleries: http://www.pbase.com/ashishpaliwal -- Harsh J
-
Re: Reg:Sequence id generationabhishek dodda 2012-06-07, 14:38
Actually trying to look how we can write a mapreduce program.
On Thu, Jun 7, 2012 at 7:12 AM, Harsh J <[EMAIL PROTECTED]> wrote: > Ashish - Note though that Twitter's Snowflake is only roughly > sequential in generation. > > Abhishek - Do you really require proper sequence IDs? Why not just > keep and work with timestamps? > > On Thu, Jun 7, 2012 at 6:57 PM, Ashish <[EMAIL PROTECTED]> wrote: >> Can try snowflake https://github.com/twitter/snowflake >> >> On Thu, Jun 7, 2012 at 6:20 PM, abhishek dodda >> <[EMAIL PROTECTED]> wrote: >>> Hi all, >>> >>> I have a scenario where all my tables are in DB2 and after dumping >>> them into HDFS. >>> A unique sequence id (or) unique identifier an extra column should be >>> added at beginning or at the end of the table can anyone help me on >>> this please. >>> >>> Thanks >>> >>> Regards >>> Abhi. >> >> >> >> -- >> thanks >> ashish >> >> Blog: http://www.ashishpaliwal.com/blog >> My Photo Galleries: http://www.pbase.com/ashishpaliwal > > > > -- > Harsh J
-
Re: Reg:Sequence id generationabhishek dodda 2012-06-07, 14:39
Actually trying to code this using map reduce program.
On Thu, Jun 7, 2012 at 6:22 AM, shashwat shriparv <[EMAIL PROTECTED]> wrote: > Try something like this : > > > public class MyUniqueNumber > { > private static MyUniqueNumber myUniqueNumber; > int number; > int seedValue=365432; //custom seed value to begin with > > private MyUniqueNumber(){ //Singleton !!! > number=seedValue; //init to zero > } > > public static MyUniqueNumber getInstance(){ > if(myUniqueNumber==null){ > myUniqueNumber=new MyUniqueNumber(); > } > return myUniqueNumber; > } > > public int getUniqueNumber(){ > number+=1; //simple increment by 1 , you can modify this further > return number; > } > public static void main(String[] args) > { > MyUniqueNumber myUniqueNumber=MyUniqueNumber.getInstance(); > for(int n=0;n<=5;n++){ > System.out.println("read number: > "+myUniqueNumber.getUniqueNumber()); > } > } > } > > > On Thu, Jun 7, 2012 at 6:14 PM, abhishek dodda <[EMAIL PROTECTED]>wrote: > >> hi all, >> >> I have a scenario where i should generate the sequence id . All >> my tables are in DB2 >> > > > > -- > > > ∞ > Shashwat Shriparv |