You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "stream2000 (via GitHub)" <gi...@apache.org> on 2024/09/06 09:53:51 UTC

[I] [SUPPORT] Exception when write null value to table with timestamp partitioning [hudi]

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

   **_Tips before filing an issue_**
   
   - Have you gone through our [FAQs](https://hudi.apache.org/learn/faq/)?
   
   - Join the mailing list to engage in conversations and get faster support at dev-subscribe@hudi.apache.org.
   
   - 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**
   
   Exception when write null value to table with timestamp partitioning 
   **To Reproduce**
   
   ```scala
     test("Test various data types as partition fields") {
       withRecordType()(withTempDir { tmp =>
         val tableName = generateTableName
         spark.sql(
           s"""
              |CREATE TABLE $tableName (
              |  id INT,
              |  boolean_field BOOLEAN,
              |  float_field FLOAT,
              |  byte_field BYTE,
              |  short_field SHORT,
              |  decimal_field DECIMAL(10, 5),
              |  date_field DATE,
              |  string_field STRING,
              |  timestamp_field TIMESTAMP
              |) USING hudi
              | TBLPROPERTIES (primaryKey = 'id')
              | PARTITIONED BY (boolean_field, float_field, byte_field, short_field, decimal_field, date_field, string_field, timestamp_field)
              |LOCATION '${tmp.getCanonicalPath}'
        """.stripMargin)
   
         // Insert data into partitioned table
         spark.sql(
           s"""
              |INSERT INTO $tableName VALUES
              |(1, TRUE, CAST(1.0 as FLOAT), 1, 1, 1234.56789, DATE '2021-01-05', 'partition1', null),
              |(2, FALSE,CAST(2.0 as FLOAT), 2, 2, 6789.12345, DATE '2021-01-06', 'partition2', TIMESTAMP '2021-01-06 11:00:00')
        """.stripMargin)
   
         checkAnswer(s"SELECT id, boolean_field FROM $tableName ORDER BY id")(
           Seq(1, true),
           Seq(2, false)
         )
       })
     }
   ```
   
   **Expected behavior**
   
   No exception encoutered 
   
   **Environment Description**
   
   * Hudi version :
   
   0.15.x 
   
   * Spark version :
   
   3.5 
   
   * Hive version :
   
   * Hadoop version :
   
   * Storage (HDFS/S3/GCS..) :
   
   OSS
   
   * Running on Docker? (yes/no) :
   
   No
   
   **Additional context**
   
   Add any other context about the problem here.
   
   **Stacktrace**
   
   ```Add the stacktrace of the error.```
   
   Caused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 9.0 failed 1 times, most recent failure: Lost task 0.0 in stage 9.0 (TID 8) (30.221.116.216 executor driver): java.lang.NumberFormatException: For input string: "__HIVE_DEFAULT_PARTITION__"
   	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
   	at java.lang.Long.parseLong(Long.java:589)
   	at java.lang.Long.parseLong(Long.java:631)
   	at scala.collection.immutable.StringLike.toLong(StringLike.scala:315)
   	at scala.collection.immutable.StringLike.toLong$(StringLike.scala:315)
   	at scala.collection.immutable.StringOps.toLong(StringOps.scala:33)
   	at org.apache.spark.sql.hudi.command.SqlKeyGenerator.$anonfun$convertPartitionPathToSqlType$1(SqlKeyGenerator.scala:170)
   	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286)
   	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
   	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
   	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
   	at scala.collection.TraversableLike.map(TraversableLike.scala:286)
   	at scala.collection.TraversableLike.map$(TraversableLike.scala:279)
   	at scala.collection.mutable.ArrayOps$ofRef.map(ArrayOps.scala:198)
   	at org.apache.spark.sql.hudi.command.SqlKeyGenerator.convertPartitionPathToSqlType(SqlKeyGenerator.scala:156)
   	at org.apache.spark.sql.hudi.command.SqlKeyGenerator.getPartitionPath(SqlKeyGenerator.scala:106)
   	at org.apache.hudi.HoodieCreateRecordUtils$.getHoodieKeyAndMaybeLocationFromAvroRecord(HoodieCreateRecordUtils.scala:212)
   	at org.apache.hudi.HoodieCreateRecordUtils$.$anonfun$createHoodieRecordRdd$5(HoodieCreateRecordUtils.scala:133)
   	at scala.collection.Iterator$$anon$10.next(Iterator.scala:461)
   	at org.apache.spark.storage.memory.MemoryStore.putIterator(MemoryStore.scala:224)
   	at org.apache.spark.storage.memory.MemoryStore.putIteratorAsBytes(MemoryStore.scala:352)
   	at org.apache.spark.storage.BlockManager.$anonfun$doPutIterator$1(BlockManager.scala:1614)
   	at org.apache.spark.storage.BlockManager.org$apache$spark$storage$BlockManager$$doPut(BlockManager.scala:1524)
   	at org.apache.spark.storage.BlockManager.doPutIterator(BlockManager.scala:1588)
   	at org.apache.spark.storage.BlockManager.getOrElseUpdate(BlockManager.scala:1389)
   	at org.apache.spark.storage.BlockManager.getOrElseUpdateRDDBlock(BlockManager.scala:1343)
   	at org.apache.spark.rdd.RDD.getOrCompute(RDD.scala:379)
   	at org.apache.spark.rdd.RDD.iterator(RDD.scala:329)
   	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:52)
   	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:367)
   	at org.apache.spark.rdd.RDD.iterator(RDD.scala:331)
   	at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:52)
   	at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:367)
   	at org.apache.spark.rdd.RDD.iterator(RDD.scala:331)
   	at org.apache.spark.shuffle.ShuffleWriteProcessor.write(ShuffleWriteProcessor.scala:59)
   	at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:104)
   	at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:54)
   	at org.apache.spark.TaskContext.runTaskWithListeners(TaskContext.scala:166)
   	at org.apache.spark.scheduler.Task.run(Task.scala:141)
   	at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$4(Executor.scala:620)
   	at org.apache.spark.util.SparkErrorUtils.tryWithSafeFinally(SparkErrorUtils.scala:64)
   	at org.apache.spark.util.SparkErrorUtils.tryWithSafeFinally$(SparkErrorUtils.scala:61)
   	at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:94)
   	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:623)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:750)
   


