Skip to content

feat: Phase 4 - Extended function support#20

Merged
sivchari merged 6 commits intomainfrom
feature/phase4-function-expansion
Feb 5, 2026
Merged

feat: Phase 4 - Extended function support#20
sivchari merged 6 commits intomainfrom
feature/phase4-function-expansion

Conversation

@sivchari
Copy link
Copy Markdown
Owner

@sivchari sivchari commented Feb 5, 2026

Summary

  • Add SQL Rewriter function name mappings (CURRENT_TIMESTAMP, TRUNCATE, CEILING, POW, LEN, IFNULL, ZEROIFNULL, NULLIFZERO)
  • Add Date/Time functions: TO_DATE, TO_TIMESTAMP, LAST_DAY, DAYNAME, MONTHNAME
  • Add Numeric functions: DIV0, DIV0NULL
  • Add Hash functions: SHA1, SHA2 (224/256/384/512)
  • Add Context functions: CURRENT_USER, CURRENT_ROLE, CURRENT_DATABASE, CURRENT_SCHEMA, CURRENT_WAREHOUSE
  • Add Go integration tests for Phase 4 functions

Test plan

  • 119 Rust unit tests passing
  • Go integration tests added for all new functions
  • CI passes

Add SQL rewriter rules to map Snowflake function names to DataFusion equivalents: CURRENT_TIMESTAMP->now(), TRUNCATE->trunc, CEILING->ceil, POW->power, LEN->length, IFNULL->NVL, ZEROIFNULL->COALESCE, NULLIFZERO->NULLIF
…ME functions

- TO_DATE: convert string to date with auto format detection

- TO_TIMESTAMP: convert string to timestamp

- LAST_DAY: return last day of month

- DAYNAME: return weekday name (Mon, Tue, etc.)

- MONTHNAME: return month name (Jan, Feb, etc.)
- DIV0: returns 0 when dividing by zero

- DIV0NULL: returns NULL when dividing by zero
- SHA1: returns 40-char hex SHA-1 hash

- SHA2: returns SHA-2 hash with configurable bit length (224, 256, 384, 512)
Add Snowflake-compatible context functions that return emulator defaults:

- CURRENT_USER() -> EMULATOR_USER

- CURRENT_ROLE() -> ACCOUNTADMIN

- CURRENT_DATABASE() -> EMULATOR_DB

- CURRENT_SCHEMA() -> PUBLIC

- CURRENT_WAREHOUSE() -> EMULATOR_WH
Add Go integration tests for Phase 4 functions:

- Date/Time: TO_DATE, LAST_DAY, DAYNAME, MONTHNAME

- Numeric: DIV0, DIV0NULL

- Hash: SHA1, SHA2

- Context: CURRENT_USER, CURRENT_ROLE, CURRENT_DATABASE, CURRENT_SCHEMA, CURRENT_WAREHOUSE

- SQL Rewriter: CURRENT_TIMESTAMP, LEN
@sivchari sivchari merged commit 763ab4a into main Feb 5, 2026
2 checks passed
@sivchari sivchari deleted the feature/phase4-function-expansion branch February 5, 2026 05:23
@github-actions github-actions bot mentioned this pull request Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant