René's URL Explorer Experiment


Title: first_value doesn't work when applied to window function output · Issue #1300 · apache/datafusion-python · GitHub

Open Graph Title: first_value doesn't work when applied to window function output · Issue #1300 · apache/datafusion-python

X Title: first_value doesn't work when applied to window function output · Issue #1300 · apache/datafusion-python

Description: Describe the bug A clear and concise description of what the bug is. If I generate a column based on a window function then try to filter and select the first value it barfs To Reproduce Steps to reproduce the behavior: import datafusion...

Open Graph Description: Describe the bug A clear and concise description of what the bug is. If I generate a column based on a window function then try to filter and select the first value it barfs To Reproduce Steps to r...

X Description: Describe the bug A clear and concise description of what the bug is. If I generate a column based on a window function then try to filter and select the first value it barfs To Reproduce Steps to r...

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

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"first_value doesn't work when applied to window function output","articleBody":"**Describe the bug**\nA clear and concise description of what the bug is.\nIf I generate a column based on a window function then try to filter and select the first value it barfs\n\n**To Reproduce**\nSteps to reproduce the behavior:\n```python\nimport datafusion as dfn\nfrom datafusion import lit, col, functions as F\nfrom datafusion.expr import Window, WindowFrame\n\ndef main() -\u003e None:\n    ctx = dfn.SessionContext()\n    df = ctx.from_pydict(\n        {\"any_row\": list(range(10))},\n    )\n    df = df.select(\n        \"any_row\",\n        lit(1).alias(\"ones\"),\n    )\n    df = df.select(\n        \"any_row\",\n        F.sum(col(\"ones\"))\\\n            .over(Window(window_frame=WindowFrame(\"rows\", None, 0), order_by=col(\"any_row\").sort(ascending=True))) \\\n            .alias(\"forward_row_sum\"),\n        F.sum(col(\"ones\"))\\\n            .over(Window(window_frame=WindowFrame(\"rows\", None, 0), order_by=col(\"any_row\").sort(ascending=False))) \\\n            .alias(\"reverse_row_sum\"),\n    )\n    df.collect()\n    df.select(\n        F.first_value(col(\"forward_row_sum\"), order_by=col(\"any_row\"))\n    ).collect()\n\n    df.select(\n        F.last_value(col(\"reverse_row_sum\"), filter=col(\"reverse_row_sum\") \u003e= 5, order_by=col(\"any_row\").sort(ascending=True))\n    ).collect()\n\nif __name__ == \"__main__\":\n    main()\n```\n\n```console\nTraceback (most recent call last):\n  File \"/Users/nick/repos/bug.py\", line 39, in \u003cmodule\u003e\n    main()\n    ~~~~^^\n  File \"/Users/nick/repos/bug.py\", line 26, in main\n    ).collect()\n      ~~~~~~~^^\n  File \"/Users/nick/repos/.venv/lib/python3.13/site-packages/datafusion/dataframe.py\", line 681, in collect\n    return self.df.collect()\n           ~~~~~~~~~~~~~~~^^\nException: DataFusion error: NotImplemented(\"Physical plan does not support logical expression AggregateFunction(AggregateFunction { func: AggregateUDF { inner: FirstValue { name: \\\"first_value\\\", signature: Signature { type_signature: Any(1), volatility: Immutable }, accumulator: \\\"\u003cFUNC\u003e\\\" } }, params: AggregateFunctionParams { args: [Column(Column { relation: None, name: \\\"sum(ones) ORDER BY [c19e557aec20e49b985bb070e969ba68f.any_row ASC NULLS FIRST] ROWS BETWEEN UNBOUNDED PRECEDING AND 0 FOLLOWING\\\" })], distinct: false, filter: None, order_by: [Sort { expr: Column(Column { relation: Some(Bare { table: \\\"c19e557aec20e49b985bb070e969ba68f\\\" }), name: \\\"any_row\\\" }), asc: true, nulls_first: true }], null_treatment: Some(RespectNulls) } })\")\n```\n\n**Expected behavior**\nA clear and concise description of what you expected to happen.\nThat I get the first (or last) value.\n\n**Additional context**\nAdd any other context about the problem here.\n```python\nimport datafusion as dfn\n\u003e\u003e\u003e dfn.__version__\n'50.1.0'\n```","author":{"url":"https://github.com/ntjohnson1","@type":"Person","name":"ntjohnson1"},"datePublished":"2025-11-05T20:22:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/1300/datafusion-python/issues/1300"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:0dc4caa6-572c-12e6-3aa0-3b65254c0dfb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC370:2C22F5:7F5D89:A5885B:6976DA1D
html-safe-nonce388d82740e5a5ae5b07c1a8af5d3b22c4b735416608dcdf41980188e20d6753d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzcwOjJDMjJGNTo3RjVEODk6QTU4ODVCOjY5NzZEQTFEIiwidmlzaXRvcl9pZCI6IjQ4MzU0NDA3MDgwNzgxOTcyNzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8da504213c7d71109efdfa2752fdd8bf637e646cf46e566c63d1f09bbafab451
hovercard-subject-tagissue:3592659688
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/1300/issue_layout
twitter:imagehttps://opengraph.githubassets.com/da45c6f77ae971813a4effab250a3b23851032320d8a82f8d940381cd3217179/apache/datafusion-python/issues/1300
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/da45c6f77ae971813a4effab250a3b23851032320d8a82f8d940381cd3217179/apache/datafusion-python/issues/1300
og:image:altDescribe the bug A clear and concise description of what the bug is. If I generate a column based on a window function then try to filter and select the first value it barfs To Reproduce Steps to r...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamentjohnson1
hostnamegithub.com
expected-hostnamegithub.com
None01d198479908d09a841b2febe8eb105a81af2af7d81830960fe0971e1f4adc09
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
releasef752335dbbea672610081196a1998e39aec5e14b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/apache/datafusion-python/issues/1300#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%2F1300
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%2F1300
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/1300
Reloadhttps://patch-diff.githubusercontent.com/apache/datafusion-python/issues/1300
Reloadhttps://patch-diff.githubusercontent.com/apache/datafusion-python/issues/1300
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/1300
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/apache/datafusion-python/issues/1300
#1348https://github.com/apache/datafusion-python/pull/1348
first_value doesn't work when applied to window function outputhttps://patch-diff.githubusercontent.com/apache/datafusion-python/issues/1300#top
#1348https://github.com/apache/datafusion-python/pull/1348
https://patch-diff.githubusercontent.com/AdMub
bugSomething isn't workinghttps://github.com/apache/datafusion-python/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/ntjohnson1
https://github.com/ntjohnson1
ntjohnson1https://github.com/ntjohnson1
on Nov 5, 2025https://github.com/apache/datafusion-python/issues/1300#issue-3592659688
AdMubhttps://patch-diff.githubusercontent.com/AdMub
bugSomething isn't workinghttps://github.com/apache/datafusion-python/issues?q=state%3Aopen%20label%3A%22bug%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.