Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Unable to get field named "5". Valid fields: ["2", "3", "10"] #15157

Closed
BohuTANG opened this issue Apr 2, 2024 · 1 comment · Fixed by #15165
Closed

bug: Unable to get field named "5". Valid fields: ["2", "3", "10"] #15157

BohuTANG opened this issue Apr 2, 2024 · 1 comment · Fixed by #15165
Assignees
Labels
C-bug Category: something isn't working

Comments

@BohuTANG
Copy link
Member

BohuTANG commented Apr 2, 2024

Summary

Table:

CREATE OR REPLACE TABLE sales (
    sale_id INT UNSIGNED NOT NULL,
    product_id INT UNSIGNED NOT NULL,
    customer_id INT UNSIGNED NOT NULL,
    sale_date DATE NOT NULL,
    quantity INT NOT NULL,
    net_paid DECIMAL(10, 2) NOT NULL
) 

Query:

  1. OK
SELECT customer_id, sale_id, net_paid,
       truncate(SUM(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date), 4) AS running_total,
       AVG(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date) AS running_avg
FROM sales
ORDER BY customer_id, sale_date
    LIMIT 10;
  1. Error
SELECT customer_id, sale_id, net_paid,
       truncate(SUM(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date), 4) AS running_total,
        truncate(AVG(net_paid) OVER (PARTITION BY customer_id ORDER BY sale_date), 4) AS running_avg
FROM sales
ORDER BY customer_id, sale_date
    LIMIT 10;

Error:

1006=>Unable to get field named "5". Valid fields: ["2", "3", "10"]
@BohuTANG
Copy link
Member Author

BohuTANG commented Apr 2, 2024

Snowflake works well.

@BohuTANG BohuTANG added the C-bug Category: something isn't working label Apr 2, 2024
@sundy-li sundy-li self-assigned this Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants