[ https://issues.apache.org/jira/browse/BEAM-8844?focusedWorklogId=366093&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-366093 ]
ASF GitHub Bot logged work on BEAM-8844: ---------------------------------------- Author: ASF GitHub Bot Created on: 03/Jan/20 23:24 Start Date: 03/Jan/20 23:24 Worklog Time Spent: 10m Work Description: 11moon11 commented on pull request #10226: [BEAM-8844] Add a new Jenkins job for SQL perf tests URL: https://github.com/apache/beam/pull/10226#discussion_r362992924 ########## File path: sdks/java/extensions/sql/perf-tests/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BigQueryIOPushDownIT.java ########## @@ -0,0 +1,198 @@ +/* + * 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.sdk.extensions.sql.impl.planner.BeamRuleSets.getRuleSets; + +import com.google.cloud.Timestamp; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.function.Function; +import org.apache.beam.sdk.Pipeline; +import org.apache.beam.sdk.PipelineResult; +import org.apache.beam.sdk.extensions.sql.impl.BeamSqlEnv; +import org.apache.beam.sdk.extensions.sql.impl.rel.BeamRelNode; +import org.apache.beam.sdk.extensions.sql.impl.rel.BeamSqlRelUtils; +import org.apache.beam.sdk.extensions.sql.impl.rule.BeamIOPushDownRule; +import org.apache.beam.sdk.extensions.sql.meta.store.InMemoryMetaStore; +import org.apache.beam.sdk.io.common.IOITHelper; +import org.apache.beam.sdk.io.common.IOTestPipelineOptions; +import org.apache.beam.sdk.options.Description; +import org.apache.beam.sdk.options.PipelineOptionsFactory; +import org.apache.beam.sdk.testutils.NamedTestResult; +import org.apache.beam.sdk.testutils.metrics.IOITMetrics; +import org.apache.beam.sdk.testutils.metrics.MetricsReader; +import org.apache.beam.sdk.testutils.metrics.TimeMonitor; +import org.apache.beam.sdk.transforms.ParDo; +import org.apache.beam.sdk.values.PCollection; +import org.apache.beam.sdk.values.Row; +import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.plan.RelOptRule; +import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.tools.RuleSet; +import org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.tools.RuleSets; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class BigQueryIOPushDownIT { + private static final String READ_FROM_TABLE = "bigquery-public-data:hacker_news.full"; + private static final String NAMESPACE = BigQueryIOPushDownIT.class.getName(); + private static final String CREATE_TABLE_STATEMENT = + "CREATE EXTERNAL TABLE HACKER_NEWS( \n" + + " title VARCHAR, \n" + + " url VARCHAR, \n" + + " text VARCHAR, \n" + + " dead BOOLEAN, \n" + + " `by` VARCHAR, \n" + + " score INTEGER, \n" + + " `time` INTEGER, \n" + + " `timestamp` TIMESTAMP, \n" + + " type VARCHAR, \n" + + " id INTEGER, \n" + + " parent INTEGER, \n" + + " descendants INTEGER, \n" + + " ranking INTEGER, \n" + + " deleted BOOLEAN \n" + + ") \n" + + "TYPE 'bigquery' \n" + + "LOCATION '" + + READ_FROM_TABLE + + "' \n" + + "TBLPROPERTIES '{ method: \"%s\" }'"; + private static final String SELECT_STATEMENT = + "SELECT `by` as author, type, title, score from HACKER_NEWS where (type='story' or type='job') and score>2"; + + private static SQLBigQueryPerfTestOptions options; + private static String metricsBigQueryDataset; + private static String metricsBigQueryTable; + private Pipeline pipeline = Pipeline.create(options); + private BeamSqlEnv sqlEnv; + + @BeforeClass + public static void setUp() { + options = IOITHelper.readIOTestPipelineOptions(SQLBigQueryPerfTestOptions.class); + metricsBigQueryDataset = options.getMetricsBigQueryDataset(); + metricsBigQueryTable = options.getMetricsBigQueryTable(); + } + + @Before + public void before() { + sqlEnv = BeamSqlEnv.inMemory(new BigQueryPerfTableProvider(NAMESPACE, "fields_read")); + } + + @Test + public void readUsingDirectReadMethodPushDown() { + sqlEnv.executeDdl(String.format(CREATE_TABLE_STATEMENT, "DIRECT_READ")); Review comment: Ended up pooling `String` value for `DIRECT_READ` and `DEFAULT` from `enum Method` in `BigQueryIO`. ---------------------------------------------------------------- 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: 366093) Time Spent: 7h 40m (was: 7.5h) > [SQL] Create performance tests for BigQueryTable > ------------------------------------------------ > > Key: BEAM-8844 > URL: https://issues.apache.org/jira/browse/BEAM-8844 > Project: Beam > Issue Type: New Feature > Components: dsl-sql > Reporter: Kirill Kozlov > Assignee: Kirill Kozlov > Priority: Major > Time Spent: 7h 40m > Remaining Estimate: 0h > > They should measure read-time for: > * DIRECT_READ w/o push-down > * DIRECT_READ w/ push-down > * DEFAULT -- This message was sent by Atlassian Jira (v8.3.4#803005)