Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Case expression. Schema for the default clause should be the same as schema for THEN clauses. Result scheme: Schema{INT32}. Schema for default expression is Schema{FLOAT64} #2405

Open
eksantrik opened this issue Feb 3, 2019 · 2 comments

Comments

@eksantrik
Copy link

eksantrik commented Feb 3, 2019

When I create a stream with the following single column it works:

CREATE STREAM CISCOCDRCMR_MERGE WITH (PARTITIONS=1) AS SELECT (CASE WHEN "CMR_PKID" IS NOT NULL AND "CMR_NUMBERPACKETSRECEIVED">0 THEN (100*"CMR_NUMBERPACKETSLOST") ELSE -1 END) AS CMR_PACKETLOSS_PERCENT FROM CISCOCDRCMR_ORIGLEG_MERGE;

But when I add a second column it gives me an error:

CREATE STREAM CISCOCDRCMR_MERGE WITH (PARTITIONS=1) AS SELECT (CASE WHEN "CMR_SCS" IS NULL THEN -1 ELSE "CMR_SCS" END) AS CMR_SCS,(CASE WHEN "CMR_PKID" IS NOT NULL AND "CMR_NUMBERPACKETSRECEIVED">0 THEN (100*"CMR_NUMBERPACKETSLOST") ELSE -1 END) AS CMR_PACKETLOSS_PERCENT FROM CISCOCDRCMR_ORIGLEG_MERGE;

Invalid Case expression. Schema for the default clause should be the same as schema for THEN clauses. Result scheme: Schema{INT32}. Schema for default expression is Schema{FLOAT64}

Is this the expected behavior? Do I need to CAST some variables to fix this?

@eksantrik
Copy link
Author

I noticed that when I try to create the stream with a bunch of INTEGER fields and my WHEN clause for "CMR_PACKETLOSS_PERCENT", the stream is created. However, if I try to include a DOUBLE field such as CMR_SCS as above, the system throws an error.

@vezir
Copy link

vezir commented Feb 3, 2019

I think, then and else part should contain the same type of number. Therefore if cmr_scs field is double then then field must be -1.0 instead of -1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants