You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "TheR1sing3un (via GitHub)" <gi...@apache.org> on 2025/04/21 07:15:24 UTC

[PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

TheR1sing3un opened a new pull request, #13188:
URL: https://github.com/apache/hudi/pull/13188

   Fix the incorrect data read after changing the column type from float to double
   
   There are two reasons for the above problems:
   1. `InternalSchemaCache` cannot obtain the path of the commit file correctly. Because after version 1.x, we placed the commit file separately in the `timeline` directory. However, `InternalSchemaCache` still retrievals files from `basePath/.hoodie`, thus failing to obtain the correct schema.
   2. When we read parquet file without `enableVectorizedReader`, we use spark 's `CAST` for type conversion when we need to do scheme evolution, but spark has a loss of precision when dealing with `CAST` that converts `float` to `double`.
   
   Change logs:
   1. pass the correct timeline path for `InternalSchemaCache`
   2. for schema evolution without `enableVectorizedReader`, for the case `CAST(FLOAT as DOUBLE)` we turn it to `CAST(CAST(FLOAT as STRING) as DOUBLE)`.
   
   ### Change Logs
   
   1. pass the correct timeline path for `InternalSchemaCache`
   2. for schema evolution without `enableVectorizedReader`, for the case `CAST(FLOAT as DOUBLE)` we turn it to `CAST(CAST(FLOAT as STRING) as DOUBLE)`.
   
   _Describe context and summary for this change. Highlight if any code was copied._
   
   ### Impact
   
   fix the incorrectness after change data type from float to double
   
   ### Risk level (write none, low medium or high below)
   
   low
   
   ### Documentation Update
   
   none
   
   - _The config description must be updated if new configs are added or the default value of the configs are changed_
   - _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
     ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make
     changes to the website._
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Change Logs and Impact were stated clearly
   - [x] Adequate tests were added if applicable
   - [x] CI passed
   


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on PR #13188:
URL: https://github.com/apache/hudi/pull/13188#issuecomment-2818007562

   > InternalSchemaCache cannot obtain the path of the commit file correctly. Because after version 1.x, we placed the commit file separately in the timeline directory. However, InternalSchemaCache still retrievals files from basePath/.hoodie, thus failing to obtain the correct schema.
   
   Are you saying the schema evolution is broken, why the schema evolution related tests can pass?


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on PR #13188:
URL: https://github.com/apache/hudi/pull/13188#issuecomment-2818118616

   Azure CI passed: https://dev.azure.com/apachehudi/hudi-oss-ci/_build/results?buildId=5016&view=results


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #13188:
URL: https://github.com/apache/hudi/pull/13188#discussion_r2052193627


##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/HoodieParquetFileFormatHelper.scala:
##########
@@ -120,7 +120,15 @@ object HoodieParquetFileFormatHelper {
           val srcType = typeChangeInfos.get(i).getRight
           val dstType = typeChangeInfos.get(i).getLeft
           val needTimeZone = Cast.needsTimeZone(srcType, dstType)
-          Cast(attr, dstType, if (needTimeZone) timeZoneId else None)
+
+          // work around for the case when cast float to double
+          if (srcType == FloatType && dstType == DoubleType) {

Review Comment:
   ideally double cast should be avoided but given that spark's type conversion loses precision and it is not as if we are going to do this for every record every time, I am ok with this change.



-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "TheR1sing3un (via GitHub)" <gi...@apache.org>.
TheR1sing3un commented on PR #13188:
URL: https://github.com/apache/hudi/pull/13188#issuecomment-2818103526

   > Are you saying the schema evolution is broken, why the schema evolution related tests can pass?
   
   Because when the schema cannot be obtained from the commit file, it will be obtained from the schema history. Our tests can all go through this process, so there are no errors in the tests.
   <img width="1467" alt="image" src="https://github.com/user-attachments/assets/0229be69-6c41-45b2-abb3-053a9c82e2b0" />
   


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13188:
URL: https://github.com/apache/hudi/pull/13188#issuecomment-2817817686

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4af00f8dcbe1162464888fbb79995a8653f4bddb UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13188:
URL: https://github.com/apache/hudi/pull/13188#issuecomment-2817969547

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5011",
       "triggerID" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5016",
       "triggerID" : "2817965529",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5011",
       "triggerID" : "2817965529",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 4af00f8dcbe1162464888fbb79995a8653f4bddb Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5016) Azure: [CANCELED](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5011) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "codope (via GitHub)" <gi...@apache.org>.
codope merged PR #13188:
URL: https://github.com/apache/hudi/pull/13188


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "TheR1sing3un (via GitHub)" <gi...@apache.org>.
TheR1sing3un commented on PR #13188:
URL: https://github.com/apache/hudi/pull/13188#issuecomment-2817965529

   @hudi-bot run azure


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "TheR1sing3un (via GitHub)" <gi...@apache.org>.
TheR1sing3un commented on PR #13188:
URL: https://github.com/apache/hudi/pull/13188#issuecomment-2818074808

   > For the first issue related to InternalSchemaCache, could you please share the stacktrace? 
   
   I execute the ut : `TestSpark3DDL::Test alter table properties and add rename drop column with table services` and then set a breakpoint before query the data with type change from float to double.
   ![Uploading image.png…]()
   


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13188:
URL: https://github.com/apache/hudi/pull/13188#issuecomment-2817967045

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5011",
       "triggerID" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "triggerType" : "PUSH"
     }, {
       "hash" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5016",
       "triggerID" : "2817965529",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 4af00f8dcbe1162464888fbb79995a8653f4bddb Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5011) Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5016) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: [PR] [HUDI-8902] Fix the incorrect data read after changing the column type from float to double [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13188:
URL: https://github.com/apache/hudi/pull/13188#issuecomment-2817820180

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5011",
       "triggerID" : "4af00f8dcbe1162464888fbb79995a8653f4bddb",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4af00f8dcbe1162464888fbb79995a8653f4bddb Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5011) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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