Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/426#discussion_r26205234
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/io/CsvInputFormat.java ---
@@ -152,6 +177,38 @@ public void setFields(boolean[] sourceFieldMask,
Class<?>[] fieldTypes) {
public Class<?>[] getFieldTypes() {
return super.getGenericFieldTypes();
}
+
+ public void setFieldsMap(String[] fieldsMap) {
+ Preconditions.checkNotNull(fieldsMap);
+ Preconditions.checkState(typeInformation instanceof
PojoTypeInfo);
+
+ PojoTypeInfo<OUT> pojoTypeInfo = (PojoTypeInfo<OUT>)
typeInformation;
+
+ String[] fields = pojoTypeInfo.getFieldNames();
+ Class<?>[] fieldTypes = getFieldTypes();
+ this.fieldsMap = Arrays.copyOfRange(fieldsMap, 0,
fieldsMap.length);
+
+ boolean[] includeMask = new boolean[fieldsMap.length];
--- End diff --
The ``includeMask`` refers to the fields in the CsvFile and allows to skip
fields of the file.
For example if a line in your file looks like:
``Sam,Smith,09-15-1963,123.123``and you only want to read the first name
and the date field, you would set the ``includeMask`` to ``[true, false,
true]`` (missing fields are treated as ``false``).
So the ``includeMask`` should not depend on the ``fieldsMap``, but the
number of ``true`` entries in the ``includeMask`` must be equal to the number
for fields in the ``fieldsMap``.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---