<?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 Re: input_file_name() function not working when using custom Environment in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4331489#M5627</link>
    <description>&lt;P&gt;Thanks for this! I was playing around with some Spark configurations and input_file_name also failed and ruined my Data Pipeline. I was unable to find the exact cause, and this helps a lot.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;It's a real shame when stuff like this breaks a fairly stable ETL prod process.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Dec 2024 20:03:12 GMT</pubDate>
    <dc:creator>JosueMolina</dc:creator>
    <dc:date>2024-12-16T20:03:12Z</dc:date>
    <item>
      <title>input_file_name() function not working when using custom Environment</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4330659#M5624</link>
      <description>&lt;P&gt;EDIT;&lt;/P&gt;&lt;P&gt;After a bit more testing I found out that the input_file_name() function is not working when&amp;nbsp;&lt;EM&gt;native execution engine&lt;/EM&gt; is enabled in the Environment attached to the notebook.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas why this does not work?&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used to use the input_file_name() pyspark function when running a notebook using the&amp;nbsp;&lt;EM&gt;Workspace default&lt;/EM&gt; environment. In the &lt;EM&gt;Workspace settings,&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;Set default environment&lt;/EM&gt; is toggled &lt;EM&gt;O&lt;/EM&gt;&lt;EM&gt;ff&lt;/EM&gt;. Running the following code did work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from pyspark.sql.functions import input_file_name

df = spark.read.load('path/to/file.parquet', format='parquet')
df_file_name = df.withColumn("srcFile", input_file_name())
display(df_file_name)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I tried to run the same code using a custom Environment (using the same runtime 1.3, no custom or public libraries), the&amp;nbsp;&lt;EM&gt;srcFile&lt;/EM&gt; field remains empty...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas why this happens and how to fix this?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 10:59:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4330659#M5624</guid>
      <dc:creator>RickPeters</dc:creator>
      <dc:date>2024-12-16T10:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() function not working when using custom Environment</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4331489#M5627</link>
      <description>&lt;P&gt;Thanks for this! I was playing around with some Spark configurations and input_file_name also failed and ruined my Data Pipeline. I was unable to find the exact cause, and this helps a lot.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;It's a real shame when stuff like this breaks a fairly stable ETL prod process.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 20:03:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4331489#M5627</guid>
      <dc:creator>JosueMolina</dc:creator>
      <dc:date>2024-12-16T20:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() function not working when using custom Environment</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4331849#M5633</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/901871"&gt;@RickPeters&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;So you mean these script can executed on the default environment but not work property on the custom environment? If that is the case, I'd like to suggest you tried to check the library and resource difference between these two environments.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the not existed libraries and resources, you may need to install them at first before import in the notebook.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/library-management" target="_blank" rel="noopener"&gt;Manage Apache Spark libraries - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 05:49:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4331849#M5633</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-18T05:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() function not working when using custom Environment</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4332527#M5641</link>
      <description>&lt;P&gt;The only difference is that&amp;nbsp;&lt;EM&gt;Native execution engine&lt;/EM&gt; was enabled on the custom environment. This seemed to be the cause of&amp;nbsp;&lt;EM&gt;input_file_name()&lt;/EM&gt; was not working. I am wondering why though...&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 08:00:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4332527#M5641</guid>
      <dc:creator>RickPeters</dc:creator>
      <dc:date>2024-12-17T08:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() function not working when using custom Environment</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4334281#M5656</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/901871"&gt;@RickPeters&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Perhaps you can take al ooak the following document about the spark native execution engine and its limitations if helps:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/native-execution-engine-overview?tabs=sparksql" target="_blank"&gt;Native execution engine for Fabric Spark - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 06:00:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/input-file-name-function-not-working-when-using-custom/m-p/4334281#M5656</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-18T06:00:46Z</dc:date>
    </item>
  </channel>
</rss>

