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 convert timestamp_ns to date in iceberg table #20462

Closed
cyberchen98 opened this issue Feb 11, 2025 · 3 comments · Fixed by #20571
Closed

BUG: Unable to convert timestamp_ns to date in iceberg table #20462

cyberchen98 opened this issue Feb 11, 2025 · 3 comments · Fixed by #20571
Assignees
Labels
type/bug Something isn't working
Milestone

Comments

@cyberchen98
Copy link

Describe the bug

When executing a SQL query that involves a date comparison with an interval subtraction on an Iceberg table, the query fails with the following error

Error message/log

dev=> SELECT id, price, date FROM price WHERE date <= DATE '2025-02-10' - interval '5' day;
ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: Scheduler error
  2: DataInvalid => Can't convert datum from timestamp_ns type to date type.

To Reproduce

general table

dev=> CREATE TABLE price                  
    (
      id            BIGINT,
      price         NUMERIC,    
      date          DATE
    ); 
CREATE_TABLE
dev=> INSERT INTO price (id, price, date) VALUES                        
(1, 100.50, '2025-02-01'),
(2, 200.75, '2025-02-05'),
(3, 150.25, '2025-02-10');
INSERT 0 3
dev=> SELECT id, price, date FROM price WHERE date <= DATE '2025-02-10' - interval '5' day;
 id | price  |    date    
----+--------+------------
  1 | 100.50 | 2025-02-01
  2 | 200.75 | 2025-02-05
(2 rows)

iceberg table

dev=> CREATE TABLE price
    (
      id            BIGINT,
      price         NUMERIC,    
      date          DATE
    ) ENGINE = ICEBERG; 
CREATE_TABLE
dev=> INSERT INTO price (id, price, date) VALUES
(1, 100.50, '2025-02-01'),
(2, 200.75, '2025-02-05'),
(3, 150.25, '2025-02-10');
INSERT 0 3
dev=> SELECT id, price, date FROM price WHERE date <= DATE '2025-02-10' - interval '5' day;
ERROR:  Failed to run the query

Caused by these errors (recent errors listed first):
  1: Scheduler error
  2: DataInvalid => Can't convert datum from timestamp_ns type to date type.

Expected behavior

No response

How did you deploy RisingWave?

RisingWave Cloud

The version of RisingWave

dev=> select version();
                                       version                                        
--------------------------------------------------------------------------------------
 PostgreSQL 13.14.0-RisingWave-2.3.0-alpha (f9e420f8743215eff528f81bdd8478bb8467abf5)
(1 row)

Additional context

No response

@cyberchen98 cyberchen98 added the type/bug Something isn't working label Feb 11, 2025
@github-actions github-actions bot added this to the release-2.3 milestone Feb 11, 2025
@xxhZs
Copy link
Contributor

xxhZs commented Feb 20, 2025

The type of date - interval is timestamp. And iceberg does not support timestamp to date. In theory, not considered a bug? cc @chenzl25

@chenzl25
Copy link
Contributor

chenzl25 commented Feb 21, 2025

I think it is a bug, because for our query perspective, our iceberg table should support every datatype supported in a normal risingwave table. I think we converted the date type to timestamp_ns before. We can convert it to a supported datatype.

@chenzl25
Copy link
Contributor

It seems a error from iceberg predicate pushdown

dev=> explain SELECT id, price, date FROM price2 WHERE date <= DATE '2025-02-10' - interval '5' day;
                                                                       QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------
 BatchExchange { order: [], dist: Single }
 └─BatchIcebergScan { source: __iceberg_source_price2, columns: [id, price, date], iceberg_scan_type: DataScan, predicate: date <= 2025-02-05 00:00:00 }
(2 rows)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants