zhoulii commented on a change in pull request #19152:
URL: https://github.com/apache/flink/pull/19152#discussion_r830847334
##########
File path:
flink-end-to-end-tests/flink-tpcds-test/src/main/java/org/apache/flink/table/tpcds/TpcdsTestProgram.java
##########
@@ -157,34 +166,33 @@ private static TableEnvironment prepareTableEnv(String
sourceTablePath, Boolean
TPCDS_TABLES.forEach(
table -> {
TpcdsSchema schema =
TpcdsSchemaProvider.getTableSchema(table);
- CsvTableSource.Builder builder = CsvTableSource.builder();
- builder.path(sourceTablePath + FILE_SEPARATOR + table +
DATA_SUFFIX);
- for (int i = 0; i < schema.getFieldNames().size(); i++) {
- builder.field(
- schema.getFieldNames().get(i),
- TypeConversions.fromDataTypeToLegacyInfo(
- schema.getFieldTypes().get(i)));
- }
- builder.fieldDelimiter(COL_DELIMITER);
- builder.emptyColumnAsNull();
- builder.lineDelimiter("\n");
- CsvTableSource tableSource = builder.build();
- ConnectorCatalogTable catalogTable =
- ConnectorCatalogTable.source(tableSource, true);
- tEnv.getCatalog(tEnv.getCurrentCatalog())
- .ifPresent(
- catalog -> {
- try {
- catalog.createTable(
- new ObjectPath(
-
tEnv.getCurrentDatabase(), table),
- catalogTable,
- false);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- });
+ String filePath = sourceTablePath + FILE_SEPARATOR + table
+ DATA_SUFFIX;
+
+ tEnv.createTable(
+ table,
+ TableDescriptor.forConnector(FILE_CONNECTOR_NAME)
+ .schema(
+ Schema.newBuilder()
+ .fromFields(
+
schema.getFieldNames(),
+
schema.getFieldTypes())
+ .build())
+ .format(
+
FormatDescriptor.forFormat(CSV_FORMAT)
+ .option(
+
CsvFormatOptions.FIELD_DELIMITER,
+ COL_DELIMITER)
+ .option(
+
CsvFormatOptions.IGNORE_PARSE_ERRORS,
Review comment:
you are right, **_CsvFormatOptions.IGNORE_PARSE_ERRORS_** is not needed.
I run tpcds without this config, the job still works well.
--
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]