amaliujia commented on a change in pull request #12073: URL: https://github.com/apache/beam/pull/12073#discussion_r445150359
########## File path: sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamMatchRelTest.java ########## @@ -0,0 +1,50 @@ +package org.apache.beam.sdk.extensions.sql.impl.rel; + +import org.apache.beam.sdk.extensions.sql.SqlTransform; +import org.apache.beam.sdk.testing.TestPipeline; +import org.apache.beam.sdk.transforms.Create; +import org.apache.beam.sdk.values.PCollection; +import org.apache.beam.sdk.values.Row; +import org.junit.Test; +import org.apache.beam.sdk.schemas.Schema; + +public class BeamMatchRelTest { + + public static final TestPipeline pipeline = TestPipeline.create(); + + @Test + public void MatchLogicalPlanTest() { + Schema schemaType = Schema.builder() + .addInt32Field("id") + .addStringField("name") + .addInt32Field("proctime") + .build(); + + PCollection<Row> input = + pipeline.apply( + Create.of( + Row.withSchema(schemaType).addValue(1).addValue("a").addValue(1).build()) + .withRowSchema(schemaType)); + + String sql = "SELECT T.aid, T.bid, T.cid " + + "FROM PCOLLECTION " + + "MATCH_RECOGNIZE (" + + "PARTITION BY id " + + "ORDER BY proctime " + + "MEASURES " + + "A.id AS aid, " + + "B.id AS bid, " + + "C.id AS cid " + + "PATTERN (A B C) " + + "DEFINE " + + "A AS name = 'a', " + + "B AS name = 'b', " + + "C AS name = 'c' " + + ") AS T"; + + PCollection<Row> result = input.apply(SqlTransform.query(sql)); Review comment: I see. Yes I think this test is valid. It tests if the query can be compile, which includes the BeamMatchRel. ---------------------------------------------------------------- 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