none
TimeSpan not supported issue. Need to set as String but can't convert back to TimeSpan.

    Question

  • I have data coming from a PostgreSQL DB that is getting put into Azure Data Lake via Data Factory v2.  I have a column that is of type TimeWithoutTimeZone in PostgreSQL and is being formatted as TimeSpan("G") from Data Factory.  Data Factory is adding a "0:" for date-part to the beginning of my data.  

    Then I am trying to use U-SQL to process the file in the Data Lake but TimeSpan is not supported in U-SQL.  How do I handle the format dd:hh:mm:ss in U-SQL?  In the Extract statement I have to set the column to data type String.  In my select statements how can I convert the String back to TimeSpan without the leading 0 for date-part?  If I try and convert the string to TimeSpan it throws a conversion error. 

    Wednesday, September 26, 2018 3:18 PM

Answers

  • I have data coming from a PostgreSQL DB that is getting put into Azure Data Lake via Data Factory v2.  I have a column that is of type TimeWithoutTimeZone in PostgreSQL and is being formatted as TimeSpan("G") from Data Factory.  Data Factory is adding a "0:" for date-part to the beginning of my data.  

    Then I am trying to use U-SQL to process the file in the Data Lake but TimeSpan is not supported in U-SQL.  How do I handle the format dd:hh:mm:ss in U-SQL?  In the Extract statement I have to set the column to data type String.  In my select statements how can I convert the String back to TimeSpan without the leading 0 for date-part?  If I try and convert the string to TimeSpan it throws a conversion error. 

    I ended up figuring it out.  I set the extract column to type String and then in my select statements used  TimeSpan.Parse([MyStringColumn]).ToString("g");
    • Marked as answer by FrankMn Wednesday, September 26, 2018 4:38 PM
    Wednesday, September 26, 2018 4:38 PM