How to fix nested split issue in Azure data factory Pipeline expression builder?

Zohaib Sheraz Mughal 20 Reputation points
2025-01-07T23:56:02.7266667+00:00

Hi there,

I'm trying to make use of hierarchical namespaces for Azure data lake storage gen2.

When I'm dynamically setting the file structure in the Pipeline expression builder in the ADF, the following error is returned:

Cannot fit unknown into the function parameter string.

The expression is:

@concat(split(item().name,'')[0],'/',split(split(item().name,'')[1],'-')[0],'/',split(split(item().name,'_')[1],'-')[1])

Exp file_name is "customers_2025-01-08.csv"

The expected result/folder structure is:

customers/2025/01

Should there be anything unclear to you, please ask here, I'll willing to clarify as much as possible.

Thanks for your help.

Regards.

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,531 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,166 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Keshavulu Dasari 3,095 Reputation points Microsoft Vendor
    2025-01-09T18:38:30.8733333+00:00

    Hi Zohaib Sheraz Mughal,

    Good to see that your response I have converted now this comment to answer Could you please check and "Accept " the answer.

    I understand looks like the error is due to the nested split functions within the concat function.

    I suggest few step-by-step method using variables in your pipeline:

    Create a variable to store the file name without the extension:

    @split(item().name, '.')[0]
    

    Create another variable to store the part after the underscore:

    @split(variables('fileNameWithoutExtension'), '_')[1]
    

    Extract the year from the second variable:

    @split(variables('partAfterUnderscore'), '-')[0]
    

    Extract the month from the second variable:

    @split(variables('partAfterUnderscore'), '-')[1]
    

    Concatenate the final folder structure:

    @concat(split(item().name, '_')[0], '/', variables('year'), '/', variables('month'))
    

    This method uses transformations to break a complex expression into manageable It should help you avoid the nested partitioning problems you face.

    If you still encounter issues, you might want to consider breaking down the expression into multiple steps using variables in your pipeline. This can help manage the complexity and make debugging easier.

    User's image

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer. Issue: Trying to fix nested split issue in Azure data factory Pipeline expression builder

    Solution: found a solution using substring, it resolved the problem.


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.           

    User's image

    If you have any other questions or are still running into more issues, let me know in the "comments" and I would be happy to help you.

    0 comments No comments

  2. Keshavulu Dasari 3,095 Reputation points Microsoft Vendor
    2025-01-10T19:04:22.8833333+00:00

    Hi Zohaib Sheraz Mughal,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: Trying to fix nested split issue in Azure data factory Pipeline expression builder

    Solution: found a solution using substring, it resolved the problem.


    Please let us know if you have any more questions and we will be glad to assist you further. Thank you!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.