You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/08/18 17:05:27 UTC

[GitHub] [beam] aromanenko-dev commented on a change in pull request #15325: [BEAM-12270] Add Parquet source support for TPD-DS benchmark

aromanenko-dev commented on a change in pull request #15325:
URL: https://github.com/apache/beam/pull/15325#discussion_r691423208



##########
File path: sdks/java/testing/tpcds/src/main/java/org/apache/beam/sdk/tpcds/TpcdsUtils.java
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.tpcds;
+
+/** Odd's 'n Ends used throughout queries and driver. */

Review comment:
       It's just a synonym of miscellaneous articles 

##########
File path: sdks/java/testing/tpcds/src/main/java/org/apache/beam/sdk/tpcds/SqlTransformRunner.java
##########
@@ -87,27 +90,77 @@ private static PCollectionTuple getTables(
 
       // Only when queryString contains tableName, the table is relevant to this query and will be
       // added. This can avoid reading unnecessary data files.
+      // TODO: Simple but not reliable way since table name can be any substring in a query and can
+      // give false positives
       if (queryString.contains(tableName)) {
-        // This is location path where the data are stored
-        String filePattern =
-            tpcdsOptions.getDataDirectory() + "/" + dataSize + "/" + tableName + ".dat";
-
-        PCollection<Row> table =
-            new TextTable(
-                    tableSchema.getValue(),
-                    filePattern,
-                    new CsvToRow(tableSchema.getValue(), csvFormat),
-                    new RowToCsv(csvFormat))
-                .buildIOReader(pipeline.begin())
-                .setCoder(SchemaCoder.of(tableSchema.getValue()))
-                .setName(tableSchema.getKey());
-
-        tables = tables.and(new TupleTag<>(tableName), table);
+        switch (tpcdsOptions.getSourceType()) {
+          case CSV:
+            {
+              PCollection<Row> table =
+                  getTableCSV(pipeline, csvFormat, tpcdsOptions, dataSize, tableSchema, tableName);
+              tables = tables.and(new TupleTag<>(tableName), table);
+              break;
+            }
+          case PARQUET:
+            {
+              PCollection<GenericRecord> table =
+                  getTableParquet(pipeline, tpcdsOptions, dataSize, tableName);
+              tables = tables.and(new TupleTag<>(tableName), table);
+              break;
+            }
+          default:
+            throw new IllegalStateException(
+                "Unexpected source type: " + tpcdsOptions.getSourceType());
+        }
       }
     }
     return tables;
   }
 
+  private static PCollection<GenericRecord> getTableParquet(

Review comment:
       Yes, it will be adjusted in the future.




-- 
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.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org