You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Jinhua Fu (JIRA)" <ji...@apache.org> on 2018/09/11 10:49:00 UTC
[jira] [Updated] (SPARK-25404) Staging path may not on the expected
place when table path contains the stagingDir string
[ https://issues.apache.org/jira/browse/SPARK-25404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jinhua Fu updated SPARK-25404:
------------------------------
Description:
Considering the follow scenario:
{code:java}
SET hive.exec.stagingdir=temp;
CREATE TABLE tempTableA(key int) location '/spark/temp/tempTableA';
INSERT OVERWRITE TABLE tempTableA SELECT 1;
{code}
We expect the staging path under the table path, such as '/spark/temp/tempTableA/.hive-stagingXXX'(SPARK-20594), but actually it is '/spark/tempXXX'.
I'm not quite sure why we use the 'if ... else ...' when getting a stagingDir, but it maybe the cause of this bug.
{code:java}
// SaveAsHiveFile.scala
private def getStagingDir(
inputPath: Path,
hadoopConf: Configuration,
stagingDir: String): Path = {
......
var stagingPathName: String =
if (inputPathName.indexOf(stagingDir) == -1) {
new Path(inputPathName, stagingDir).toString
} else {
// The 'indexOf' may get expect position, and this may be the cause of this bug.
inputPathName.substring(0, inputPathName.indexOf(stagingDir) + stagingDir.length)
}
......
}
{code}
was:
Considering the follow scenario:
{code:java}
SET hive.exec.stagingdir=temp;
CREATE TABLE tempTableA(key int) location '/spark/temp/tempTableA';
INSERT OVERWRITE TABLE tempTableA SELECT 1;
{code}
We expect the staging path under the table path, such as '/spark/temp/tempTableA/.hive-stagingXXX'(SPARK-20594), but actually it is '/spark/tempXXX'.
I'm not quite sure why we use the 'if ... else ...' when getting a stagingDir, but it maybe the cause of this bug.
{code:java}
private def getStagingDir(
inputPath: Path,
hadoopConf: Configuration,
stagingDir: String): Path = {
......
var stagingPathName: String =
if (inputPathName.indexOf(stagingDir) == -1) {
new Path(inputPathName, stagingDir).toString
} else {
inputPathName.substring(0, inputPathName.indexOf(stagingDir) + stagingDir.length)
}
......
}
{code}
> Staging path may not on the expected place when table path contains the stagingDir string
> -----------------------------------------------------------------------------------------
>
> Key: SPARK-25404
> URL: https://issues.apache.org/jira/browse/SPARK-25404
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.3.1
> Reporter: Jinhua Fu
> Priority: Minor
>
> Considering the follow scenario:
>
> {code:java}
> SET hive.exec.stagingdir=temp;
> CREATE TABLE tempTableA(key int) location '/spark/temp/tempTableA';
> INSERT OVERWRITE TABLE tempTableA SELECT 1;
> {code}
> We expect the staging path under the table path, such as '/spark/temp/tempTableA/.hive-stagingXXX'(SPARK-20594), but actually it is '/spark/tempXXX'.
> I'm not quite sure why we use the 'if ... else ...' when getting a stagingDir, but it maybe the cause of this bug.
>
> {code:java}
> // SaveAsHiveFile.scala
> private def getStagingDir(
> inputPath: Path,
> hadoopConf: Configuration,
> stagingDir: String): Path = {
> ......
> var stagingPathName: String =
> if (inputPathName.indexOf(stagingDir) == -1) {
> new Path(inputPathName, stagingDir).toString
> } else {
> // The 'indexOf' may get expect position, and this may be the cause of this bug.
> inputPathName.substring(0, inputPathName.indexOf(stagingDir) + stagingDir.length)
> }
> ......
> }
> {code}
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org