I am learning Pig on my own and while trying to explore a dataset I am encountering an exception. What is wrong in the script and why:
movies_data = LOAD '/movies_data' using PigStorage(',') as (id:chararray,title:chararray,year:int,rating:double,duration:double);
high = FILTER movies_data by rating > 4.0;
high_rated = FOREACH high GENERATE movies_data.title,movies_data.year,movies_data.rating,movies_data.duration;
DUMP high_rated;
At the end of the MAP Reduce execution I am getting the below error.
2018-07-22 20:11:07,213 [main] ERROR org.apache.pig.tools.grunt.Grunt
ERROR 1066: Unable to open iterator for alias high_rated.
Backend error : org.apache.pig.backend.executionengine.ExecException:
ERROR 0: Scalar has more than one row in the output.
1st : (1,The Nightmare Before Christmas,1993,3.9,4568.0),
2nd :(2,The Mummy,1932,3.5,4388.0)
(common cause: "JOIN" then "FOREACH ... GENERATE foo.bar" should be "foo::bar" )
First, let's see how we can fix your problem. You don't need to access your fields using the alias name. Your third line could be simply:
high_rated = FOREACH high GENERATE title, year, rating, duration;
If you wanted to use the alias name for some reason you should use the referential operator (::) as can be seen in the ERROR suggestion. Then your line would look like:
high_rated = FOREACH high GENERATE movies_data::title, movies_data::year, movies_data::rating, movies_data::duration;
Next, let's try to understand the exact reason behind the error message. When you try to access the fields using a dot operator (.), pig will assume that the alias is a scalar (alias having only one row). Since your alias had more than one row, it complained. You can read more about scalars in Pig here: https://issues.apache.org/jira/browse/PIG-1434
In the JIRA's release notes section, you will notice at the end, the expected error message matches the error you are getting:
If a relation contains more than single tuple, a runtime error is generated:
"Scalar has more than one row in the output"
this works for you without error.
movies_data = LOAD '/movies_data' using PigStorage(',') as (id:chararray,title:chararray,year:int,rating:double,duration:double);
high = FILTER movies_data by rating > 4.0;
high_rated = FOREACH high GENERATE title,year,rating,duration;
DUMP high_rated;
The FILTER command to allowed all the column records which are satisfy the filter condition.
I am trying to create the calculation below using a the filter function, however, I get a syntax error because of the Bachelor's, my question is how can I fix the issue with Bachelor's without fixing data in the warehouse?
FILTER("Fact - Count"."# of Applications" USING (("Candidate
Education"."Highest Level Education" IN('Bachelor's Degree', 'Higher
Degree')) AND ("Candidate Education"."Graduated" = 'Yes')))
Escape it. '' double single quote
I am trying to call an OData report with the following URL :
https://myXXXXX.sapbydesign.com/sap/byd/odata/crm_customerinvoicing_analytics.svc/RPCRMCIVIB_Q0001QueryResults?&$filter=PARA_CAL_DAY%20gt%20datetime%272017-01-01T00:00:00.000%27%20and%20PARA_CAL_DAY%20lt%20datetime%272017-01-02T00:00:00.000%27&$skip=0
As you can see I am trying to use the and operator inside a filter property but I received the error in the title of this post.
I tried :
$filter=(MyFilter1) and (MyFilter2)
$filter=(MyFilter1 and MyFilter2)
$filter=(MyFilter1 AND MyFilter2)
But I still have an error. Any ideas ?
Just in case someone stumbles upon this thread first, this is error occurs when the same field is used to filter the dataset twice (greater than+less than, greater than+less than or equal to, etc)
SAP issue report
I have a few columns in a list and one is called Supervised, the other relevant one is called Co-Supervisor.
I'm trying to force Co-Supervisor not to be blank if Supervised="Yes" but cannot get the column validation to work!
I've tried several different formulas in the Co-Supervisor column validation settings. I always get an error. Please help!
This is an example of one of the formulas I've used:
=IF([Supervised]="Yes",TRUE,FALSE)
I've also tried:
=AND([Supervised]="Yes",(NOT(ISBLANK([Co-Supervisor])))
What am I doing wrong?
Please use below formula:
GoTo List settings
GoTO validation settings
Use below mentioned formula
=IF([Supervised],IF([Co-Superviser]<>"",TRUE,FALSE),TRUE)
I have tested this on my environment and it is working fine.
(Note : Yes/No fields are internally stored as bit/boolean.So IF[Supervised] will directly evaluate to True/False.
Reference - https://sharepoint.stackexchange.com/questions/89188/calculated-column-issue-with-if-statement-and-yes-no-field
)
Doing this example in Matlab Image Category Classification
I have found an error trying to get the vocabulary of SURF features with this command
bag = bagOfFeatures(trainingSet);
The error is the following
Error using bagOfFeatures/parseInputs (line 1023)
The value of 'imgSets' is invalid. Expected imgSets to be one of these types:
imageSet
Instead its type was matlab.io.datastore.ImageDatastore.
I am using a ImageDatastore input instead of imgSets, but I am following a Mathworks example. Anyone can explain me why is this happening and how can I convert trainingSet into a imgSets type?
You have to convert the ImageDatastore object to an imageSet object. This can simply be done by using the following line instead:
bagOfFeatures(imageSet(trainingSet.Files));