feat: add Phase 4 function extensions (DateTime, Context)#38
Merged
Conversation
Add support for MM/DD/YYYY and MM-DD-YYYY date formats to the TO_DATE function to handle US-style date strings. This enables compatibility with common American date formatting conventions.
Implement support for Snowflake context functions: - CURRENT_USER() returns "EMULATOR_USER" (fixed value) - CURRENT_ROLE() returns "ACCOUNTADMIN" (fixed value) - CURRENT_WAREHOUSE() returns "EMULATOR_WH" (fixed value) - CURRENT_DATABASE() returns session state (changeable via USE DATABASE) - CURRENT_SCHEMA() returns session state (changeable via USE SCHEMA) SQL rewriter converts Snowflake syntax CURRENT_USER() to DataFusion-compatible current_user (no parentheses), as DataFusion treats these as keywords. Changed default database from "TESTDB" to "EMULATOR_DB" for consistency.
- Remove t.Skip from TestToDate (US format now supported) - Remove t.Skip from TestCurrentUser (CURRENT_USER now implemented) - Remove t.Skip from TestCurrentDatabase (CURRENT_DATABASE now implemented) - Remove t.Skip from TestWindowFirstLastValue and fix query to use subquery TestWindowFirstLastValue fix: Use subquery to ensure window function calculates over the full partition before WHERE clause filters results. This corrects the expected behavior where FIRST_VALUE should return 10 (first value in partition 'A') even when filtering to id=2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
TO_DATE Function Enhancement
MM/DD/YYYYandMM-DD-YYYYContext Functions Implementation
SQL Rewriter
CURRENT_USER()→current_user(DataFusion keyword syntax)CURRENT_DATABASE()→current_databaseCURRENT_SCHEMA()→current_schemaTest plan