When using unbounded PCollection from TextIO to BigQuery, data is stuck in Reshuffle/GroupByKey inside of...












2














I'm using TextIO for reading from Cloud Storage. As I want to have the job running continously, I use watchForNewFiles.



For completeness, the data I read is working fine if I use bounded PCollections (no watchForNewFiles and BigQueryIO in batch mode), so there is no data issue.



I have p.run().waitUntilFinish(); in my code, so the pipeline runs. And it does not give any error.



Apache beam version is 2.8.0



PCollection<String> stream =
p.apply("Read File", TextIO
.read()
.from(options.getInput())
.watchForNewFiles(
Duration.standardMinutes(1),
Watch.Growth.afterTimeSinceNewOutput(Duration.standardHours(1))
)
.withCompression(Compression.AUTO));


This works perfectly fine and reads files as soon as they are available. the PCollection is unbounded and contains lines of text from these files.



After doing some transformations



PCollection<List<String>> lines = stream.apply("Parse CSV",
ParDo.of(new ParseCSV())
);

PCollection<TableRow> rows = lines.apply("Convert to BQ",
ParDo.of(new BigQueryConverter(schema))
);


The ParseCSV step adds timestamps to its receiver via outputWithTimestamp.



I end up with a PCollection of TableRows ready to stream to BigQuery.
For that, I use



WriteResult result = rows.apply("WriteToBigQuery",
BigQueryIO.
<TableRow>write()
.withFormatFunction(input -> input)
.withSchema(bqSchema)
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND)
.withFailedInsertRetryPolicy(InsertRetryPolicy.retryTransientErrors())
.withExtendedErrorInfo()
.to(options.getOutput())

);


This never writes data to BigQuery. If I take a look into the UI, I see that BigQueryIO does




  • ShardTableWrites

  • TagWithUniqueId

  • Reshuffle


    • Window.into

    • GroupByKey




Data enters and leaves the first two steps. But never the Reshuffle. This only reads data but never passes data on. The step inside Reshuffle which causes that is GroupByKey.



As the collection is unbounded, I tried to configure the window with



lines = lines.apply(Window.configure()
.<List<String>>into(FixedWindows
.of(Duration.standardSeconds(10))
)
);


which should force anything doing a GroupByKey to release a window after 10 seconds. But it does not.



lines = lines.apply(Window.configure()
.<List<String>>into(FixedWindows
.of(Duration.standardSeconds(10))
)
.triggering(AfterProcessingTime.pastFirstElementInPane().plusDelayOf(Duration.standardSeconds(10)))
.withAllowedLateness(Duration.standardSeconds(0))
.discardingFiredPanes()
);


Adding a specific trigger on processing time also did not help.
Any clue? Thanks in advance!










share|improve this question
























  • This seems like an issue, as you have already open a issue in the Public Issue Tracker (issuetracker.google.com/119886479) , I will follow up on it.
    – Nathan Nasser
    Nov 23 at 1:25


















2














I'm using TextIO for reading from Cloud Storage. As I want to have the job running continously, I use watchForNewFiles.



For completeness, the data I read is working fine if I use bounded PCollections (no watchForNewFiles and BigQueryIO in batch mode), so there is no data issue.



I have p.run().waitUntilFinish(); in my code, so the pipeline runs. And it does not give any error.



Apache beam version is 2.8.0



PCollection<String> stream =
p.apply("Read File", TextIO
.read()
.from(options.getInput())
.watchForNewFiles(
Duration.standardMinutes(1),
Watch.Growth.afterTimeSinceNewOutput(Duration.standardHours(1))
)
.withCompression(Compression.AUTO));


This works perfectly fine and reads files as soon as they are available. the PCollection is unbounded and contains lines of text from these files.



After doing some transformations



PCollection<List<String>> lines = stream.apply("Parse CSV",
ParDo.of(new ParseCSV())
);

PCollection<TableRow> rows = lines.apply("Convert to BQ",
ParDo.of(new BigQueryConverter(schema))
);


The ParseCSV step adds timestamps to its receiver via outputWithTimestamp.



