LadyForest commented on code in PR #184:
URL: https://github.com/apache/flink-table-store/pull/184#discussion_r911775422


##########
flink-table-store-connector/src/main/1.14.5/org/apache/flink/table/store/connector/TableStoreDataStreamScanProvider.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.flink.table.store.connector;
+
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.table.connector.source.DataStreamScanProvider;
+import org.apache.flink.table.data.RowData;
+
+import java.util.function.Function;
+
+/** Table Store {@link DataStreamScanProvider}. */
+public class TableStoreDataStreamScanProvider implements 
DataStreamScanProvider {
+
+    private final boolean isBounded;
+    private final Function<StreamExecutionEnvironment, DataStream<RowData>> 
produce;

Review Comment:
   Nit: how about renaming to `producer`?



##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/predicate/PredicateConverter.java:
##########
@@ -117,7 +118,7 @@ public Predicate visit(CallExpression call) {
                     allowQuick = true;
                 } else if (escape != null) {
                     if (escape.length() != 1) {
-                        throw SqlLikeUtils.invalidEscapeCharacter(escape);
+                        throw new RuntimeException("Invalid escape character 
'" + escape + "'");

Review Comment:
   How about extracting a util method?



##########
pom.xml:
##########
@@ -272,6 +282,23 @@ under the License.
                 </plugins>
             </build>
         </profile>
+
+        <!-- Activate these profiles with -Pspark-x.x to build and test 
against different Spark versions -->

Review Comment:
   🤔
   ```suggestion
           <!-- Activate these profiles with -Pflink-x.x to build and test 
against different Flink versions -->
   ```



##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/utils/RowDataPartitionComputer.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.flink.table.store.file.utils;
+
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/** PartitionComputer for {@link RowData}. */
+public class RowDataPartitionComputer {
+
+    protected final String defaultPartValue;
+    protected final String[] partitionColumns;
+    protected final RowData.FieldGetter[] partitionFieldGetters;
+
+    public RowDataPartitionComputer(
+            String defaultPartValue, RowType rowType, String[] 
partitionColumns) {
+        this.defaultPartValue = defaultPartValue;
+        this.partitionColumns = partitionColumns;
+        List<String> columnList = rowType.getFieldNames();
+        this.partitionFieldGetters =
+                Arrays.stream(partitionColumns)
+                        .mapToInt(columnList::indexOf)
+                        .mapToObj(i -> 
RowData.createFieldGetter(rowType.getTypeAt(i), i))
+                        .toArray(RowData.FieldGetter[]::new);
+    }
+
+    public LinkedHashMap<String, String> generatePartValues(RowData in) {
+        LinkedHashMap<String, String> partSpec = new LinkedHashMap<>();
+
+        for (int i = 0; i < partitionFieldGetters.length; i++) {
+            Object field = partitionFieldGetters[i].getFieldOrNull(in);
+            String partitionValue = field != null ? field.toString() : null;
+            if (partitionValue == null || "".equals(partitionValue)) {

Review Comment:
   Nit: `"".equals(partitionValue)` will also perform null check, so 
`"".equals(partitionValue)` is enough.



##########
.github/workflows/build-flink-1.14.yml:
##########
@@ -0,0 +1,18 @@
+name: Build Flink 1.14
+
+on: [push, pull_request]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+      - name: Set up JDK 1.8
+        uses: actions/setup-java@v1
+        with:
+          java-version: 1.8
+      - name: Build
+        run: |
+          mvn clean install -Dmaven.test.skip=true -Pflink-1.14

Review Comment:
   skip tests?



##########
flink-table-store-format/src/main/java/org/apache/flink/table/store/format/orc/OrcInputFormatFactory.java:
##########
@@ -0,0 +1,105 @@
+/*
+ * 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.flink.table.store.format.orc;
+
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.connector.file.src.FileSourceSplit;
+import org.apache.flink.connector.file.src.reader.BulkFormat;
+import org.apache.flink.orc.OrcFilters;
+import org.apache.flink.orc.shim.OrcShim;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.store.utils.ReflectionUtils;
+import org.apache.flink.table.types.logical.RowType;
+
+import org.apache.hadoop.conf.Configuration;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Function;
+
+/** Factory to create orc input format. */

Review Comment:
   ```suggestion
   /** Factory to create orc input format for different Flink versions. */
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to