You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/08/27 00:20:27 UTC

[GitHub] [hudi] functicons opened a new issue, #6514: [SUPPORT] Creating table with SparkSQL fails with FileNotFoundException

functicons opened a new issue, #6514:
URL: https://github.com/apache/hudi/issues/6514

   **Describe the problem you faced**
   
   I'm trying to create a new table with SparkSQL in spark-shell:
   
   ```
   spark.sql("""create table test8(id int,name string) using hudi options (primaryKey='id', type='cow') LOCATION 'hdfs:///hudi/test8'""")
   ```
   
   The error is really confusing to me, why does Hudi expects the path to exist in advance?
   
   ```
   java.io.FileNotFoundException: File does not exist: hdfs:/hudi/test8
     at org.apache.hadoop.hdfs.DistributedFileSystem$29.doCall(DistributedFileSystem.java:1533)
     at org.apache.hadoop.hdfs.DistributedFileSystem$29.doCall(DistributedFileSystem.java:1526)
     at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
     at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1541)
     at org.apache.hudi.common.util.TablePathUtils.getTablePath(TablePathUtils.java:50)
     at org.apache.hudi.DataSourceUtils.getTablePath(DataSourceUtils.java:79)
     at org.apache.hudi.DefaultSource.createRelation(DefaultSource.scala:94)
     at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:330)
     at org.apache.spark.sql.execution.command.CreateDataSourceTableCommand.run(createDataSourceTables.scala:78)
     at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
     at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
     at org.apache.spark.sql.execution.command.ExecutedCommandExec.executeCollect(commands.scala:79)
     at org.apache.spark.sql.Dataset$$anonfun$6.apply(Dataset.scala:194)
     at org.apache.spark.sql.Dataset$$anonfun$6.apply(Dataset.scala:194)
     at org.apache.spark.sql.Dataset$$anonfun$53.apply(Dataset.scala:3369)
     at org.apache.spark.sql.execution.SQLExecution$$anonfun$withNewExecutionId$1.apply(SQLExecution.scala:80)
     at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:127)
     at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:75)
     at org.apache.spark.sql.Dataset.org$apache$spark$sql$Dataset$$withAction(Dataset.scala:3368)
     at org.apache.spark.sql.Dataset.<init>(Dataset.scala:194)
     at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:79)
     at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:643)
     ... 45 elided
   ```
   
   **To Reproduce**
   
   Steps to reproduce the behavior:
   
   Spark 2.4.8, Scala 2.12, Hudi 2.12:0.11.1
   
   ```
   $ spark-shell --packages org.apache.hudi:hudi-spark-bundle_2.12:0.11.1 --conf "spark.serializer=org.apache.spark.serializer.KryoSerializer"
   
   scala> spark.sql("""create table test9(id int,name string) using hudi options (primaryKey='id', type='cow') LOCATION 'hdfs:///hudi/test9'""")
   ivysettings.xml file not found in HIVE_HOME or HIVE_CONF_DIR,/etc/hive/conf.dist/ivysettings.xml will be used
   java.io.FileNotFoundException: File does not exist: hdfs:/hudi/test9
     at org.apache.hadoop.hdfs.DistributedFileSystem$29.doCall(DistributedFileSystem.java:1528)
     at org.apache.hadoop.hdfs.DistributedFileSystem$29.doCall(DistributedFileSystem.java:1521)
     at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
     at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1536)
     at org.apache.hudi.common.util.TablePathUtils.getTablePath(TablePathUtils.java:50)
     at org.apache.hudi.DataSourceUtils.getTablePath(DataSourceUtils.java:79)
     at org.apache.hudi.DefaultSource.createRelation(DefaultSource.scala:94)
     at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:330)
     at org.apache.spark.sql.execution.command.CreateDataSourceTableCommand.run(createDataSourceTables.scala:78)
     at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
     at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
     at org.apache.spark.sql.execution.command.ExecutedCommandExec.executeCollect(commands.scala:79)
     at org.apache.spark.sql.Dataset.$anonfun$logicalPlan$1(Dataset.scala:194)
     at org.apache.spark.sql.Dataset.$anonfun$withAction$2(Dataset.scala:3369)
     at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:80)
     at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:127)
     at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:75)
     at org.apache.spark.sql.Dataset.withAction(Dataset.scala:3369)
     at org.apache.spark.sql.Dataset.<init>(Dataset.scala:194)
     at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:79)
     at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:643)
     ... 49 elided
   ```
   
   **Expected behavior**
   
   The table creation should NOT expect the path to exist.
   
   **Environment Description**
   
   * Hudi version : org.apache.hudi:hudi-spark-bundle_2.12:0.11.1 
   
   * Spark version : 2.4.8 (Scala 2.12)
   
   * Hive version : 2.3.7
   
   * Hadoop version : 2.10.2
   
   * Storage (HDFS/S3/GCS..) : HDFS
   
   * Running on Docker? (yes/no) : no
   
   
   **Additional context**
   
   Add any other context about the problem here.
   
   **Stacktrace**
   
   ```Add the stacktrace of the error.```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] xushiyan closed issue #6514: [SUPPORT] Creating Hudi table with SparkSQL fails with FileNotFoundException

