René's URL Explorer Experiment


Title: Add support for scalar values with extension types · Issue #1301 · apache/datafusion-python · GitHub

Open Graph Title: Add support for scalar values with extension types · Issue #1301 · apache/datafusion-python

X Title: Add support for scalar values with extension types · Issue #1301 · apache/datafusion-python

Description: Is your feature request related to a problem or challenge? Please describe what you are trying to do. Suppose I have a pyarrow scalar value that contains an extension type. If I try turning that into a literal expression in datafusion, w...

Open Graph Description: Is your feature request related to a problem or challenge? Please describe what you are trying to do. Suppose I have a pyarrow scalar value that contains an extension type. If I try turning that in...

X Description: Is your feature request related to a problem or challenge? Please describe what you are trying to do. Suppose I have a pyarrow scalar value that contains an extension type. If I try turning that in...

Opengraph URL: https://github.com/apache/datafusion-python/issues/1301

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add support for scalar values with extension types","articleBody":"**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**\n\nSuppose I have a pyarrow scalar value that contains an extension type. If I try turning that into a literal expression in datafusion, we should get the associated metadata transparently to the user.\n\nConsider this minimal example:\n\n```python\nimport pyarrow as pa\nimport uuid\nfrom datafusion import lit\n\nvalue = pa.scalar(uuid.uuid4().bytes, pa.uuid())\n\nprint(lit(value))\n```\n\nThis currently fails with `ArrowTypeError: Expected bytes, got a 'UUID' object`. That can be overcome with the simple patch\n\n```patch\n--- a/src/pyarrow_util.rs\n+++ b/src/pyarrow_util.rs\n@@ -30,7 +30,11 @@ impl FromPyArrow for PyScalarValue {\n     fn from_pyarrow_bound(value: \u0026Bound\u003c'_, PyAny\u003e) -\u003e PyResult\u003cSelf\u003e {\n         let py = value.py();\n         let typ = value.getattr(\"type\")?;\n-        let val = value.call_method0(\"as_py\")?;\n+        let val = if value.hasattr(\"value\")? {\n+            value.getattr(\"value\")?\n+        } else {\n+            value.call_method0(\"as_py\")?\n+        };\n```\n\nBut then we still don't have the metadata. It is lost and we get a bare fixed sized binary.\n\n**Describe the solution you'd like**\n\nThe above code should *just work*. I have done a little investigation and using the pycapsule interface we *can* get the schema of the array we generate inside `PyScalarValue::from_pyarrow_bound`. We can then plumb this through when calling `lit()`.\n\nIdeally we would take this opportunity to ensure that when we call `PyScalarValue::from_pyarrow_bound` we are also supporting other libraries besides just `pyarrow`. There has been a complaint a few times that we are too tightly coupled to `pyarrow`. In particular it would be good to demonstrate that when converting a Python object that is a scalar value it works for:\n\n- pyarrow\n- nanoarrow\n- arro3\n- polars\n\nI don't think we necessarily need to support pandas since they are not an Arrow library.\n\n**Describe alternatives you've considered**\n\nAlternatively the user can manually turn their data into the underlying storage and then attach the metadata from their extension type. This feels like a poor user experience.\n\n**Additional context**\n\nThis came up during a different investigation:\n\n\u003e Also worth evaluating while we're doing this: For scalar values, is it possible for them to contain metadata? If I do `pa.scalar(uuid.uuid4().bytes, type=pa.uuid())` and I check the `type` I should have the extension data. Maybe this is already supported, but as part of this PR I want to evaluate that as well.\n\n_Originally posted by @timsaucer in https://github.com/apache/datafusion-python/issues/1299#issuecomment-3497558869_\n","author":{"url":"https://github.com/timsaucer","@type":"Person","name":"timsaucer"},"datePublished":"2025-11-06T22:19:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1301/datafusion-python/issues/1301"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:db39617e-68c6-ab3a-8cee-ba7b05feee64
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id88D2:12A68A:17F1DC1:1F511D5:6976C5FF
html-safe-nonce411a4c3ef6756ccad1b67793d4c82dbbaa87567f26060c92962d2da66423ce1e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OEQyOjEyQTY4QToxN0YxREMxOjFGNTExRDU6Njk3NkM1RkYiLCJ2aXNpdG9yX2lkIjoiMzA0ODM4MDIxODY1ODQ0MDcwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac15eed6eeaa9fa7b0d0e0b1aa66c5fcccdf1c02561ac83c11d74a96d0000daba8
hovercard-subject-tagissue:3597871719
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/datafusion-python/1301/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c46dfe412246092ca6a77215d3618c3ba493c399bf89bb2fd225583435faa782/apache/datafusion-python/issues/1301
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c46dfe412246092ca6a77215d3618c3ba493c399bf89bb2fd225583435faa782/apache/datafusion-python/issues/1301
og:image:altIs your feature request related to a problem or challenge? Please describe what you are trying to do. Suppose I have a pyarrow scalar value that contains an extension type. If I try turning that in...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametimsaucer
hostnamegithub.com
expected-hostnamegithub.com
None032152924a283b83384255d9489e7b93b54ba01da8d380b05ecd3953b3212411
turbo-cache-controlno-preview
go-importgithub.com/apache/datafusion-python git https://github.com/apache/datafusion-python.git
octolytics-dimension-user_id47359
octolytics-dimension-user_loginapache
octolytics-dimension-repository_id515951203
octolytics-dimension-repository_nwoapache/datafusion-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id515951203
octolytics-dimension-repository_network_root_nwoapache/datafusion-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release5b577f6be6482e336e3c30e8daefa30144947b17
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/apache/datafusion-python/issues/1301#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fapache%2Fdatafusion-python%2Fissues%2F1301
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fapache%2Fdatafusion-python%2Fissues%2F1301
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=apache%2Fdatafusion-python
Reloadhttps://patch-diff.githubusercontent.com/apache/datafusion-python/issues/1301
Reloadhttps://patch-diff.githubusercontent.com/apache/datafusion-python/issues/1301
Reloadhttps://patch-diff.githubusercontent.com/apache/datafusion-python/issues/1301
apache https://patch-diff.githubusercontent.com/apache
datafusion-pythonhttps://patch-diff.githubusercontent.com/apache/datafusion-python
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fapache%2Fdatafusion-python
Fork 142 https://patch-diff.githubusercontent.com/login?return_to=%2Fapache%2Fdatafusion-python
Star 553 https://patch-diff.githubusercontent.com/login?return_to=%2Fapache%2Fdatafusion-python
Code https://patch-diff.githubusercontent.com/apache/datafusion-python
Issues 80 https://patch-diff.githubusercontent.com/apache/datafusion-python/issues
Pull requests 27 https://patch-diff.githubusercontent.com/apache/datafusion-python/pulls
Actions https://patch-diff.githubusercontent.com/apache/datafusion-python/actions
Security 0 https://patch-diff.githubusercontent.com/apache/datafusion-python/security
Insights https://patch-diff.githubusercontent.com/apache/datafusion-python/pulse
Code https://patch-diff.githubusercontent.com/apache/datafusion-python
Issues https://patch-diff.githubusercontent.com/apache/datafusion-python/issues
Pull requests https://patch-diff.githubusercontent.com/apache/datafusion-python/pulls
Actions https://patch-diff.githubusercontent.com/apache/datafusion-python/actions
Security https://patch-diff.githubusercontent.com/apache/datafusion-python/security
Insights https://patch-diff.githubusercontent.com/apache/datafusion-python/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/apache/datafusion-python/issues/1301
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/apache/datafusion-python/issues/1301
Add support for scalar values with extension typeshttps://patch-diff.githubusercontent.com/apache/datafusion-python/issues/1301#top
enhancementNew feature or requesthttps://github.com/apache/datafusion-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/timsaucer
https://github.com/timsaucer
timsaucerhttps://github.com/timsaucer
on Nov 6, 2025https://github.com/apache/datafusion-python/issues/1301#issue-3597871719
@timsaucerhttps://github.com/timsaucer
#1299 (comment)https://github.com/apache/datafusion-python/pull/1299#issuecomment-3497558869
enhancementNew feature or requesthttps://github.com/apache/datafusion-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.