Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
"mapreduce8",
"merge1",
"merge2",
"merge4",
"mergejoins",
"multiMapJoin1",
"multiMapJoin2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import org.apache.spark.broadcast.Broadcast
import org.apache.spark.rdd.{EmptyRDD, HadoopRDD, RDD, UnionRDD}
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.types.DateUtils
import org.apache.hadoop.util.StringUtils

/**
* A trait for subclasses that handle table scans.
Expand Down Expand Up @@ -248,7 +249,7 @@ private[hive] object HadoopTableReader extends HiveInspectors {
* instantiate a HadoopRDD.
*/
def initializeLocalJobConfFunc(path: String, tableDesc: TableDesc)(jobConf: JobConf) {
FileInputFormat.setInputPaths(jobConf, path)
jobConf.set("mapred.input.dir", StringUtils.escapeString(path.toString()))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting the conf using the key, can we still use FileInputFormat.setInputPaths? Like

FileInputFormat.setInputPaths(jobConf, StringUtils.escapeString(path))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't, for examples "hdfs://x.x.x.x:9000/user/hive/warehouse/nzhang_part/ds=2010-08-15/hr=file," is will be splited into "hdfs://x.x.x.x:9000/user/hive/warehouse/nzhang_part/ds=2010-08-15/hr=file" and "" by FileInputFormat.getPathStrings, "" will be checked by Path.checkPathArg and

if( path.length() == 0 ) {
    throw new IllegalArgumentException("Can not create a Path from an empty string");
}

you can see

FileInputFormat.setInputPaths -> FileInputFormat.getPathStrings -> Path.checkPathArg

in hadoop for detail.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o, I see. getPathStrings does not really care if a comma is escaped or not... Can we use public static void setInputPaths(Job job, Path... inputPaths)? I think it is better to avoid using set directly with a string key (using a method seems more robust).

if (tableDesc != null) {
PlanUtils.configureInputJobPropertiesForStorageHandler(tableDesc)
Utilities.copyTableJobPropertiesToConf(tableDesc, jobConf)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Loading