Skip to content

[SPARK-14557][SQL] Reading textfile (created though CTAS) doesn't work - #12356

Closed
kasjain wants to merge 4 commits into
apache:masterfrom
kasjain:master
Closed

[SPARK-14557][SQL] Reading textfile (created though CTAS) doesn't work#12356
kasjain wants to merge 4 commits into
apache:masterfrom
kasjain:master

Conversation

@kasjain

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

These changes fix the below broken functionality and does a small performance improvement.

  1. Reading the CSV table (created through CTAS query) doesn't work when the pathFilter is provided.
    A bug in HadoopFileReader. Currently, when the pathFilter is provided, it passes the list of filtered files to the "setInputPaths" which wrongly sets the string of incorrectly escaped comma separated files in an array-sequence of size one. This should have been a sequence of size equal to the number of files obtained after filtering. Hence the exception mentioned in the bug.
    ------ FileInputFormat.setInputPaths(jobConf, Seq[Path](new Path%28path%29): _*)

  2. Secondly, in this flow, filtering is triggered twice for each file. Once in hadoopTableReader.applyFilterIfApplicable and then again in FileInputFormat.singleThreadedListStatus. This is costly and redundant.

To solve both the issues above, we can just pass the directory path itself even when the pathFilter is enabled.

How was this patch tested?

Integration tests, manual tests

…k when
pathFilter is enabled.
1) A bug in HadoopFileReader. Resolved by passing the directory instead
of a list of files in case of pathFilter also, since it gets triggerred in
FileInputFormat. This also saves multiple filterings in the codePath.
2) Not using the applyFilterIfApplicable
@andrewor14

Copy link
Copy Markdown
Contributor

ok to test

@SparkQA

Copy link
Copy Markdown

Test build #55741 has finished for PR 12356 at commit 48a598e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@andrewor14

Copy link
Copy Markdown
Contributor

@liancheng@yhuai?

@saucam

Copy link
Copy Markdown

I think we can eliminate applyFilterIfNeeded method as well.

@SparkQA

Copy link
Copy Markdown

Test build #55796 has finished for PR 12356 at commit 6bd529c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kasjain

Copy link
Copy Markdown
ContributorAuthor

Can any of the admin verify the above fix?

@kasjain

Copy link
Copy Markdown
ContributorAuthor

Resolved the merge conflicts for easy merging

@SparkQA

Copy link
Copy Markdown

Test build #56660 has finished for PR 12356 at commit ca9a160.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin

rxin commented Apr 30, 2016

Copy link
Copy Markdown
Contributor

cc @marmbrus

@kasjain

Copy link
Copy Markdown
ContributorAuthor

Resolved the merge conflicts for easy merging

@SparkQA

Copy link
Copy Markdown

Test build #57504 has finished for PR 12356 at commit 5ba453b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@marmbrus

Copy link
Copy Markdown
Contributor

Is it possible to write unit tests for this?

@marmbrus

Copy link
Copy Markdown
Contributor

ok to test

@SparkQA

Copy link
Copy Markdown

Test build #59146 has finished for PR 12356 at commit 5ba453b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kasjain

Copy link
Copy Markdown
ContributorAuthor

Sure. Let me add the CTAS query in the test suite

@gatorsmile

Copy link
Copy Markdown
Member

@kasjain Could you add a test case? Does it still fail in the latest master?

@HyukjinKwonHyukjinKwon mentioned this pull request Jun 25, 2017
@gatorsmile

Copy link
Copy Markdown
Member

We are closing it due to inactivity. please do reopen if you want to push it forward. Thanks!

zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
## What changes were proposed in this pull request?
This PR proposes to close stale PRs, mostly the same instances with apache#18017
I believe the author in apache#14807 removed his account.
Closesapache#7075Closesapache#8927Closesapache#9202Closesapache#9366Closesapache#10861Closesapache#11420Closesapache#12356Closesapache#13028Closesapache#13506Closesapache#14191Closesapache#14198Closesapache#14330Closesapache#14807Closesapache#15839Closesapache#16225Closesapache#16685Closesapache#16692Closesapache#16995Closesapache#17181Closesapache#17211Closesapache#17235Closesapache#17237Closesapache#17248Closesapache#17341Closesapache#17708Closesapache#17716Closesapache#17721Closesapache#17937
Added:
Closesapache#14739Closesapache#17139Closesapache#17445Closesapache#18042Closesapache#18359
Added:
Closesapache#16450Closesapache#16525Closesapache#17738
Added:
Closesapache#16458Closesapache#16508Closesapache#17714
Added:
Closesapache#17830Closesapache#14742
## How was this patch tested?
N/A
Author: hyukjinkwon <gurwls223@gmail.com>
Closesapache#18417 from HyukjinKwon/close-stale-pr.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@kasjain@andrewor14@SparkQA@saucam@rxin@marmbrus@gatorsmile