You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by beyond1920 <gi...@git.apache.org> on 2017/03/17 09:54:28 UTC

[GitHub] flink pull request #3559: [flink-6037] [Table API & SQL]hotfix: metadata pro...

GitHub user beyond1920 opened a pull request:

    https://github.com/apache/flink/pull/3559

    [flink-6037] [Table API & SQL]hotfix: metadata provider didn't work in SQL

    This pr aims to fix a bug referenced by https://issues.apache.org/jira/browse/FLINK-6037.
    After using the right MetadataProvider, org.apache.flink.table.ExpressionReductionTest.testReduceCalcExpressionForBatchSQL test cannot pass because the optimized plan is changed (The problem is referenced by https://issues.apache.org/jira/browse/FLINK-6067 which would be fixed in another pr). I simply changed test sql to make it pass in this pr.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/alibaba/flink hotfix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/3559.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3559
    
----
commit bd83041507b3f4fdea737b538fb39af4a249e6d2
Author: jingzhang <be...@126.com>
Date:   2017-03-17T09:47:35Z

    fix the bug: metadata provider didn't work in SQL

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink issue #3559: [flink-6037] [Table API & SQL]hotfix: metadata provider d...

Posted by beyond1920 <gi...@git.apache.org>.
Github user beyond1920 commented on the issue:

    https://github.com/apache/flink/pull/3559
  
    @KurtYoung , thanks for the review. I've updated the pr based on your comments. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3559: [flink-6037] [Table API & SQL]hotfix: metadata pro...

Posted by KurtYoung <gi...@git.apache.org>.
Github user KurtYoung commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3559#discussion_r106796945
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala ---
    @@ -100,6 +101,7 @@ class FlinkPlannerImpl(
           assert(validatedSqlNode != null)
           val rexBuilder: RexBuilder = createRexBuilder
           val cluster: RelOptCluster = RelOptCluster.create(planner, rexBuilder)
    +      cluster.setMetadataProvider(FlinkDefaultRelMetadataProvider.INSTANCE)
    --- End diff --
    
    I remembered that in #3058 you also set the provider to `RelMetadataQuery.THREAD_PROVIDERS` by calling:
    ```
    RelMetadataQuery.THREAD_PROVIDERS.set(JaninoRelMetadataProvider.of(cluster.getMetadataProvider))
    ```
    Why it's not needed here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request #3559: [flink-6037] [Table API & SQL]hotfix: metadata pro...

Posted by beyond1920 <gi...@git.apache.org>.
Github user beyond1920 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3559#discussion_r106797445
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/calcite/FlinkPlannerImpl.scala ---
    @@ -100,6 +101,7 @@ class FlinkPlannerImpl(
           assert(validatedSqlNode != null)
           val rexBuilder: RexBuilder = createRexBuilder
           val cluster: RelOptCluster = RelOptCluster.create(planner, rexBuilder)
    +      cluster.setMetadataProvider(FlinkDefaultRelMetadataProvider.INSTANCE)
    --- End diff --
    
    Because this logic is called in org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery, which like
    `RelMetadataQuery.THREAD_PROVIDERS.set(
            JaninoRelMetadataProvider.of(cluster.getMetadataProvider()));`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---