You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "JustFeng (via GitHub)" <gi...@apache.org> on 2025/03/15 04:25:37 UTC

[PR] [KYUUBI #6984] Fix ValueError when rendering MapType data [kyuubi]

JustFeng opened a new pull request, #6985:
URL: https://github.com/apache/kyuubi/pull/6985

   [
   [KYUUBI #6984] Fix ValueError when rendering MapType data
   ](https://github.com/apache/kyuubi/issues/6984)
   
   ### Why are the changes needed?
   The issue was caused by an incorrect iteration of MapType data in the `%table` magic command. When iterating over a `MapType` column, the code used `for k, v in m` directly, which leads to a `ValueError` because raw `Map` entries may not be properly unpacked 
   
   ### How was this patch tested?
   - [x] Manual testing:  
     Executed a query with a `MapType` column and confirmed that the `%table` command now renders it without errors.  
   ```python
    from pyspark.sql import SparkSession
    from pyspark.sql.types import MapType, StringType, IntegerType
    spark = SparkSession.builder \
        .appName("MapFieldExample") \
        .getOrCreate()
   
    data = [
        (1, {"a": "1", "b": "2"}),     
        (2, {"x": "10"}),
        (3, {"key": "value"})
    ]
   
    schema = "id INT, map_col MAP<STRING, STRING>"
    df = spark.createDataFrame(data, schema=schema)
    df.printSchema()
    df2=df.collect()
   ```
   using `%table` render table
   ```python
    %table df2
   ```
   
   result
   ```python
   {'application/vnd.livy.table.v1+json': {'headers': [{'name': 'id', 'type': 'INT_TYPE'}, {'name': 'map_col', 'type': 'MAP_TYPE'}], 'data': [[1, {'a': '1', 'b': '2'}], [2, {'x': '10'}], [3, {'key': 'value'}]]}}
   
   ```
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   
   **notice** This PR was co-authored by DeepSeek-R1.
   
   
   
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] [KYUUBI #6984] Fix ValueError when rendering MapType data [kyuubi]

Posted by "turboFei (via GitHub)" <gi...@apache.org>.
turboFei commented on PR #6985:
URL: https://github.com/apache/kyuubi/pull/6985#issuecomment-2728260979

   
   @JustFeng  could you add UT into https://github.com/apache/kyuubi/blob/master/kyuubi-server/src/test/scala/org/apache/kyuubi/engine/spark/PySparkTests.scala? Thanks 
   


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] [KYUUBI #6984] Fix ValueError when rendering MapType data [kyuubi]

Posted by "JustFeng (via GitHub)" <gi...@apache.org>.
JustFeng commented on PR #6985:
URL: https://github.com/apache/kyuubi/pull/6985#issuecomment-2733217411

   > @JustFeng could you add UT into https://github.com/apache/kyuubi/blob/master/kyuubi-server/src/test/scala/org/apache/kyuubi/engine/spark/PySparkTests.scala? Thanks
   
   Update test case in the latest commit, is that ok? @turboFei  


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] [KYUUBI #6984] Fix ValueError when rendering MapType data [kyuubi]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #6985:
URL: https://github.com/apache/kyuubi/pull/6985#issuecomment-2729480372

   ## [Codecov](https://app.codecov.io/gh/apache/kyuubi/pull/6985?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Project coverage is 0.00%. Comparing base [(`d0d24cd`)](https://app.codecov.io/gh/apache/kyuubi/commit/d0d24cd98f79e937f043c2348f86fe55dfd21bca?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`200d7ad`)](https://app.codecov.io/gh/apache/kyuubi/commit/200d7ad9b612b8c8f7172fd38e822c699bb3f286?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 7 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@          Coverage Diff           @@
   ##           master   #6985   +/-   ##
   ======================================
     Coverage    0.00%   0.00%           
   ======================================
     Files         693     693           
     Lines       42723   42723           
     Branches     5813    5813           
   ======================================
     Misses      42723   42723           
   ```
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/kyuubi/pull/6985?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   <details><summary>🚀 New features to boost your workflow: </summary>
   
   - ❄ [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - 📦 [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] [KYUUBI #6984] Fix ValueError when rendering MapType data [kyuubi]

Posted by "turboFei (via GitHub)" <gi...@apache.org>.
turboFei commented on PR #6985:
URL: https://github.com/apache/kyuubi/pull/6985#issuecomment-2739106638

   thanks @JustFeng, merged to master, branch-1.10 and branch-1.9


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] [KYUUBI #6984] Fix ValueError when rendering MapType data [kyuubi]

Posted by "turboFei (via GitHub)" <gi...@apache.org>.
turboFei commented on PR #6985:
URL: https://github.com/apache/kyuubi/pull/6985#issuecomment-2734888188

   thanks


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] [KYUUBI #6984] Fix ValueError when rendering MapType data [kyuubi]

Posted by "turboFei (via GitHub)" <gi...@apache.org>.
turboFei closed pull request #6985: [KYUUBI #6984] Fix ValueError when rendering MapType data
URL: https://github.com/apache/kyuubi/pull/6985


-- 
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: notifications-unsubscribe@kyuubi.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org