[CALCITE-6258] Map value constructor is unparsed incorrectly for PrestoSqlDialect#3683
Conversation
|
Good catch. |
| final String expected = "SELECT MAP ('k1', 'v1', 'k2', 'v2')\n" | ||
| + "FROM (VALUES (0)) t (ZERO)"; | ||
| sql(query).withSpark().ok(expected); | ||
| final String expectedPresto = "SELECT MAP (ARRAY['k1', 'k2'], ARRAY['v1', 'v2'])\n" |
There was a problem hiding this comment.
Hello, maybe we should add a comment with a jira link in the comment?
There was a problem hiding this comment.
done, added new tests
| } else { | ||
| // Current impl is same with Postgresql. | ||
| PostgresqlSqlDialect.DEFAULT.unparseCall(writer, call, leftPrec, rightPrec); | ||
| switch (call.getKind()) { |
There was a problem hiding this comment.
Extract them to createMapValueConstuctor function is bettter.
I like single responsibility principle
There was a problem hiding this comment.
done, extract new function convertMapValueCall
There was a problem hiding this comment.
Why don't we extract more thoroughly?
We can use more parameter like unparseCall(writer, call, leftPrec, rightPrec)
There was a problem hiding this comment.
done, extract map unparse method unparseMapValue
b6d27a9 to
582c94a
Compare
|
Please squash your commits, I will merge it later. @YiwenWu |
582c94a to
895fd3c
Compare
|


fixed Presto Map Function is unparsed incorrectly :map(array, array)
https://issues.apache.org/jira/browse/CALCITE-6258