You need to create an external table, divided by dir_x, to access all the files in several folders.
CREATE external TABLE sample_table( col1 string,
col2 string,
col3 string,
col4 string)
PARTITIONED BY (dir string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE
LOCATION '/user/hive/warehouse/split';
Then add the section as you would for a regular partition table
ALTER TABLE sample_table ADD PARTITION(dir='dir_1')
LOCATION '/user/hive/warehouse/split/dir_1';
ALTER TABLE sample_table ADD PARTITION(dir='dir_2')
LOCATION '/user/hive/warehouse/split/dir_2';
This approach will work. There is a problem with this approach. If for some time in the future you decide to add a new folder (for example, dir_100) to the path of the hive storage, you will have to drop and recreate the sample_table and add all the sections to the sample_table again using the ALTER TABLE expression. I have not worked with the hive for about 10 months, so I'm not sure if there is a better approach. If this is not a problem, you can use this approach.