I end up with a PCollection of TableRows ready to stream to BigQuery.
For that, I use



WriteResult result = rows.apply("WriteToBigQuery",
BigQueryIO.
<TableRow>write()
.withFormatFunction(input -> input)
.withSchema(bqSchema)
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND)
.withFailedInsertRetryPolicy(InsertRetryPolicy.retryTransientErrors())
.withExtendedErrorInfo()
.to(options.getOutput())

);


This never writes data to BigQuery. If I take a look into the UI, I see that BigQueryIO does




  • ShardTableWrites

  • TagWithUniqueId

  • Reshuffle


    • Window.into

    • GroupByKey




Data enters and leaves the first two steps. But never the Reshuffle. This only reads data but never passes data on. The step inside Reshuffle which causes that is GroupByKey.



As the collection is unbounded, I tried to configure the window with



lines = lines.apply(Window.configure()
.<List<String>>into(FixedWindows
.of(Duration.standardSeconds(10))
)
);


which should force anything doing a GroupByKey to release a window after 10 seconds. But it does not.



lines = lines.apply(Window.configure()
.<List<String>>into(FixedWindows
.of(Duration.standardSeconds(10))
)
.triggering(AfterProcessingTime.pastFirstElementInPane().plusDelayOf(Duration.standardSeconds(10)))
.withAllowedLateness(Duration.standardSeconds(0))
.discardingFiredPanes()
);


Adding a specific trigger on processing time also did not help.
Any clue? Thanks in advance!










share|improve this question
























  • This seems like an issue, as you have already open a issue in the Public Issue Tracker (issuetracker.google.com/119886479) , I will follow up on it.
    – Nathan Nasser
    Nov 23 at 1:25
















2












2








2







I'm using TextIO for reading from Cloud Storage. As I want to have the job running continously, I use watchForNewFiles.



For completeness, the data I read is working fine if I use bounded PCollections (no watchForNewFiles and BigQueryIO in batch mode), so there is no data issue.



I have p.run().waitUntilFinish(); in my code, so the pipeline runs. And it does not give any error.



Apache beam version is 2.8.0



PCollection<String> stream =
p.apply("Read File", TextIO
.read()
.from(options.getInput())
.watchForNewFiles(
Duration.standardMinutes(1),
Watch.Growth.afterTimeSinceNewOutput(Duration.standardHours(1))
)
.withCompression(Compression.AUTO));


This works perfectly fine and reads files as soon as they are available. the PCollection is unbounded and contains lines of text from these files.



After doing some transformations



PCollection<List<String>> lines = stream.apply("Parse CSV",
ParDo.of(new ParseCSV())
);

PCollection<TableRow> rows = lines.apply("Convert to BQ",
ParDo.of(new BigQueryConverter(schema))
);


The ParseCSV step adds timestamps to its receiver via outputWithTimestamp.



I end up with a PCollection of TableRows ready to stream to BigQuery.
For that, I use



WriteResult result = rows.apply("WriteToBigQuery",
BigQueryIO.
<TableRow>write()
.withFormatFunction(input -> input)
.withSchema(bqSchema)
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND)
.withFailedInsertRetryPolicy(InsertRetryPolicy.retryTransientErrors())
.withExtendedErrorInfo()
.to(options.getOutput())

);


This never writes data to BigQuery. If I take a look into the UI, I see that BigQueryIO does




  • ShardTableWrites

  • TagWithUniqueId

  • Reshuffle


    • Window.into

    • GroupByKey




Data enters and leaves the first two steps. But never the Reshuffle. This only reads data but never passes data on. The step inside Reshuffle which causes that is GroupByKey.



As the collection is unbounded, I tried to configure the window with



lines = lines.apply(Window.configure()
.<List<String>>into(FixedWindows
.of(Duration.standardSeconds(10))
)
);


which should force anything doing a GroupByKey to release a window after 10 seconds. But it does not.



lines = lines.apply(Window.configure()
.<List<String>>into(FixedWindows
.of(Duration.standardSeconds(10))
)
.triggering(AfterProcessingTime.pastFirstElementInPane().plusDelayOf(Duration.standardSeconds(10)))
.withAllowedLateness(Duration.standardSeconds(0))
.discardingFiredPanes()
);


Adding a specific trigger on processing time also did not help.
Any clue? Thanks in advance!










share|improve this question















I'm using TextIO for reading from Cloud Storage. As I want to have the job running continously, I use watchForNewFiles.



For completeness, the data I read is working fine if I use bounded PCollections (no watchForNewFiles and BigQueryIO in batch mode), so there is no data issue.



I have p.run().waitUntilFinish(); in my code, so the pipeline runs. And it does not give any error.



Apache beam version is 2.8.0



PCollection<String> stream =
p.apply("Read File", TextIO
.read()
.from(options.getInput())
.watchForNewFiles(
Duration.standardMinutes(1),
Watch.Growth.afterTimeSinceNewOutput(Duration.standardHours(1))
)
.withCompression(Compression.AUTO));


This works perfectly fine and reads files as soon as they are available. the PCollection is unbounded and contains lines of text from these files.



After doing some transformations



PCollection<List<String>> lines = stream.apply("Parse CSV",
ParDo.of(new ParseCSV())
);

PCollection<TableRow> rows = lines.apply("Convert to BQ",
ParDo.of(new BigQueryConverter(schema))
);


The ParseCSV step adds timestamps to its receiver via outputWithTimestamp.



I end up with a PCollection of TableRows ready to stream to BigQuery.
For that, I use



WriteResult result = rows.apply("WriteToBigQuery",
BigQueryIO.
<TableRow>write()
.withFormatFunction(input -> input)
.withSchema(bqSchema)
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND)
.withFailedInsertRetryPolicy(InsertRetryPolicy.retryTransientErrors())
.withExtendedErrorInfo()
.to(options.getOutput())

);


This never writes data to BigQuery. If I take a look into the UI, I see that BigQueryIO does




  • ShardTableWrites

  • TagWithUniqueId

  • Reshuffle


    • Window.into

    • GroupByKey




Data enters and leaves the first two steps. But never the Reshuffle. This only reads data but never passes data on. The step inside Reshuffle which causes that is GroupByKey.



As the collection is unbounded, I tried to configure the window with



lines = lines.apply(Window.configure()
.<List<String>>into(FixedWindows
.of(Duration.standardSeconds(10))
)
);


which should force anything doing a GroupByKey to release a window after 10 seconds. But it does not.



lines = lines.apply(Window.configure()
.<List<String>>into(FixedWindows
.of(Duration.standardSeconds(10))
)
.triggering(AfterProcessingTime.pastFirstElementInPane().plusDelayOf(Duration.standardSeconds(10)))
.withAllowedLateness(Duration.standardSeconds(0))
.discardingFiredPanes()
);


Adding a specific trigger on processing time also did not help.
Any clue? Thanks in advance!







google-bigquery apache-beam






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 17:18

























asked Nov 12 at 16:50









Florian Baumert

114




114












  • This seems like an issue, as you have already open a issue in the Public Issue Tracker (issuetracker.google.com/119886479) , I will follow up on it.
    – Nathan Nasser
    Nov 23 at 1:25




















  • This seems like an issue, as you have already open a issue in the Public Issue Tracker (issuetracker.google.com/119886479) , I will follow up on it.
    – Nathan Nasser
    Nov 23 at 1:25


















This seems like an issue, as you have already open a issue in the Public Issue Tracker (issuetracker.google.com/119886479) , I will follow up on it.
– Nathan Nasser
Nov 23 at 1:25






This seems like an issue, as you have already open a issue in the Public Issue Tracker (issuetracker.google.com/119886479) , I will follow up on it.
– Nathan Nasser
Nov 23 at 1:25



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266689%2fwhen-using-unbounded-pcollection-from-textio-to-bigquery-data-is-stuck-in-reshu%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266689%2fwhen-using-unbounded-pcollection-from-textio-to-bigquery-data-is-stuck-in-reshu%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine