GQL IN operator error - google-app-engine

I encounter an appengine error from a GQL query with "IN" operator. my query is as follows:
SELECT * FROM ratings WHERE rating >= 0.0 AND cat = 1 AND pid IN(44,14)
the error message is:
PHP Fatal error: Uncaught exception 'google\appengine\runtime\ApplicationError' with message 'Encountered "IN" at line 1, column 84.
Was expecting one of:
"contains" ...
"has" ...
"is" ...
"=" ...
"<" ...
"<=" ...
">" ...
">=" ...
"." ...
"(" ...
' in /base/data/home/runtimes/php/sdk/google/appengine/runtime/RealApiProxy.php:53
I put my query in datastore admin console It works without any error and showed the exactly result.
What's wrong??

You are confused about what the IN operator does. It can not do what you want.
Please read the docs on cloud datastore https://cloud.google.com/datastore/docs/apis/gql/gql_reference
Notice that the operator = is another name for the IN and CONTAINS operators. For example, <value> = <property-name> is the same as <value> IN <property-name>, and <property-name> = <value> is the same as <property-name> CONTAINS <value>. Also <property-name> IS NULL is the same as <property-name> = NULL.

Related

#Teradata error expected something like ')' between ';' and the end of the request

REPLACE MACRO GEO_MATCHED (REGION INTEGER) AS (
INSERT INTO DLA_v.GEO_FULL_2019_MATCHED
SELECT
Poly.Project_ID AS "Project_ID",
Poly.WIKIMAPIA_ID AS "POLY_ID_WIKIMAPIA",
Poly.NAME AS "POLY_NAME",
Fast.REVENUE_YTD,
Fast.JOB_VERTICAL,
Poly.geometry.ST_Contains(Fast.geometry) AS "INSIDE"
FROM
(SELECT * FROM DLA_A_19143.geo_jobsite_input_data
WHERE region__c = :REGION)Fast, DLA_D_SLSMKT.GEO_POLYGONS Poly
WHERE
(Poly.geometry.ST_Contains(Fast.geometry) = 1;);
----region with null values
getting this error for this code :
[42000] [Teradata][ODBC Teradata Driver][Teradata Database] Syntax error, expected something like ')' between ';' and the end of the request.
Added the brackets as it has asked to add the bracted between semicolumns and end of request its not working, if any one could help .

Snowflake: How to filter on a "field name" that contains spaces? It works fine in select statement but not in whereclause filter

This code works fine:
SELECT distinct "Line Status" from TEMP_TS_SUBSCR_ACCT_CUST_INFO;
but this code returns error:
SELECT * from TEMP_TS_SUBSCR_ACCT_CUST_INFO where "Line Status" = "Active";
SQL compilation error: error line 1 at position 66 invalid identifier '"Active"'
Please advise what could be wrong.
String literals should be enclosed with ' or $$:
SELECT *
FROM TEMP_TS_SUBSCR_ACCT_CUST_INFO
WHERE "Line Status" = 'Active';
-- WHERE "Line Status" = $$Active$$;
Double quotes are required for identifiers that contain spaces (here column name).

YACC Not getting the values from successor nodes

I'm making a school project and I'm having some trouble.
I have this yacc grammer
FILE : '{' GEOMETRY '}'
;
GEOMETRY : key_type ':' value_point ',' key_coordinates ':' PONTO
;
PONTO : VETOR_MIN2 { printf("%s", $<str>1); }
;
VETOR_MIN2 : '[' numero ',' numero ']'
;
When I make that printf in the non terminal PONTO I only get this: [
but I should get something like this: [20, 10]
What it's missing here? Please help.
Thanks for your time.
The semantic value of a rule is the value that resides in $$ after that rule's actions have been run. If a rule does not have any actions (as is the case for VECTOR_MIN2), the default action is $$ = $1; (unless there is no $1 or the types don't match, in which case there is no default action).
If you want VECTOR_MIN2 to produce a different value, you'll need to add an action and assign a different value to $$.

Writing JOIN Commands on Teradata

q) Use COUNT and DISTINCT to determine how many distinct skus there are
in the skuinfo, skstinfo, and trnsact tables. Which skus are common to all tables, or unique to specific tables?
A) I was trying to find the solution to the above q in TERADATA. The first part was simple i was able to run three commands and got the distinct skus (stock keeping unit).
Now to find the common sku in all three table i am running the command but having errors :
SELECT COUNT(DISTINCT a.sku),COUNT(DISTINCT b.sku),COUNT(DISTINCT c.sku)
FROM skuinfo a INNER JOIN skstinfo b INNER JOIN trnsact c
ON a.sku=b.sku AND b.sku=c.sku;// Why is there error if i use **Where** in Place of ON?
**Error Occurred . . .**
[com.teradata.commons.datatools.sqlparsers.common.ParseException: Encountered ";" at line 3, column 31. Was expecting one of: "and" ... "at" ... "cross" ... "day" ... "full" ... "hour" ... "inner" ... "join" ... "left" ... "minute" ... "month" ... "on" ... "or" ... "right" ... "second" ... "timezone_hour" ... "timezone_minute" ... "year" ... "||" ... "(" ... "**" ... "+" ... "-" ... "*" ... "/" ... "mod" ... "." ... "[" ... ]
Please let me know why is my syntax not working, though most forums say the query is right. Thanks

compiler design code to parse goto and blocks

Can someone please help me understand how to code lex and yacc file for a C program to parse goto and blocks(labels).
Here is some example I found on the net:
<statement> ::=
<variable> <inc> <semi>
| <variable> <assign> <null> <semi>
| <goto> <label> <semi>
But how to uniquely identify label. Can someone give me an example of this or any link where it is mentioned.
<label> here really means a symbol - an identifier - which must correspond to a label definition somewhere else for the program to be correct.
You don't need to "uniquely identify" as part of the parser, a label is identified by the syntax of the language. It is entirely legal to allow labels to overlap with other symbol / variable names. Just add a rule for a legal label, reuse the lexer TOKEN for IDENTIFIER, then store labels in a symbol table per function so you can detect duplicate labels.
Typically in C-like languages, a label is part of a statement rule. It doesn't usually make sense anywhere else. The way I do it:
labeled_statement:
IDENTIFIER ':' statement
{
$$ = $3;
$$->label = new Label($1);
}
;
Another way:
label:
IDENTIFIER ':'
{ $$ = new Label($1); }
;
labeled_statement:
label statement
{
$$ = $2;
$$->label = $1;
}
;

Resources