-
Notifications
You must be signed in to change notification settings - Fork 1k
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
KSQL Functions and Arrays should use 1-based indexing #1659
Comments
How about adding a single property Personally, I prefer this to having some property to control if the index-base is one or zero. Which would require all new functions added to adhere to this too. |
This is related to #1634, whose PR looks to fix SUBSTRING. The PR #1635 fixes SUBSTRING: arrays are now base-one indexed by default. For consistency, the fix for this issue should also use the |
I would prefer the current implementation with 0-based indexes and notes in the documentation reminding that |
Almost all common SQL systems count character-positions within strings starting from one, not zero. (Hive is the only common exception, which kinda betrays it's origins as a tool of java programmers). KSQL should also follow this common pattern in order to ease adoption.
Additionally, those "newer" SQL-based systems which support more complex types like Arrays - e.g. Presto - will count element positions within those arrays also starting at position one, not zero.
Looking at what's currently implemented / requested / in-flight in KSQL, this seems to impact the following:
String Functions
Arrays
The text was updated successfully, but these errors were encountered: