[ https://issues.apache.org/jira/browse/BEAM-8603?focusedWorklogId=410817&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-410817 ]
ASF GitHub Bot logged work on BEAM-8603: ---------------------------------------- Author: ASF GitHub Bot Created on: 27/Mar/20 03:30 Start Date: 27/Mar/20 03:30 Worklog Time Spent: 10m Work Description: ihji commented on pull request #10055: [BEAM-8603] Add Python SqlTransform URL: https://github.com/apache/beam/pull/10055#discussion_r399015980 ########## File path: sdks/python/apache_beam/transforms/sql_test.py ########## @@ -0,0 +1,109 @@ +# +# 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. +# + +"""Tests for transforms that use the SQL Expansion service.""" + +# pytype: skip-file + +from __future__ import absolute_import + +import logging +import typing +import unittest + +from nose.plugins.attrib import attr +from past.builtins import unicode + +import apache_beam as beam +from apache_beam import coders +from apache_beam.options.pipeline_options import DebugOptions +from apache_beam.options.pipeline_options import StandardOptions +from apache_beam.testing.test_pipeline import TestPipeline +from apache_beam.testing.util import assert_that +from apache_beam.testing.util import equal_to +from apache_beam.transforms.sql import SqlTransform +from apache_beam.utils import subprocess_server + +SimpleRow = typing.NamedTuple( + "SimpleRow", [("int", int), ("str", unicode), ("flt", float)]) +coders.registry.register_coder(SimpleRow, coders.RowCoder) + + +@attr('UsesSqlExpansionService') +@unittest.skipIf( + TestPipeline().get_pipeline_options().view_as(StandardOptions).runner is + None, + "Must be run with a runner that supports cross-language transforms") +class SqlTransformTest(unittest.TestCase): + """Tests that exercise the cross-language SqlTransform (implemented in java). + + Note this test must be executed with pipeline options that run jobs on a local + job server. The easiest way to accomplish this is to run the + `validatesCrossLanguageRunnerPythonUsingSql` gradle target for a particular + job server, which will start the runner and job server for you. For example, + `:runners:flink:1.10:job-server:validatesCrossLanguageRunnerPythonUsingSql` to + test on Flink 1.10. + + Alternatively, you may be able to iterate faster if you run the tests directly + using a runner like `FlinkRunner`, which starts its own job server, but you'll + need to spin up a local flink cluster: + $ pip install -e './sdks/python[gcp,test]' + $ python ./sdks/python/setup.py nosetests \\ + --tests apache_beam.transforms.sql_test \\ + --test-pipeline-options="--runner=FlinkRunner \\ + --flink_version=1.10 \\ + --flink_master=localhost:8081" + """ + @staticmethod + def make_test_pipeline(): + path_to_jar = subprocess_server.JavaJarServer.path_to_beam_jar( + ":sdks:java:extensions:sql:expansion-service:shadowJar") + test_pipeline = TestPipeline() + test_pipeline.get_pipeline_options().view_as(DebugOptions).experiments = [ + 'jar_packages=' + path_to_jar Review comment: We can remove `jar_packages` flag when BEAM-9238 is done. ---------------------------------------------------------------- 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: 410817) Time Spent: 5h 10m (was: 5h) > Add Python SqlTransform MVP > --------------------------- > > Key: BEAM-8603 > URL: https://issues.apache.org/jira/browse/BEAM-8603 > Project: Beam > Issue Type: Improvement > Components: dsl-sql, sdk-py-core > Reporter: Brian Hulette > Assignee: Brian Hulette > Priority: Major > Time Spent: 5h 10m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.3.4#803005)