Skip to content

Feature parametric types - #4005

Closed
pnowojski wants to merge 3 commits into
prestodb:masterfrom
Teradata:feature_parametric-types
Closed

pnowojski wants to merge 3 commits into
prestodb:masterfrom
Teradata:feature_parametric-types

Conversation

@pnowojski

Copy link
Copy Markdown
Member

This is part of the work for the following issue: #3938

  • generailized parametric types
  • deprecated literalParameters
  • added parser support for BIGINT typeParameter
  • propagated TypeParameterSignature to most of previous TypeSignature uses

TODO/Questions:

  • check/add backward compatibility with old clients (changes in ClientTypeSignature)
  • move parseSignature to presto-main and base it on antlr

@pnowojski

Copy link
Copy Markdown
Member Author

I am not entirely sure if that's right direction. It seems like having two separate lists for literal parameters and type parameters was simpler from code's perspective. Do we really want to unify both of those things? Without unifying we are losing the way to distinguish between two types foo(BIGINT, 42) and foo(42, BIGINT) but do we need that?

@losipiuk

Copy link
Copy Markdown
Contributor

some comments

@pnowojski
pnowojski force-pushed the feature_parametric-types branch from e693590 to 6036a80 Compare November 23, 2015 13:48
@pnowojski
pnowojski force-pushed the feature_parametric-types branch from 6036a80 to ae6cf2c Compare December 28, 2015 13:04
@pnowojski

Copy link
Copy Markdown
Member Author

@martint I have changed implementation of *Parameter classes to your proposed one and I have pushed two more commits that moved ROW type to generalized type parameters (thus completely dropping old literalParameters).

It would be best to minimize changes to commits from this pull request, since there is a lot of more code that depends on those three commits (rebased Dain's VARCHAR changes + decimal changes).

We still need to decide at least what to do with backward compatibility with previous clients.

As a future refactor somewhere down the road, we should indeed do something about redundancy between TypeSignatureParameter, TypeParameter and ClientTypeSignatureParameter classes. Do we need ClientTypeSignature at all? It predates dependency of presto-client to presto-spi, so it might HAD some sense long time ago, but at this moment, I don't see a point of having TypeSignature and ClientTypeSignature?

- generalized parametric types
- deprecated literalParameters
- added parser support for BIGINT typeParameter
- renamed getParameters to getTypeParametersAsTypeSignatures
- bindParameters for generalized type signature
@martint

martint commented Dec 28, 2015

Copy link
Copy Markdown
Contributor

Great, I'll take a look.

I don't think we need ClientTypeSignature any more, by the way.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we want to allow arbitrary types for the "type constructor" idiom. I actually think we made a mistake in allowing anything beyond the special cases described in the SQL spec (INTERVAL, DATE, etc).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this out of scope of this pull request? Can we create an issue for "disallow arbitrary types in type constructor"? Especially that @losipiuk said that such solution was discussed with you about constructing decimal literals.

@martint

martint commented Jan 4, 2016

Copy link
Copy Markdown
Contributor

Isn't this out of scope of this pull request? Can we create an issue for "disallow arbitrary types in type constructor"

What I was suggesting is not that we change what we support today (at least not yet), but to not extend the syntax beyond that. These look weird to me: VARCHAR(10) 'hello', DECIMAL(5,2) '123.456'.

Is there a use case for specifying the type parameters in these expressions given that it can be inferred from the value?

@martint

martint commented Jan 8, 2016

Copy link
Copy Markdown
Contributor

Superseded by #4264

@martint martint closed this Jan 8, 2016
@pnowojski
pnowojski deleted the feature_parametric-types branch January 8, 2016 07:43
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.

4 participants