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

Implemented parametric VARCHAR #88

Closed
wants to merge 19 commits into from

Conversation

pnowojski
Copy link

No description provided.

pnowojski and others added 19 commits December 30, 2015 10:28
Currently it is hard to calculate length of return type
properly for vararg functions.
This patch changes the way optimization for not inserting cast calls for
type-type only coercions work.

Original code caused errors during bytecode preparation for plan execution.
Problematic case:

ARRAY('dog', 'kitten').
During semantic analysis this was treated as:
ARRAY((CAST 'dog' as VARCHAR(6)), 'kitten') and therefore
implementation of ArrayConstructor for parameter type VARCHAR(6) was
generated.

But cast expression was not added to result query expression, as
case VARCHAR(3) -> VARCHAR(6) is type-only cast.

Then byte generating code was failing as it was looking for
instantiation of ARRAY_CONSTRUCTOR(VARCHAR(3), VARCHAR(6)) despite the fact
only ARRAY_CONSTRUCTOR(VARCHAR(6), VARCHAR(6)) was generated.

Now we add Cast operator to AST. But it has typeOnly marker set to true.
And then when execution plan is generated no cast operation call is
generated.
1. relax limitation that when INSERT INTO statement is called
values/query types must exactly match table column types.
Now we allow values/query types to be type-only coercible to table
column types.

2. allow difference between inserted values and table column types if
they are type-coercable for structural types.
@pnowojski
Copy link
Author

This pull request follows prestodb#4005

@pnowojski
Copy link
Author

Superseded by prestodb#4303

@losipiuk losipiuk deleted the parametric_varchar branch January 21, 2016 08:26
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.

5 participants