Google Groups Home
Help | Sign in
stupid sql query error :((
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
AmaliaP  
View profile
 More options Feb 1 2007, 8:12 am
From: "AmaliaP" <amalia.pirvane...@gmail.com>
Date: Thu, 01 Feb 2007 13:12:46 -0000
Local: Thurs, Feb 1 2007 8:12 am
Subject: stupid sql query error :((
Hi

more newbie questions:

I have an input stream (columns: id, idL, idE, value) and I want to
make a running query that stores all data in the last 10 minutes and
counts the events with the same idL and idE. I run into some examples
from the SC site..and I finally got this query:

select idL, idE, event_counter from tblInputStream
                (partition by store last 10 seconds with count(id) as
event_counter)
                as tblRunQuery
                where tblRunQuery.$row_status is not dead

I know this is not a good query..but can you help me (i don't have
group by anywhere and I don't know where to put it)?

Also, in the output stream I want to have idL,idE,event_counter and a
few fields from other not in-memory tables from the database..Is this
possible? I will try it my self but now I receive in the output
session the error "unknown field idL" and I guess I receive it because
of the malformed sql in the running query...

ty for help in advance

amalia


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ashwin  
View profile
 More options Feb 2 2007, 10:28 pm
From: "Ashwin" <ashwin.jayaprak...@gmail.com>
Date: Sat, 03 Feb 2007 03:28:56 -0000
Local: Fri, Feb 2 2007 10:28 pm
Subject: Re: stupid sql query error :((
Use the Partition clause:

select idLocation, idEventType, counter
from tbl_facts_stream
(partition by idLocation, idEventType store last 10 seconds with
count(idEventType) as counter)
as tbl_facts_p
where tbl_facts_p.$row_status is new;

On 1 Feb, 18:12, "AmaliaP" <amalia.pirvane...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ashwin  
View profile
 More options Feb 2 2007, 10:30 pm
From: "Ashwin" <ashwin.jayaprak...@gmail.com>
Date: Sat, 03 Feb 2007 03:30:55 -0000
Local: Fri, Feb 2 2007 10:30 pm
Subject: Re: stupid sql query error :((
The "unknown field idL" error is because of this - http://
groups.google.com/group/streamcruncher/t/f74ef614de2920a2?hl=en-GB.
You've already asked this before.

On 1 Feb, 18:12, "AmaliaP" <amalia.pirvane...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
AmaliaP  
View profile
 More options Feb 5 2007, 3:36 am
From: "AmaliaP" <amalia.pirvane...@gmail.com>
Date: Mon, 05 Feb 2007 08:36:33 -0000
Local: Mon, Feb 5 2007 3:36 am
Subject: Re: stupid sql query error :((
Here are the input stream and the running query I built.

                                    //columns of the generated events
                                String[] columnNames = new String[]{
                                                "id",
                                                "idEventType",
                                                "idLocation",
                                                "value",
                                                "obs",
                                                "status",
                                                "timestamp"};
                                String[] columnTypes = new String[]{
                                                "bigint not null",                    //id
                                                "bigint not null",                    //idEventType
                                                "bigint not null",                    //idLocation
                                                "varchar(255)",                       //value
                                                "varchar(255)",                       //observation
                                                "integer",                                    //status
                                                "timestamp"};                         //timestamp

                                //thread for input events
                                InputEventsStream inputStream = new InputEventsStream(
                                                cruncher, columnNames, columnTypes, "tbl_facts_stream",
                                                0, 6, "tbl_facts_stream_index");

                                String rql = "select idLocation, idEventType, counter" +
                                " from tbl_facts_stream " +
                                " (partition by idLocation, idEventType store last 10 seconds " +
                                " with count(id) as counter)" +
                                " as tbl_facts_p " +
                                " where tbl_facts_p.$row_status is new;";

                                columnNames = new String[] {
                                                "idLocation",
                                                "idEventType",
                                                "counter"};
                                columnTypes = new String[] {
                                                "bigint",
                                                "bigint",
                                                "integer"};

                                TableFQN tableFQN = new TableFQN("tbl_facts_partitioned");

                                ParserParameters parameters = new ParserParameters();
                                parameters.setQuery(rql);
                                parameters.setQueryName(queryName);
                                parameters.setResultColumnNames(columnNames);
                                parameters.setResultColumnTypes(columnTypes);
                                parameters.setResultTableFQN(tableFQN);

                                ParsedQuery parsedQuery = cruncher.parseQuery(parameters);

                                QueryConfig config = parsedQuery.getQueryConfig();
                                config.setQuerySchedulePolicy(new
QueryConfig.QuerySchedulePolicyValue(
                                                QuerySchedulePolicy.ATLEAST_OR_SOONER, Integer.MAX_VALUE));

                                //cruncher.unregisterQuery(queryName);
                                cruncher.registerQuery(parsedQuery);

/////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// ////////////////////
and here the result:

SEVERE: An error occurred while executing the Query:
tbl_facts_partitioned_rql
streamcruncher.A.O0OO: Error(s) occurred while executing the Jobs. [1
Exceptions]
        at streamcruncher.A.A.Ó00000(SimpleJobFixedBatchExecutor.java:108)
        at streamcruncher.D.OOoO.while(SchedulableQuery.java:246)
        at streamcruncher.D.B.new(QueryRunnerJob.java:73)
        at streamcruncher.D.B.run(QueryRunnerJob.java:55)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
 -- Exceptions --
 [tbl_facts_p]
java.lang.NullPointerException
        at streamcruncher.C.B.super.C.o00000(AbstractTablePartitioner.java:
222)
        at streamcruncher.D.OOoO$_Oo.Ò00000(SchedulableQuery.java:435)
        at streamcruncher.A.N.run(SimpleJob.java:72)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ashwin  
View profile
 More options Feb 5 2007, 8:37 pm
From: "Ashwin" <ashwin.jayaprak...@gmail.com>
Date: Tue, 06 Feb 2007 01:37:06 -0000
Local: Mon, Feb 5 2007 8:37 pm
Subject: Re: stupid sql query error :((
Hmm.. can you pls give me the DB name/version that you are using. I'll
see if I can replicate it.

Ashwin.

On 5 Feb, 13:36, "AmaliaP" <amalia.pirvane...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google