[ 
https://issues.apache.org/jira/browse/SPARK-24200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

kumar updated SPARK-24200:
--------------------------
    Description: 
String folder = "/Users/test/data/ ** /** ";

sparkContext.textFile(folder, 1).toJavaRDD() 

Is asterisks mandatory to read a folder -Yes, otherwise it does not read files 
under subdirectories.

What if I get a folder which is having more subdirectories than the number of 
asterisks mentioned ? How to handle this scenario ?

For example:

1) {{/Users/test/data/}} This would work ONLY if I get data as 
/Users/test/data/folder1/file.txt

2)How to make this expression as *generic* ? It should still work if I get a 
folder as: {{/Users/test/data/folder1/folder2/folder3/folder4}}

My input folder structure is not same all the time.

Is there anything exists in Spark to handle this kind of scenario ?

  was:
String folder = "/Users/test/data/*/*";

sparkContext.textFile(folder, 1).toJavaRDD() 

Is asterisks mandatory to read a folder -Yes, otherwise it does not read files 
under subdirectories.

What if I get a folder which is having more subdirectories than the number of 
asterisks mentioned ? How to handle this scenario ?

For example:

1) {{/Users/test/data/}} This would work ONLY if I get data as 
/Users/test/data/folder1/file.txt

2)How to make this expression as *generic* ? It should still work if I get a 
folder as: {{/Users/test/data/folder1/folder2/folder3/folder4}}

My input folder structure is not same all the time.

Is there anything exists in Spark to handle this kind of scenario ?


> Read subdirectories with out asterisks
> --------------------------------------
>
>                 Key: SPARK-24200
>                 URL: https://issues.apache.org/jira/browse/SPARK-24200
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.3.0
>            Reporter: kumar
>            Priority: Major
>
> String folder = "/Users/test/data/ ** /** ";
> sparkContext.textFile(folder, 1).toJavaRDD() 
> Is asterisks mandatory to read a folder -Yes, otherwise it does not read 
> files under subdirectories.
> What if I get a folder which is having more subdirectories than the number of 
> asterisks mentioned ? How to handle this scenario ?
> For example:
> 1) {{/Users/test/data/}} This would work ONLY if I get data as 
> /Users/test/data/folder1/file.txt
> 2)How to make this expression as *generic* ? It should still work if I get a 
> folder as: {{/Users/test/data/folder1/folder2/folder3/folder4}}
> My input folder structure is not same all the time.
> Is there anything exists in Spark to handle this kind of scenario ?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to