[
https://issues.apache.org/jira/browse/BEAM-10124?focusedWorklogId=474925&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-474925
]
ASF GitHub Bot logged work on BEAM-10124:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 26/Aug/20 17:45
Start Date: 26/Aug/20 17:45
Worklog Time Spent: 10m
Work Description: lukecwik commented on a change in pull request #12645:
URL: https://github.com/apache/beam/pull/12645#discussion_r477478222
##########
File path:
sdks/java/io/contextual-text-io/src/main/java/org/apache/beam/sdk/io/contextualtextio/RecordWithMetadata.java
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.io.contextualtextio;
+
+import com.google.auto.value.AutoValue;
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.schemas.AutoValueSchema;
+import org.apache.beam.sdk.schemas.annotations.DefaultSchema;
+
+/**
+ * Helper Class based on {@link AutoValueSchema}, it provides Metadata
associated with each Record
+ * when reading from file(s) using {@link ContextualTextIO}.
+ *
+ * <h3>Fields:</h3>
+ *
+ * <ul>
+ * <li>recordOffset: The offset of a record (the byte at which the record
begins) in a file. This
+ * information can be useful if you wish to reconstruct the file. {@link
+ * RecordWithMetadata#getRecordOffset()}
+ * <li>recordNum: The ordinal number of the record in its file. {@link
+ * RecordWithMetadata#getRecordNum()}
+ * <li>recordValue: The value / contents of the record {@link
RecordWithMetadata#getRecordValue()}
+ * <li>rangeOffset: The starting offset of the range (split), which
contained the record, when the
+ * record was read. {@link RecordWithMetadata#getRangeOffset()}
+ * <li>recordNumInOffset: The record number relative to the Range. (line
number within the range)
+ * {@link RecordWithMetadata#getRecordNumInOffset()}
+ * <li>fileName: Name of the file to which the record belongs (this is the
full filename,
+ * eg:path/to/file.txt) {@link RecordWithMetadata#getFileName()}
+ * </ul>
+ */
+@Experimental(Experimental.Kind.SCHEMAS)
+@DefaultSchema(AutoValueSchema.class)
+@AutoValue
+public abstract class RecordWithMetadata {
Review comment:
Missed the '`', so the `<T>` was lost.
##########
File path:
sdks/java/io/contextual-text-io/src/main/java/org/apache/beam/sdk/io/contextualtextio/RecordWithMetadata.java
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.io.contextualtextio;
+
+import com.google.auto.value.AutoValue;
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.schemas.AutoValueSchema;
+import org.apache.beam.sdk.schemas.annotations.DefaultSchema;
+
+/**
+ * Helper Class based on {@link AutoValueSchema}, it provides Metadata
associated with each Record
+ * when reading from file(s) using {@link ContextualTextIO}.
+ *
+ * <h3>Fields:</h3>
+ *
+ * <ul>
+ * <li>recordOffset: The offset of a record (the byte at which the record
begins) in a file. This
+ * information can be useful if you wish to reconstruct the file. {@link
+ * RecordWithMetadata#getRecordOffset()}
+ * <li>recordNum: The ordinal number of the record in its file. {@link
+ * RecordWithMetadata#getRecordNum()}
+ * <li>recordValue: The value / contents of the record {@link
RecordWithMetadata#getRecordValue()}
+ * <li>rangeOffset: The starting offset of the range (split), which
contained the record, when the
+ * record was read. {@link RecordWithMetadata#getRangeOffset()}
+ * <li>recordNumInOffset: The record number relative to the Range. (line
number within the range)
+ * {@link RecordWithMetadata#getRecordNumInOffset()}
+ * <li>fileName: Name of the file to which the record belongs (this is the
full filename,
+ * eg:path/to/file.txt) {@link RecordWithMetadata#getFileName()}
+ * </ul>
+ */
+@Experimental(Experimental.Kind.SCHEMAS)
+@DefaultSchema(AutoValueSchema.class)
+@AutoValue
+public abstract class RecordWithMetadata {
Review comment:
Missed the '\`', so the `<T>` was lost.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 474925)
Remaining Estimate: 1,333h 50m (was: 1,334h)
Time Spent: 10h 10m (was: 10h)
> ContextualTextIO - An IO that is provides metadata about the line.
> -------------------------------------------------------------------
>
> Key: BEAM-10124
> URL: https://issues.apache.org/jira/browse/BEAM-10124
> Project: Beam
> Issue Type: New Feature
> Components: io-ideas
> Reporter: Reza ardeshir rokni
> Priority: P2
> Original Estimate: 1,344h
> Time Spent: 10h 10m
> Remaining Estimate: 1,333h 50m
>
> There are two important Source IO's that allow for dealing with text files
> FileIO and TextIO. When the requirements go beyond the scope of TextIO we ask
> the end user to make use of FileIO and go it on their own.
> We want to correct this experience by creating a more feature rich TextIO
> which can return along with each line of data contextual information about
> the line. For example the file that it came from, and the ordinal position of
> the line within the file.
> Another area that we would like to deal with is more formal support for CSV
> files by allowing compliance to RFC4180 files. Specifically the RFC allows
> for line breaks (CRLF) to be used within fields within double quotes.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)