Posted by GitBox <gi...@apache.org>.
xushiyan closed issue #6514: [SUPPORT] Creating Hudi table with SparkSQL fails with FileNotFoundException
URL: https://github.com/apache/hudi/issues/6514


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] functicons commented on issue #6514: [SUPPORT] Creating Hudi table with SparkSQL fails with FileNotFoundException

Posted by GitBox <gi...@apache.org>.
functicons commented on issue #6514:
URL: https://github.com/apache/hudi/issues/6514#issuecomment-1230608899

   > try to set spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension
   
   I follow the [Hudi guide for Spark](https://hudi.apache.org/docs/quick-start-guide/). It says `spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension` is only needed for Spark 3.2+.
   
   ```
   # Spark 3.2
   spark-shell \
     --packages org.apache.hudi:hudi-spark3.2-bundle_2.12:0.12.0 \
     --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer' \
     --conf 'spark.sql.catalog.spark_catalog=org.apache.spark.sql.hudi.catalog.HoodieCatalog' \
     --conf 'spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension'
   
   # Spark 3.1
   spark-shell \
     --packages org.apache.hudi:hudi-spark3.1-bundle_2.12:0.12.0 \
     --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer'
   
   # Spark 2.4
   spark-shell \
     --packages org.apache.hudi:hudi-spark2.4-bundle_2.11:0.12.0 \
     --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer'
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] KnightChess commented on issue #6514: [SUPPORT] Creating Hudi table with SparkSQL fails with FileNotFoundException

Posted by GitBox <gi...@apache.org>.
KnightChess commented on issue #6514:
URL: https://github.com/apache/hudi/issues/6514#issuecomment-1231052745

   @functicons all version I think need. The doc desc is a bit confusing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] alexeykudinkin commented on issue #6514: [SUPPORT] Creating Hudi table with SparkSQL fails with FileNotFoundException

Posted by GitBox <gi...@apache.org>.
alexeykudinkin commented on issue #6514:
URL: https://github.com/apache/hudi/issues/6514#issuecomment-1242524245

   @functicons we did actually correct the guide recently (thank you to @KnightChess for addressing it)-- you need to add `HoodieSparkSessionExtension`:
   
   <img width="1017" alt="Screen Shot 2022-09-09 at 3 21 28 PM" src="https://user-images.githubusercontent.com/428277/189453540-d3b9080a-ae6b-4ab9-b59b-daf0b0bdc341.png">
   
   The reason why it's breaking is b/c it's handled by Spark code, not Hudi code
   
   @xushiyan you can assign this one to me


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] JoshuaZhuCN commented on issue #6514: [SUPPORT] Creating Hudi table with SparkSQL fails with FileNotFoundException

Posted by GitBox <gi...@apache.org>.
JoshuaZhuCN commented on issue #6514:
URL: https://github.com/apache/hudi/issues/6514#issuecomment-1229674271

   try to set spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] yihua commented on issue #6514: [SUPPORT] Creating Hudi table with SparkSQL fails with FileNotFoundException

Posted by GitBox <gi...@apache.org>.
yihua commented on issue #6514:
URL: https://github.com/apache/hudi/issues/6514#issuecomment-1231070318

   @functicons  does adding `spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension` work for you?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org