Add TRANSLATE, TYPEOF, and FIND_IN_SET function mappings#142
Merged
ranjanankur314 merged 54 commits intoe6data:mainfrom Jul 31, 2025
Merged
Add TRANSLATE, TYPEOF, and FIND_IN_SET function mappings#142ranjanankur314 merged 54 commits intoe6data:mainfrom
ranjanankur314 merged 54 commits intoe6data:mainfrom
Conversation
- Implemented FindInSet expression class in expressions.py - Added parser support in databricks.py FUNCTIONS dictionary - Created E6 transformation using ARRAY_POSITION + SPLIT approach - Added comprehensive tests for literal and column reference cases - Updated supported functions JSON with E6 dialect support FIND_IN_SET returns 1-based position of search string in comma-separated list, or 0 if not found. E6 implementation uses ARRAY_POSITION(search, SPLIT(list, ',')) to achieve equivalent functionality.
…e6/sqlglot into learning_collabrative
…ing. But TYPEOF function doesnt support custom datatypes created at runtime
…ing. But TYPEOF function doesnt support custom datatypes created at runtime
| "COUNT_IF" | ||
| "COUNT_IF", | ||
| "TRANSLATE", | ||
| "SPACE", |
There was a problem hiding this comment.
@NiranjGaurav space is not supported directly in e6 right? kindly check
Author
There was a problem hiding this comment.
@Adithyak-0926 i got confused. so should i write the supported functions or the functions that are mapped. please clarify i will change accordingly
There was a problem hiding this comment.
@NiranjGaurav one should add into supported function of e6 here if and only if that function when run directly on e6 engine runs! If space runs directly, u can add if not remove.
| "COUNT_IF" | ||
| "COUNT_IF", | ||
| "TRANSLATE", | ||
| "typeof" |
There was a problem hiding this comment.
@NiranjGaurav "typeof" mention in capital
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
- Implemented FindInSet expression class in expressions.py - Added parser support in databricks.py FUNCTIONS dictionary - Created E6 transformation using ARRAY_POSITION + SPLIT approach - Added comprehensive tests for literal and column reference cases - Updated supported functions JSON with E6 dialect support FIND_IN_SET returns 1-based position of search string in comma-separated list, or 0 if not found. E6 implementation uses ARRAY_POSITION(search, SPLIT(list, ',')) to achieve equivalent functionality.
…ing. But TYPEOF function doesnt support custom datatypes created at runtime
…ing. But TYPEOF function doesnt support custom datatypes created at runtime
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
…rted_functions_in_all_dialects.json, implemented tests for them and ran make check.
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
- Removed TimestampSeconds class from expressions.py to avoid unnecessary class proliferation - Updated Databricks parser to map TIMESTAMP_SECONDS directly to UnixToTime with scale='seconds' - Enhanced E6 generator from_unixtime_sql to handle both 'seconds' and 'milliseconds' scale parameters - Added TIMESTAMP_SECONDS to E6 supported functions list - All existing tests pass, confirming backward compatibility
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
P2 - INTERVAL '5 hours 30 minutes' (as discussed on Zepto channel, you mentioned it has to be developed and you will check on it)
…r for FIND_IN_SET
…ning_collabrative # Conflicts: # apis/utils/supported_functions_in_all_dialects.json # sqlglot/dialects/databricks.py # sqlglot/dialects/e6.py # sqlglot/dialects/spark.py # sqlglot/expressions.py # tests/dialects/test_e6.py
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
NOTE:
There are two functions namely "SUBSTRING_INDEX" and "RANDSTR" couldn't find any direct mapping or indirect mapping. Support for Substring_index could be added but for negative index needs to be discussed.