xqy179 opened a new issue #2244:
URL: https://github.com/apache/hudi/issues/2244


   **_Tips before filing an issue_**
   
   - Have you gone through our 
[FAQs](https://cwiki.apache.org/confluence/display/HUDI/FAQ)?
   
   - Join the mailing list to engage in conversations and get faster support at 
[email protected].
   
   - If you have triaged this as a bug, then file an 
[issue](https://issues.apache.org/jira/projects/HUDI/issues) directly.
   
   **Describe the problem you faced**
   
   Maybe there is bug in  HoodieSnapshotCopier. When i use HoodieSnapshotCopier 
to snapshot a **nonpartitioned  hudi table** ,  it will threw exception!  
   ```
       val copier = new HoodieSnapshotCopier();
       copier.snapshot(spark.sparkContext, srcBasePath, desBasePath, false);
   ```
   
   Code trace:
   code in **public class HoodieSnapshotCopier implements Serializable { ... }**
   
   ```
           //when snapshot a nonpartitioned table,  the flowing var  
**partition** value is empty, so **new Path(baseDir, partition)** with a empty 
string will throw exception
   
           // also need to copy over partition metadata
           Path partitionMetaFile =
               new Path(new Path(baseDir, partition), 
HoodiePartitionMetadata.HOODIE_PARTITION_METAFILE);
   
           // I change the code like below, and it work well!
           Path partitionMetaFile;
           if(partition.isEmpty()) {
             partitionMetaFile = new Path(new Path(baseDir), 
HoodiePartitionMetadata.HOODIE_PARTITION_METAFILE);
           }else {
             partitionMetaFile = new Path(new Path(baseDir, partition), 
HoodiePartitionMetadata.HOODIE_PARTITION_METAFILE);
           }
   ```
   
   
   
   **Expected behavior**
   
   
   
   
   
   **Environment Description**
   
   * Hudi version :
   
   * Spark version :
   
   * Hive version :
   
   * Hadoop version :
   
   * Storage (HDFS/S3/GCS..) :
   
   * Running on Docker? (yes/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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to