1
votes

Is it possible to make a loop in Hive to insert a bunch of random values in a table? I understand that I can create a script in some programming language to create a csv file with the needed amount of rows and then load csv into hive as an external table.

So I want to have the table with 1000000 rows. The schema:

  • name String,
  • s_name String,
  • age int

Thanks in advance.

1
as it stands the question is too broad..how many columns would your table have? what should the output look like? what have you tried so far? please add these details to the question. - Vamsi Prabhala
"I understand that I can create a script in some programming language to create a csv file with the needed amount of rows and then load csv into hive as an external table." that's basically what you need to do here - Ben Watson
And why do you need a loop? You could generate 1M rows in a single insert statement - leftjoin

1 Answers

1
votes

The proper way is to use csv (or any other file format) to insert data in Hive. If you don't want to use programming language you can use Excel (or any other analouge) to generate as may rows with random data as you need and then save them in CSV file. Hope this helps.