-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[CALCITE-2721] Support parsing of DOT + MEMBER_FUNCTION #1011
Conversation
} | ||
{ | ||
( | ||
LOOKAHEAD( CompoundIdentifier() <LPAREN>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid this lookahead? It seems NamedMemberFunctionCall() and CompoundIdentifier() share the same prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. the lookahead at the extra <LPAREN>
is the way I used to determine whether the compoundidentifier is actually a member function or simply a compound list of SqlIdentifier.
Do you have better suggestions on how to tackle this? like change the NamedMemberFunctionCall()
to handle both the scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the NamedMemberFunctionCall() to handle both the scenarios
Yes, I think so. Or if you prefer retaining these branches, I guess something like
(
p = Identifier() {
return new SqlIdentifier(p, getPos());
}
|
e = CompoundIdentifier()
[
e = NamedMemberFunctionCall(e)
]
)
should also work fine here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did a bit of test and turns out we dont even need the compoundidentifier since we need to support all simple identifier first. removing the last rule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please check if following code works?
{
(
e = NamedMemberFunctionCall()
|
p = Identifier() {
return new SqlIdentifier(p, getPos());
}
)
{ return e; }
}
The file Parser.jj
tends to guarantee to generate a near LL(2) parser, any change should aways avoid syntactic lookahead if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately this doesn't work. I actually tried to eliminate all these by just having this piece of code, (which I think is the right way to approach)
(
e = // Identifier() or CompoundIdentifier()
[
// ... (match <LPAREN> and then parse function arguments)
e = createCall( ...
]
)
The actual problem here is that,
- if using
Identifier()
, the function hierarchy is not correct. for example,foo().complex.function.name(arg1, arg2)
will be resolved as((foo().complex).function).name(arg1, arg2)
which should've beenfoo().complex.function.name(arg1, arg2)
according to the JIRA discussion. - if using
Compoundidentifier()
, the following doesn't work:foo()."EXPR$1"."EXPR$2"
would not be resolved correctly as the part."EXPR$1"."EXPR$2"
is not a valid compound identifier.
One thing I can think of is. there's no way to distinguish the boundary of foo().complex.column.complex.function(...)
during parser phase. If we do not accept complex function name, I think the above solution with simply just Identifier()
should work.
Seems like the problem about identifier can be fix once #958 is merged. I would suggest we hold off this PR until CALCITE-2674 is fixed. |
#958 has been merged. thus I updated the One problem remains:
I am planning to fix this on CALCITE-2906. |
* Tests that applying member function of a specific type as a suffix function | ||
*/ | ||
@Test public void testMemberFunction() { | ||
check("SELECT myColumn.func(a, b) FROM tbl", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Firstly, thank you for keeping working on this, @walterddr!
Comment of this line:
As the expression is written as myColumn.func(...)
, shouldn't it be parsed to a DOT expression? But by looking into the generated parse tree I think the result is more like a schema.func(...)
(see following).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is this the problem should be resolved with CALCITE-2906?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is something I wasn't absolutely sure. Generally speaking member function should come after a record type. However, during parsing time there's really no way to distinguish.
CALCITE-2906 is more broader discussion on this (not just member function, but also affects DOT operator after array element, expression, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, at this moment, both array element and expression only support SimpleIdentifier, not compound identifier. so I think it is better to address them together in a different PR. But I am open to any suggestions :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your explanation, I too think it's hard to distinguish them now.
As for the array element part, do you already have a plan? I guess it maybe better to somehow move <DOT> RowExpressionExtension() ...
syntax code to Expression2()
, for keeping Expression2b()
clean.
@walterddr Could you take a look at the conflict that has been introduced? |
reducing complexity of RowExpressionExtension by only parsing Simple Identifiers
@michaelmior thanks for the reminder. I just rebased and updated the change. I think the discussion has pretty much finalized. Can you take another look if possible? |
@zhztheplayer Do you mind having a final look? |
Thanks @walterddr and @michaelmior, I think it's good to go. A minor suggestion - as parser might go into conflict when parsing member functions or regular functions after applying the PR, we'd better to push CALCITE-2906 forward earlier, say, we can mark that one as 1.21.0, so that we don't forget to come up with a final solution. |
@zhztheplayer I already have an experiment on CALCITE-2906 and seems like the concern is less obvious after I rebased with latest master. but you are right the risk is there. I will also closely involve with CALCITE-2906 and agree it should be fix soon. |
* [CALCITE-3003] AssertionError when GROUP BY nested field (Will Yu) Close apache#1186 * Oops, remove a println * [CALCITE-3049] When simplifying "IS NULL" and "IS NOT NULL", simplify the operand first When simplifying "(x IS NULL) IS NOT NULL", remove redundant casts before simplifying the operand. Julian Hyde started work on this case, simplifying before and after, and Danny Chan improved it by only simplifying before. Close apache#1198 * [CALCITE-3039] In Interpreter, min() incorrectly returns maximum double value (dijkspicy) Close apache#1197 * [CALCITE-3054] Elasticsearch adapter. Avoid scripting for simple projections Simple query like below is using `script` when `_source` is sufficient. ```sql select _MAP['a'], _MAP['b.a'] from elastic ``` * [CALCITE-2846] Document Oracle-specific functions, such as NVL and LTRIM, in the SQL reference * [CALCITE-3053] Add a test to ensure that all functions are documented in the SQL reference Following [CALCITE-2846], fix up the documentation of MySQL- and Oracle-specific operators to make it better fit narrow web pages. * [CALCITE-3046] CompileException when inserting casted value of composited user defined type into table Also, add several test cases for EnumerableRelImplementor.TypeFinder. * [CALCITE-3056] Elasticsearch adapter. Invalid result with cast function on raw queries Fix queries of type (with elastic adapter): ```sql select max(cast(_MAP['foo'] as integer)) from elastic ``` * Mongo adapter. Mongo checker validates only first line of the Bson query in tests `BsonDocument.parse()` is more lenient with input and this omission was not noticed before * Site: Improve contribution guidelines for JIRA Summarize the respective discussion in the dev list( https://lists.apache.org/thread.html/59d028ec300884e432f9be1abe894d076e94b9f1ac9427cb22fa745d@%3Cdev.calcite.apache.org%3E) and include the suggestions from all participants. * [CALCITE-3017] Re-organize how we represent built-in operators that are not in the standard operator table Add enum SqlLibrary, with values STANDARD, SPATIAL, ORACLE, MYSQL etc., and SqlLibraryOperatorTableFactory, that can create operator tables for any combination of libraries. Further changes by Julian Hyde: * Adopt the term "library" (earlier revisions had "dialect" and "flavor"); * Change SqlDialectOperatorTableFactory into a cache (previously it pre-built one table per library); * Make it responsible for standard and spatial libraries in addition to database-specific ones; * Move operators from SqlLibraryOperatorTableFactory into a dedicated holder class, SqlLibraryOperators; * Deprecate OracleSqlOperatorTable, and move its operator definitions. Close apache#1203 * [CALCITE-3061] Query with WITH clause fails when alias is the same as the table with rolled up column Close apache#1206 * [CALCITE-2803] ProjectTransposeJoinRule messes INDF expressions ProjectTransposeJoinRule does not identify expanded versions of IS NOT DISTINCT FROM expressions in the join filter, and might push them below the join operator in a way which makes impossible for RelOptUtil#splitJoinCondition() to identify the INDF condition and mis- categorize the join as not being an equi-join. Fix the issue by collapsing INDF expressions before invoking PushProjector. Also add support for expanded form CASE(WHEN A IS NULL THEN B IS NULL WHEN B IS NULL THEN A IS NULL ELSE A = B). * Site: Add Danny Chan as committer * [CALCITE-3034] CSV test case description does not match it's code logic (FaxianZhao) The o.a.c.a.c.CsvFilterableTable will ignore the whole filter condition with AND as SqlKind before this patch. Close apache#3034 * [CALCITE-2936] Simplify EXISTS or NOT EXISTS sub-query that has "GROUP BY ()" * [CALCITE-3017] Improve null handling of JsonValueExpressionOperator * Remove SqlJsonApiCommonSyntaxOperator; * Move implementation methods of JSON functions from SqlFunctions to JsonFunctions; * Add new null policy NullPolicy.ARG0 (currently used by some JSON functions only); * Change return type to nullable for some operators of JSON functions; * In code generation, perform regular null semantic check on operands of a call when NullAs.IS_NULL/IS_NOT_NULL is used. * [CALCITE-3028] Support FULL OUTER JOIN with AggregateJoinTransposeRule (Vineet Garg) * [CALCITE-3066] RelToSqlConverter may incorrectly throw an AssertionError for some decimal literals Close apache#1213 * [CALCITE-3052] Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): ArrayIndexOutOfBoundsException Close apache#1212 * [CALCITE-2282] Remove sql operator table from parser Differentiate for unresolved functions and non-parameters function identifier unparsing; Merge logic in SqlIdeitifier and SqlUtil; Fix Julian's comments address: Remove leftPrec and rightPrec from SqlCollation. Close apache#1205 * [CALCITE-2933] Add timestamp extract for casts from timestamp type to other types In Druid, timestamp is stored as a UTC long value, so the Cast(timestamp as varchar) should transform to date format string. Close apache#1120 * [CALCITE-2975] Implement JSON_REMOVE function (xuqianjin) Close apache#1146 * [CALCITE-3062] Do not populate provenanceMap if not debug VolcanoPlanner.provenanceMap captures provenance of all rel nodes added to the planner but the information is only printed out if planner log level is debug or finer. As the map can get quite big with complex queries, the memory usage can increase significantly. Detect if planner log level is debug when creating a new volcano planner and use a blackhole map so that the map is not populated by default. Change-Id: If6393eb07438ea5f922c9f78f26089160926ef37 * [CALCITE-3074] Move MySQL's JSON operators to SqlLibraryOperators * [CALCITE-2965] Implement string functions: REPEAT, SPACE, SOUNDEX, DIFFERENCE * [CALCITE-2712] Add rule to remove null-generating side of a Join * [CALCITE-3072] Generate right SQL for FLOOR&SUBSTRING functions in SparkSqlDialect (DonnyZone) TimeUnit first in SparkSQL date_trunc; Add test for floor with one operand. Close apache#1216 * [CALCITE-3068] testSubprogram() does not test whether subprogram gets re-executed * [CALCITE-3076] AggregateJoinTransposeRule throws error for unique under aggregate keys when generating merged calls AggregateJoinTransposeRule generates wrong mapping for under agg calls with unique aggregate keys. Close apache#1223 * [CALCITE-2601] Add REVERSE function (pingle wang) Close apache#1209 * [CALCITE-3067] Splunk adapter cannot parse right session keys from Splunk 7.2 (Shawn Chen) Close apache#1222 * [CALCITE-3023] Upgrade elastic search to 7.x (Takako Shimamoto) * [CALCITE-3050] Integrate SqlDialect and SqlParser.Config Add a method SqlDialect.configureParser(SqlParser.ConfigBuilder), which allows a dialect to pass on its settings to a SQL parser. Also add SqlDialect methods getUnquotedCasing(), getQuotedCasing(), getConformance(), isCaseSensitive(). Add Snowflake dialect. * [CALCITE-2807] Fix `IS NOT DISTINCT FROM` expression identification in RelOptUtil#pushDownJoinConditions() RelOptUtil#pushDownJoinConditions do not identify and preserve expanded versions of `IS NOT DISTINCT FROM` expressions, causing equi-joins to be miscategorized as inequality joins. Modify the function to try to collapse the expression back to a canonical `IS NOT DISTINCT FROM` expression if possible before visiting the expression and pushing it below the join. * Oops, broke a test on Windows * [CALCITE-2985] Implement JSON_STORAGE_SIZE function (xuqianjin) Also, correct content about error handling of MySQL JSON functions in documentation. Close apache#1150 * [CALCITE-3084] Implement JDBC string functions: ASCII, REPEAT, SPACE, SOUNDEX, DIFFERENC (pingle wang) * [CALCITE-3090] Use https for maven central Closes apache#1233 Signed-off-by: Julian Hyde <jhyde@apache.org> Signed-off-by: Kevin Risden <krisden@apache.org> * [CALCITE-2913] Adapter for Apache Kafka (Mingmin Xu) Expose an Apache Kafka topic as a stream table. * Revert "[CALCITE-3090] Use https for maven central" This reverts commit 1310295. * [CALCITE-3090] Remove Central configuration We don't actually need the explicit configuration for Central. We're just providing the same value that's already configured. Closes apache#1234 Signed-off-by: Kevin Risden <krisden@apache.org> * Improve display of reproducer code in RexFuzzerTest for SqlStdOperatorTable.MULTIPLY It was displayed as SqlStdOperatorTable.*, however mul(a, b) should be used * Add system properties to RexProgramFuzzyTest to simplify git bisect * [CALCITE-3077] Rewrite CUBE&ROLLUP queries in SparkSqlDialect (DonnyZone) * [CALCITE-35] More test cases to guard against providing a broken fix for parenthesized join (Muhammad Gelbana) Close apache#1228 * Make field JdbcTableScan.jdbcTable public * Remove call to Class.newInstance(), which is deprecated as of JDK 9 * Cosmetic changes * [CALCITE-3021] Equality of nested ROWs returns false for identical values * [CALCITE-2952] Document JDK 12 support * [CALCITE-3055] Use pair of relNode's rowType and digest as unique key for cache in RelOptPlanner (KazydubB) Currently RelNode's digest can not uniquely identify itself, two relational expressions are equivalent only if their digests and row types are the same. * Add unit test and update code for testing dynamic tables to reflect real use-cases; * Add row type as part of cache key for HepPlanner. close apache#1230 * [CALCITE-3096] In RelBuilder, make alias method idempotent * Javadoc typos (Wenhui Tang, Muhammad Gelbana) Close apache#1238 Close apache#1194 * [CALCITE-3022] Babel: Various SQL parsing issues * Allow 'DATE(x)' function, per PostgreSQL and Redshift * Allow "TIMESTAMP 'yyyy-mm-dd'" literal (missing time part), per PostgreSQL and Redshift * [CALCITE-3048] Improve how JDBC adapter deduces current schema on Redshift In JdbcSchema on PostgreSQL or Redshift, if schema is null, call CURRENT_SCHEMA() to get it. Similarly catalog and CURRENT_DATABASE(). Without this fix, we sometimes call DatabaseMetaData.getTables with null or empty schema, and get tables from other schemas, resulting in a Guava "Multiple entries with same key" error. * [CALCITE-3047] In JDBC adapter, expose multiple schemas of the back-end database We do this by adding JdbcCatalogSchema, an implementation of Schema that reads the back-end database catalog and for each schema, creates a sub-schema that is a JdbcSchema. Also add an experimental way to create a Calcite connection with a given schema as its root schema (in this case, a JdbcCatalogSchema) rather than the usual AbstractSchema. Rather than calling JdbcSchema.getDataSource(), generated code now calls schema.unwrap(DataSource.class). This works for JdbcCatalogSchema as well as JdbcSchema. * [CALCITE-3097] GROUPING SETS breaks on sets of size > 1 due to precedence issues (Steven Talbot) RelToSqlConverter was converting each composite item in GROUPING SETS into a SqlNodeList when it should be a call to the ROW operator. Close apache#1239 * [CALCITE-2812] Add algebraic operators to allow expressing recursive queries 1. Add Spool, and RepeatUnion operators with their Logical and Enumerable counterparts as well as appropriate converter rules. 2. Add new interface allowing to express transient tables with a sample implementation. 3. Add new methods in RelBuilder useful for building recursive queries. 4. Update the website with examples for building recursive queries. 5. Add HierarchySchema allowing to express interesting hierarchies through recursive queries. 6. Add unit tests verifying the plan created by the builder and correctness of the new operators. Close apache#1020 * RelOptUtilTest concurrency fixup RelOptUtilTest was creating a static RelOptCluster which could be used during tests running in parallel to acces the associated RelMetadataQuery instance. Alas the object is not safe to access from multiple threads and in some occasions tests would fail with CyclicMetadataException. Fixing the test class by creating a new RelOptCluster/RelBuilder instance for each test, and removing the static instances. * [CALCITE-2696] Improve design of join-like relational expressions **Diff** - Deprecate SemiJoin, EnumerableSemiJoin, SemiJoinType, EnumerableSemiJoinRule, JoinToCorrelateRule#SEMI - Add SEMI and ANTI join type to JoinRelType, add method projectsRight() and isOuterJoin() - Correlate use JoinRelType instead of SemiJoinType - Rename EnumerableThetaJoin to EnumerableNestedLoopJoin - Rename EnumerableJoin to EnumerableHashJoin - EnumerableJoinRule converts semi join to EnumerableHashJoin (EnumerableSemiJoin's functionality is merged into this rule) - Add method isSemiJoin() in Join.java to decide if this join is a semi join (comes from SemiJoinRule during decorrelateation), the return value true means the join is a semi join equivalent to SemiJoin before this patch. - Cache the JoinInfo in Join and use it to get leftKeys and rightKeys, merge SemiJoin#computeSelfCost logic into Join#computeSelfCost - For RelBuilder, removes SemiJoinFactory, method #semiJoin now returns a LogicalJoin with JoinRelType#SEMI - Rename EnumerableDefaults#join to EnumerableDefaults#hashJoin - Rename EnumerableDefaults#thetaJoin to EnumerableDefaults#nestedLoopJoin **Rules tweak** - JoinAddRedundantSemiJoinRule now creates LogicalJoin with JoinRelType#SEMI instead of SemiJoin - JoinToCorrelateRule deprecates SEMI instance and change the matches condition to !join.getJoinType().generatesNullsOnLeft() which also allowed ANTI compared before this patch. - SemiJoinRule matches SEMI join specifically. **Metadata tweak** - RelMdAllPredicates, RelMdExpressionLineage: Add full rowType to getAllPredicates(Join) cause semi join only outputs one side - RelMdColumnUniqueness, RelMdSelectivity, RelMdDistinctRowCount, RelMdSize, RelMdUniqueKeys: merge semi join logic to join **Test cases change** - MaterializationTest#testJoinMaterialization11 now can materialize successfully, cause i allow logical SemiJoin node to match, the original matches SemiJoin as SemiJoin.class.isAssignableFrom(), which i think is wrong cause this will only matches subClasses of SemiJoin which is only EnumerableSemiJoin before this patch. - SortRemoveRuleTest#removeSortOverEnumerableCorrelate, because CALCITE-2018, the final EnumerableSort's cost was cached by the previous EnumerableSort with logical children, so i remove the EnumerableSortRule and the best plan is correct close apache#1157 * [CALCITE-3095] Add several system properties to control enabling/disabling of rules and traits Also, add utility class RelOptRules to reorganize built-in rules from different places. Close apache#1237 * [CALCITE-3093] Remove JDBC connection calls from PlannerImpl Close apache#1241 * [CALCITE-3082] Fix NPE in SqlUtil#getSelectListItem Queries similar to `SELECT 1 UNION SELECT 2, 3` might cause Calcite validator to throw an NPE exception instead of a proper error message. When validating operands of a set operation, if operands don't have matching schema, and if one of the operand doesn't have a FROM clause, SqlUtil#getSelectListItem throws NPE. Fixing by adding a proper check. * [CALCITE-2742] Read values of USER and SYSTEM_USER variables from DataContext (Siddharth Teotia, Jacques Nadeau) Close apache#1031 (the PR used for this fix) Close apache#973 (a previous PR, superceded by 1031) * [CALCITE-3098] Upgrade SQLLine to 1.8.0 * [CALCITE-3102] Remove deprecation warnings following CALCITE-2969 * [CALCITE-2944] Deprecate Aggregate indicator and remove fields where possible * Complete [CALCITE-2969] and [CALCITE-3102] by restoring APIs that use SemiJoin but mask deprecation warnings Fix description of RelBuilder.semiJoin algebra.md. * Following [CALCITE-2944] remove internal uses of Aggregate.indicator These were generating deprecation warnings. * Cosmetic changes * [CALCITE-3106] Upgrade commons-pool2 from 2.6.0 to 2.6.2 (Fokko Driesprong) Close apache#1248 * [CALCITE-3107] Upgrade commons-dbcp2 from 2.5.0 to 2.6.0 (Fokko Driesprong) Close apache#1249 * [CALCITE-3005] Implement string functions: LEFT, RIGHT (xuqianjin) Close apache#1168 * Following [CALCITE-2812] Disable parallel execution of parameterized test to avoid hanging The patch of CALCITE-2812 introduced a parameterized test, but parameterized JUnit test hangs when running in parallel mode due to https://issues.apache.org/jira/browse/SUREFIRE-1430. We have to disable parallel execution until the issue is fixed. * [CALCITE-2804] Fix casting to timestamps in Druid Close apache#1014 * [CALCITE-2744] RelDecorrelator use wrong output map for LogicalAggregate decorrelate (godfreyhe and Danny Chan) godfreyhe started the work by apply a new map for LogicalAggregate decorrelate register, and Danny Chan add shifts for constant keys mapping. Also fix the test case name and comments. close apache#1254 * [CALCITE-3116] Upgrade to Avatica 1.15 Remove bug for CALCITE-2776 which was fixed in Avatica 1.15. Remove bug for CALCITE-2993 which is fixed in Calcite but forgotten. * [CALCITE-2721] Support parsing record-type [DOT] member-functions Close apache#1011 * [CALCITE-2968] New AntiJoin relational expression Close apache#1246 * [CALCITE-2822] Allow MultiJoin rules with any project/filter (Siddharth Teotia) Close apache#1030 * Following [CALCITE-2822] simplify test and related classes/rules I accidentally pushed CALCITE-2822 without these changes. Apologies for the multiple commits. * [CALCITE-3123] In RelBuilder, eliminate duplicate aggregate calls * Following [CALCITE-3005], remove conflict warning in SQL parser Alphabetize some lists in pom.xml. Remove call to deprecated SqlAggFunction constructor. * Following [CALCITE-2744] Remove usage of deprecated api in MockSqlOperatorTable * Fix test exception caused by slightly different error message from regex in JDK 13 * [CALCITE-3087] AggregateOnProjectToAggregateUnifyRule ignores Project incorrectly when its Mapping breaks ordering (DonnyZone) * [CALCITE-3119] Deprecate Linq4j CorrelateJoinType (in favor of JoinType) * Bump version number for 1.20.0 * Release notes for 1.20.0 * Bump version for sanity check of properties * [maven-release-plugin] prepare release calcite-1.20.0 * [maven-release-plugin] prepare for next development iteration * Add 1.20.0 release announcement * Add 1.20.0 release date * Add committer names to 1.20.0 release notes * Update example announcement After sending the latest release announcement, the secretary indicated that we should not link directly to closer.cgi, but instead to Calcite's downloads page. Changing the sample announcement will save someone else from future announcement rejection. * [CALCITE-3148] Validator throws IndexOutOfBoundsException for SqlInsert when source and sink have non-equal fields number * [CALCITE-3156] Mongo adapter. Replace fongo with Mongo Java Server for tests mongo java server is a better alternative to fongo. All tests (including IT) are passing. * [CALCITE-3157] Mongo java driver upgrade: 3.5.0 -> 3.10.2 * [CALCITE-3060] MutableProject should be generated based on INVERSE_SURJECTION mapping (DonnyZone) * [CALCITE-3149] RelDataType CACHE in RelDataTypeFactoryImpl can't be garbage collected * [CALCITE-2801] Check input type in AggregateUnionAggregateRule when remove the bottom Aggregate (Hequn Cheng) Updated code to make sure to preserve the alias of Union, and add 1 more test case for coverage by Haisheng Yuan. Closes apache#1017 * [CALCITE-3151] RexCall's Monotonicity is not considered in determining a Calc's collation * [CALCITE-3155] Empty LogicalValues can not be converted to UNION_ALL without operands which can not be unparsed(Musbah EL FIL) Empty LogicalValues would be converted to UNION_ALL Operator with no operands for rel to sql conversion, which can not be unparsed to SQL string(invalid). The fix converts the empty values to a "select NULL, NULL ... from DUAL where 1 = 0" Fix-ups(Danny Chan): * Replace empty values check with Values.isEmpty(e) * Always generate false condition as `1 = 0` close apache#1286 * [CALCITE-3146] Support the detection of nested aggregations for JdbcAggregate in SqlImplementor.(Wenhui Tang) * [CALCITE-3126] Remove deprecated SemiJoin usage completely * [CALCITE-3133] Remove completely SemiJoinType * [CALCITE-3125] Remove completely CorrelateJoinType * [CALCITE-3152] Unify throws in sql parser Replace generateParseException() and new ParseExecption to SqlUtil.newContextException, this makes the error message more user friendly. * [CALCITE-3063] Parse and process PostgreSQL posix regular expressions * [CALCITE-3168] Add test for invalid literal of sql parser This patch also merge the redundant sql statements with `SqlParserTest.Sql#sansCarets`. * [CALCITE-3121] VolcanoPlanner hangs due to subquery with dynamic star * [CALCITE-2460] [CALCITE-2459] Add TO_BASE64 / FROM_BASE64 SQL functions (Wenhui Tang) * [CALCITE-3172] RelBuilder#empty does not keep aliases * [CALCITE-3171] SemiJoin on conditions push down throws IndexOutOfBoundsException RelOptUtil#pushDownJoinConditions should only project left side above the join node when the join type only returns left side. * [CALCITE-3169] decorrelateRel method should return when meeting SEMI/ANTI join in RelDecorrelator * [CALCITE-3179] Bump Jackson from 2.9.8 to 2.9.9 (Fokko Driesprong) * [CALCITE-3170] ANTI join on conditions push down generates wrong plan Antijoin on conditions should not be pushed down to either left or right hand side. * [CALCITE-3160] Failed to materialize when the aggregate function uses group key (DonnyZone) * [CALCITE-2995] Implement DAYNAME,MONTHNAME functions; add "locale" connection property (xuqianjin) Add locale connection property (Julian Hyde). Close apache#1163 * Fix complitation warnings after mongo java driver upgrade Some methods were deprecated after client upgrade to 3.10.2 (see [CALCITE-3157]) * [CALCITE-3188] IndexOutOfBoundsException in ProjectFilterTransposeRule when executing SELECT COUNT(*) * [CALCITE-3165] Project#accept(RexShuttle shuttle) does not update rowType * [CALCITE-3189] Multiple fixes for Oracle SQL dialect Close apache#1312 * [CALCITE-3183] During field trimming, Filter is copied with wrong traitSet (Juhwan Kim) New Filter created after trimming uses its old trait set, which could cause problem if there has been any update on collation. Code changes: - Add a FilterFactory method that includes correlating variables; - Use RelBuilder when creating a new Filter in trimmer; - Add test cases for the bug and new RelBuilder method. Close apache#1309 * [CALCITE-3144] Add rule, AggregateCaseToFilterRule, that converts "SUM(CASE WHEN b THEN x END)" to "SUM(x) FILTER (WHERE b)" Copied from Apache Druid's CaseFilteredAggregatorRule. Some aggregate functions (e.g. SINGLE_VALUE, GROUPING, GROUP_ID) do not allow filter, so we skip them in the rule. * [CALCITE-3196] In Frameworks, add interface BasePrepareAction (a functional interface) and deprecate abstract class PrepareAction * Change type of SqlStdOperatorTable.GROUPING field to public class * [CALCITE-3145] RelBuilder.aggregate throws IndexOutOfBoundsException if groupKey is non-empty and there are duplicate aggregate functions The cause is that [CALCITE-3123] did not handle the case of non-empty groupKey. Enable RelBuilder.Config.dedupAggregateCalls by default. * [CALCITE-3166] Make RelBuilder configurable Add immutable class RelBuilder.Config, and a builder for it. Disable elimination of duplicate aggregate calls (added in [CALCITE-3123]), until [CALCITE-3145] is fixed. * CALCITE-3187: Make decimal type inference overridable (Praveen Kumar) Decimal return type inference for addition and modulus is hardcoded. Add new methods to RelDataTypeSystem to allow implementers to override behavior if needed. Deprecate existing methods for multiply and divide in RelDataTypeFactory and move them over to RelDataTypeSystem for consistency. Close apache#1311 * Fix javadoc error Fix a javadoc error in RelDataTypeFactory caused by a invalid signature and introduced by the previous patch * Merge branch 'master' of https://github.com/apache/calcite into Dm-calcite-Netezza # Conflicts: # core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java # core/src/main/java/org/apache/calcite/sql/SqlDialect.java # core/src/main/java/org/apache/calcite/sql/SqlKind.java # core/src/main/java/org/apache/calcite/sql/dialect/SparkSqlDialect.java # core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java * Dm-calcite-Netezza : calcite conformance changes * Changes in relToSqlConverter
This fixes: https://issues.apache.org/jira/browse/CALCITE-2721