[ 
https://issues.apache.org/jira/browse/BEAM-7513?focusedWorklogId=260640&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-260640
 ]

ASF GitHub Bot logged work on BEAM-7513:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Jun/19 18:41
            Start Date: 14/Jun/19 18:41
    Worklog Time Spent: 10m 
      Work Description: akedin commented on pull request #8822: [BEAM-7513] 
Adding Row Count for Bigquery Table
URL: https://github.com/apache/beam/pull/8822#discussion_r293930230
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BigQueryTestTableProvider.java
 ##########
 @@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.extensions.sql.meta.provider.bigquery;
+
+import static 
org.apache.beam.vendor.guava.v20_0.com.google.common.base.MoreObjects.firstNonNull;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Nullable;
+import org.apache.beam.sdk.extensions.sql.BeamSqlTable;
+import org.apache.beam.sdk.extensions.sql.meta.Table;
+import org.apache.beam.sdk.io.gcp.bigquery.BigQueryUtils;
+
+/** A test table provider for BigQueryRowCountIT. */
+public class BigQueryTestTableProvider extends BigQueryTableProvider {
+
+  private Map<String, Table> tableSpecMap;
+  private Map<String, BeamSqlTable> beamSqlTableMap;
+
+  BigQueryTestTableProvider() {
+    super();
+    tableSpecMap = new HashMap<>();
+    beamSqlTableMap = new HashMap<>();
+  }
+
+  void addTable(String name, Table table) {
+    tableSpecMap.put(name, table);
+  }
+
+  @Nullable
+  @Override
+  public Table getTable(String tableName) {
+    return tableSpecMap.get(tableName);
+  }
+
+  @Override
+  public BeamSqlTable buildBeamSqlTable(Table table) {
+    BeamSqlTable t = beamSqlTableMap.get(table.getLocation());
+    if (t == null) {
 
 Review comment:
   I think that guard-statement style here would look better, i.e. `if (t != 
null) { return t; } ` and no `else`. Reduces the nesting and makes easier to 
find matching braces.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 260640)
    Time Spent: 1h 50m  (was: 1h 40m)

> Row Estimation for BigQueryTable
> --------------------------------
>
>                 Key: BEAM-7513
>                 URL: https://issues.apache.org/jira/browse/BEAM-7513
>             Project: Beam
>          Issue Type: New Feature
>          Components: dsl-sql, io-java-gcp
>            Reporter: Alireza Samadianzakaria
>            Assignee: Alireza Samadianzakaria
>            Priority: Major
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Calcite tables (org.apache.calcite.schema.Table) should implement the method 
> org.apache.calcite.schema.Statistic getStatistic(). The Statistic instance 
> returned by this method is used for the Volcano optimizer in Calcite. 
> Currently, org.apache.beam.sdk.extensions.sql.impl.BeamCalciteTable has not 
> implemented getStatistic() which means it uses the implementation in 
> org.apache.calcite.schema.impl.AbstractTable and that implementation just 
> returns Statistics.UNKNOWN for all sources.
>  
> Things needed to be implemented:
> 1- Implementing getStatistic in BeamCalciteTable such that it calls a row 
> count estimation method from BeamSqlTable and adding this method to 
> BeamSqlTable.
> 2- Implementing the row count estimation method for BigQueryTable. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to