-- 
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


Re: [I] [SUPPORT] Exception when write null value to table with timestamp partitioning [hudi]

Posted by "ad1happy2go (via GitHub)" <gi...@apache.org>.
ad1happy2go closed issue #11900: [SUPPORT] Exception when write null value to table with timestamp partitioning 
URL: https://github.com/apache/hudi/issues/11900


-- 
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


Re: [I] [SUPPORT] Exception when write null value to table with timestamp partitioning [hudi]

Posted by "ad1happy2go (via GitHub)" <gi...@apache.org>.
ad1happy2go commented on issue #11900:
URL: https://github.com/apache/hudi/issues/11900#issuecomment-2618547000

   FIxed via https://github.com/apache/hudi/pull/12621


-- 
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


Re: [I] [SUPPORT] Exception when write null value to table with timestamp partitioning [hudi]

Posted by "karthick-de-25 (via GitHub)" <gi...@apache.org>.
karthick-de-25 commented on issue #11900:
URL: https://github.com/apache/hudi/issues/11900#issuecomment-2585735903

   @rangareddy  I will like to contribute to this issue.
   
   I did some initial analysis. I found that the issue is at SqlKeyGenerator#convertPartitionPathToSqlType 
   
   where the default  __HIVE_DEFAULT_PARTITION__ value  is trying to be converted into Long/milli second.
   
   i added following logic to fix this issue temporarily ,
   
   ![image](https://github.com/user-attachments/assets/92b3ba02-0fc9-46f2-817d-70f719b419b2)
   
   but I couldn't run the testcases to validate my changes, 
   
   cmd to run testcase:
   mvn test -Dtest=TestSparkSqlWithTimestampKeyGenerator -Drat.skip=true
   
   can you provide suggestion on running the testcase at local ?
   


-- 
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