4

I am trying to run a job that runs successfully from within Visual Studio. I'd like to run this in my ADF pipeline but the job fails with a syntax error.

ERRORID:  E_CSC_USER_SYNTAXERROR
SEVERITY:  Error
COMPONENT:  CSC
SOURCE:  USER
MESSAGE:  
syntax error. Expected one of: '[' end-of-file ALTER COMBINE CREATE DEPLOY DROP EXTRACT IF INSERT OUTPUT PROCESS REDUCE REFERENCE RESOURCE SELECT TABLE TRUNCATE UPDATE USE USING VIEW identifier quoted-identifier variable ';' '(' 

DETAILS:  
at token [], line 2
near the ###:
**************
DECLARE @outSlice string = "somepath.csv"; 
### USE DATABASE myDB;

//LOCAL    
//DECLARE @root string = @"some local path";

//CLOUD    
//DECLARE @root string = "adl://storeuri";    
DECLARE @root string = "wasb://container@account/";

//RUN MODE 0
//DECLARE @var2 int = 1;    
//DECLARE @var1 int = 1;
DECLARE @path1 string = @root + @"path1/xyz.csv"; 

EDIT:I tried it both with USE DATABASE statement and I commented it out like shown above;### appears in the exact same location in either cases. EDIT2: Added consecutive lines of code per request from @michael-rys Later in the script the parameter @outSlice is used in an output statement like

OUTPUT @dataset
TO @outSlice
USING Outputters.Csv();

The parameter is determined within a pipeline activity. Snippet below:

       "type": "DataLakeAnalyticsU-SQL",
        "typeProperties": {
            "scriptPath": "script.usql",
            "scriptLinkedService": "storageXYX",
            "degreeOfParallelism": 2,
            "priority": 0,
            "parameters": {
                "outSlice": "$$Text.Format('/Output/{0:yyyy}/{0:MM}/{0:dd}/{0:HH}/somefile.csv',SliceStart)"
            }
chi
  • 471
  • 3
  • 18
  • Hi chi, can you please show the part of the error message that includes the ### and the usage of the variable? – Michael Rys Jan 19 '16 at 07:52
  • Thanks Michael. I edited the message above. "###" mark appears before the USE DATABASE statement. However, I commented the statement out and it still appeared right before "### //USE DATABASE...." – chi Jan 19 '16 at 08:42
  • The usage in the OUTPUT looks fine. What is the statement after the `USE DATABASE myDB;` statement? – Michael Rys Jan 19 '16 at 20:19
  • `### USE DATABASE Buzz; //LOCAL //DECLARE @root string = @"some local path"; //CLOUD //DECLARE @root str ...` – chi Jan 19 '16 at 20:31
  • I don't see anything wrong from the U-SQL side. Maybe ADF is adding some statements to the script that makes it fail. Can you look up in your job repository what the submitted script looks like? – Michael Rys Jan 19 '16 at 20:37
  • Here is what my script looks like `USE DATABASE myDB; //LOCAL //DECLARE @root string = @"some local path"; ... DECLARE @path1 string = @root + @"path1/xyz.csv"; ...` Here is how adf submits it. All it seems to add is the formatted string coming from the adf activity at the top of the script `DECLARE @outSlice string = "somepath.csv"; USE DATABASE myDB; //LOCAL //DECLARE @root string = @"some local path"; ... DECLARE @path1 string = @root + @"path1/xyz.csv"; ...` – chi Jan 19 '16 at 20:48

1 Answers1

2

Per off-line conversation with Michael, I removed the BOM from the script file and the ADF job ran successfully. If you are using Visual Studio, go to File->Advanced Save Options. In my case, I had to choose UTF-8 without the signature to remove BOM. Thanks again @michael-rys!

chi
  • 471
  • 3
  • 18