File tree Expand file tree Collapse file tree
file/file-source/src/main/java/com/dtstack/flink/sql/source/file Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919package com .dtstack .flink .sql .source .file ;
2020
21+ import com .dtstack .flink .sql .source .file .throwable .LengthMismatchException ;
2122import org .apache .flink .annotation .PublicEvolving ;
2223import org .apache .flink .api .common .serialization .DeserializationSchema ;
2324import org .apache .flink .api .common .typeinfo .BasicArrayTypeInfo ;
@@ -371,8 +372,9 @@ private static RuntimeConverter createByteArrayRuntimeConverter() {
371372
372373 private static void validateArity (int expected , int actual ) {
373374 if (expected != actual ) {
374- LOG .warn ("Row length mismatch. " + expected +
375- " fields expected but was " + actual + "." );
375+ throw new LengthMismatchException (
376+ "Row length mismatch. " + expected +
377+ " fields expected but was " + actual + "." );
376378 }
377379 }
378380}
Original file line number Diff line number Diff line change 1818
1919package com .dtstack .flink .sql .source .file ;
2020
21+ import com .dtstack .flink .sql .exception .ExceptionTrace ;
2122import com .dtstack .flink .sql .metric .MetricConstant ;
2223import com .dtstack .flink .sql .source .IStreamSourceGener ;
2324import com .dtstack .flink .sql .source .file .table .FileSourceTableInfo ;
@@ -224,7 +225,7 @@ public void run(SourceContext<Row> ctx) throws Exception {
224225 } catch (IOException e ) {
225226 if (errorCounter .getCount () % 1000 == 0 ) {
226227 LOG .error ("Deserialize error! Record: " + line );
227- LOG .error ("Cause: " , e );
228+ LOG .error ("Cause: " + ExceptionTrace . traceOriginalCause ( e ) );
228229 }
229230 errorCounter .inc ();
230231 }
Original file line number Diff line number Diff line change 1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one
3+ * or more contributor license agreements. See the NOTICE file
4+ * distributed with this work for additional information
5+ * regarding copyright ownership. The ASF licenses this file
6+ * to you under the Apache License, Version 2.0 (the
7+ * "License"); you may not use this file except in compliance
8+ * with the License. You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing, software
13+ * distributed under the License is distributed on an "AS IS" BASIS,
14+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ * See the License for the specific language governing permissions and
16+ * limitations under the License.
17+ */
18+
19+ package com .dtstack .flink .sql .source .file .throwable ;
20+
21+ import org .apache .flink .util .FlinkRuntimeException ;
22+
23+ /**
24+ * @author tiezhu
25+ * @since 2021/5/6 3:39 下午
26+ */
27+
28+ public class LengthMismatchException extends FlinkRuntimeException {
29+ public LengthMismatchException (String message ) {
30+ super (message );
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments