<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Catch-up Structured Stream hangs on last step of write job to delta sync using toTable in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29897#M1611</link>
    <description>&lt;P&gt;I'm running databricks version 10.4 on gcp. I'm running a structured stream trying to process historical files in a delta table on gcp cloud storage. This source delta table is big but maintained with OPTIMIZE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The stream repartitions which seems to be the big issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using .trigger(availableNow=True). Shuffle write is huge but query seems to proceed well until last stage of write, i.e. 199/200 completed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changing &lt;I&gt;spark.sql.shuffle.partitions&lt;/I&gt; or &lt;I&gt;maxFilesPerTrigger&lt;/I&gt; seem to have NO effect on the processing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the stage:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;org.apache.spark.sql.streaming.DataStreamWriter.toTable(DataStreamWriter.scala:361)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:380)
py4j.Gateway.invoke(Gateway.java:295)
py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
py4j.commands.CallCommand.execute(CallCommand.java:79)
py4j.GatewayConnection.run(GatewayConnection.java:251)
java.lang.Thread.run(Thread.java:748)
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/1431i196A629E7E8CCD55/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;and stream config:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;        .repartition('date', 'id')\
        .writeStream\
        .trigger(availableNow=True)\
        .option('checkpointLocation', f'{checkpoint_basepath}{dest_database}-{model}-{full_source_table.replace(".","-")}')\
        .format('delta')\
        .queryName(model)\
        .outputMode('append')\
        .option('mergeSchema', 'true')\
        .partitionBy('date', 'id')\
        .toTable(table_name)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2022 17:41:04 GMT</pubDate>
    <dc:creator>elementalM</dc:creator>
    <dc:date>2022-09-30T17:41:04Z</dc:date>
    <item>
      <title>Catch-up Structured Stream hangs on last step of write job to delta sync using toTable</title>
      <link>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29897#M1611</link>
      <description>&lt;P&gt;I'm running databricks version 10.4 on gcp. I'm running a structured stream trying to process historical files in a delta table on gcp cloud storage. This source delta table is big but maintained with OPTIMIZE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The stream repartitions which seems to be the big issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using .trigger(availableNow=True). Shuffle write is huge but query seems to proceed well until last stage of write, i.e. 199/200 completed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changing &lt;I&gt;spark.sql.shuffle.partitions&lt;/I&gt; or &lt;I&gt;maxFilesPerTrigger&lt;/I&gt; seem to have NO effect on the processing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the stage:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;org.apache.spark.sql.streaming.DataStreamWriter.toTable(DataStreamWriter.scala:361)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:380)
py4j.Gateway.invoke(Gateway.java:295)
py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
py4j.commands.CallCommand.execute(CallCommand.java:79)
py4j.GatewayConnection.run(GatewayConnection.java:251)
java.lang.Thread.run(Thread.java:748)
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/1431i196A629E7E8CCD55/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;and stream config:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;        .repartition('date', 'id')\
        .writeStream\
        .trigger(availableNow=True)\
        .option('checkpointLocation', f'{checkpoint_basepath}{dest_database}-{model}-{full_source_table.replace(".","-")}')\
        .format('delta')\
        .queryName(model)\
        .outputMode('append')\
        .option('mergeSchema', 'true')\
        .partitionBy('date', 'id')\
        .toTable(table_name)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 17:41:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29897#M1611</guid>
      <dc:creator>elementalM</dc:creator>
      <dc:date>2022-09-30T17:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Catch-up Structured Stream hangs on last step of write job to delta sync using toTable</title>
      <link>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29898#M1612</link>
      <description>&lt;P&gt;Can you try:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;remove megeSchema&lt;/LI&gt;&lt;LI&gt;remove repartition&lt;/LI&gt;&lt;LI&gt;analyze details about task 199&lt;/LI&gt;&lt;LI&gt;try maxBytesPerTrigger in readStream&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 18:26:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29898#M1612</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-09-30T18:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Catch-up Structured Stream hangs on last step of write job to delta sync using toTable</title>
      <link>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29899#M1613</link>
      <description>&lt;P&gt;thanks for the response. have you seen maxBytesPerTrigger work with latest versions?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 18:35:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29899#M1613</guid>
      <dc:creator>elementalM</dc:creator>
      <dc:date>2022-09-30T18:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Catch-up Structured Stream hangs on last step of write job to delta sync using toTable</title>
      <link>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29900#M1614</link>
      <description>&lt;P&gt;You might have a data skew because you are doing repartition("date","id"). Do you have more data for some days? or Ids? have you try by removing this repartition() step?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 17:55:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29900#M1614</guid>
      <dc:creator>jose_gonzalez</dc:creator>
      <dc:date>2022-10-03T17:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Catch-up Structured Stream hangs on last step of write job to delta sync using toTable</title>
      <link>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29901#M1615</link>
      <description>&lt;P&gt;Hi @Dwight Branscombe​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We'd love to hear from you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 10:21:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/catch-up-structured-stream-hangs-on-last-step-of-write-job-to/m-p/29901#M1615</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-19T10:21:42Z</dc:date>
    </item>
  </channel>
</rss>

