Error occurs in select clause querying for technical analysis module in DolphinDB - select

The picture shows the table schema:
The line reported an error when querying the data:
select *,bBands(close, 5, 2, 2, 0) as `high`mid`low from kline
The error message is:
The calculated column was not initialized or an exception was raised.
However, another script I tried didn't report the error:
close = 7.2 6.97 7.08 6.74 6.49 5.9 6.26 5.9 5.35 5.63 3.81 3.935 4.04 3.74 3.7 3.33 3.64 3.31 2.69 2.72
date = (2020.03.02 + 0..4 join 7..11).take(20)
symbol = take(`F,10) join take(`GPRO,10)
t = table(symbol, date, close)
select *, bBands(close, 5, 2, 2, 2) as `high`mid`low from t context by symbol
Why the error occurs and how can I avoid it in my code?

This error is raised because the names of the columns coincide with UP and DN of the Bollinger Bands.
You can use the following code:
select *,bBands(close, 5, 2, 2, 0) as `bBand_high`mid`bBand_low  from kline.

Related

Using "BETEEN" operator on a LONG-EMBEDDED-LIST property declared in OrientDB 2.2.17

I am using OrientDB 2.2.17 (enterprise edition) and I have a problem searching on the data:
I have a vertex called: EN70 with a property: EP70_4 from type 'embedded list = LONG'.
I added a record to this vertex with the value of [2,3,4] in this 'EP70_4' property.
The index on this property: Not_Unique (sbtree). [must support range queries]
SELECT * FROM EN70 WHERE (EP70_4 >= 1) is working and returns my record.
SELECT * FROM EN70 WHERE (EP70_4 <= 3) is working and returns my record.
The operator "Between" is not woking and throw exception:
SELECT * FROM EN70 WHERE (EP70_4 BETWEEN 1 AND 3 )
I tried to simulate a "between" operator:
SELECT * FROM EN70 WHERE ((EP70_4 >= 1) AND (EP70_4 <= 3)) IS NOT WORKING
but it is not working.
both sections 6 and 7 throws an exception:
Error on using index EN70.EP70_4 in query 'SELECT * FROM EN70 WHERE (EP70_4 BETWEEN 1 AND 3 )'. Probably you need to rebuild indexes. Now executing query using cluster scan
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Long
at com.orientechnologies.common.serialization.types.OLongSerializer.preprocess(OLongSerializer.java:36)
at com.orientechnologies.orient.core.index.sbtree.local.OSBTree.iterateEntriesBetweenAscOrder(OSBTree.java:1474)
at com.orientechnologies.orient.core.index.sbtree.local.OSBTree.iterateEntriesBetween(OSBTree.java:771)
at com.orientechnologies.orient.core.index.engine.OSBTreeIndexEngine.iterateEntriesBetween(OSBTreeIndexEngine.java:185)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doIterateIndexEntriesBetween(OAbstractPaginatedStorage.java:2065)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.iterateIndexEntriesBetween(OAbstractPaginatedStorage.java:2053)
at com.orientechnologies.orient.core.index.OIndexMultiValues.iterateEntriesBetween(OIndexMultiValues.java:275)
at com.orientechnologies.orient.core.index.OIndexAbstractDelegate.iterateEntriesBetween(OIndexAbstractDelegate.java:104)
at com.orientechnologies.orient.core.index.OIndexTxAwareMultiValue.iterateEntriesBetween(OIndexTxAwareMultiValue.java:339)
at com.orientechnologies.orient.core.sql.operator.OQueryOperatorBetween.executeIndexQuery(OQueryOperatorBetween.java:131)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchForIndexes(OCommandExecutorSQLSelect.java:2184)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchInClasses(OCommandExecutorSQLSelect.java:1001)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.assignTarget(OCommandExecutorSQLResultsetAbstract.java:209)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.assignTarget(OCommandExecutorSQLSelect.java:530)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearch(OCommandExecutorSQLSelect.java:512)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:488)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:74)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:2624)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:2570)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:69)
at com.orientechnologies.orient.server.network.protocol.http.command.post.OServerCommandPostCommand.execute(OServerCommandPostCommand.java:106)
at com.orientechnologies.orient.graph.server.command.OServerCommandPostCommandGraph.execute(OServerCommandPostCommandGraph.java:37)
at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.service(ONetworkProtocolHttpAbstract.java:169)
at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.execute(ONetworkProtocolHttpAbstract.java:622)
at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:77)
What can it be??? Please help me...
I'd say it's a bug, I strongly suggest you to report it here: https://github.com/orientechnologies/orientdb/issues

What does the exclude_nodata_value argument to ST_DumpValues do?

Could anyone explain what the exclude_nodata_value argument to ST_DumpValues does?
For example, given the following:
WITH
-- Create a raster 4x4 raster, with each value set to 8 and NODATA set to -99.
tbl_1 AS (
SELECT
ST_AddBand(
ST_MakeEmptyRaster(4, 4, 0, 0, 1, -1, 0, 0, 4326),
1, '32BF', 8, -99
) AS rast
),
-- Set the values in rows 1 and 2 to -99.
tbl_2 AS (
SELECT
ST_SetValues(
rast, 1, 1, 1, 4, 2, -99, FALSE
) AS rast FROM tbl_1)
Why does the following select statement return NULLs in the first two rows:
SELECT ST_DumpValues(rast, 1, TRUE) AS cell_values FROM tbl_2;
Like this:
{{NULL,NULL,NULL,NULL},{NULL,NULL,NULL,NULL},{8,8,8,8},{8,8,8,8}}
But the following select statement return -99s?
SELECT ST_DumpValues(rast, 1, FALSE) AS cell_values FROM tbl_2;
Like this:
{{-99,-99,-99,-99},{-99,-99,-99,-99},{8,8,8,8},{8,8,8,8}}
Clearly, with both statements the first two rows really contain -99s. However, in the first case (exclude_nodata_value=TRUE) these values have been masked (but not replaced) by NULLS.
Thanks for any help. The subtle differences between NULL and NODATA within PostGIS have been driving me crazy for several days.

Need help in regexp_substr and regexp_like

I have data like below in once column(having 5 records)
Failed to process Batch task. An exception occured while building Bond(00010068, BOND, CLOSE, ICT, TOK, EOD, Bond_EOD): You are trying to get DBond that doesn't exist. (DeliveryCount=2)
Failed to process Batch task. An exception occured while building Bond(00010068, BOND, CLOSE, ICT, TOK, EOD, Bond_EOD): You are trying to get DBond that doesn't exist. (DeliveryCount=0)
Failed to process Batch task. There was an error generating the XML document. (DeliveryCount=0)
Failed to process Batch task. There was an error generating the XML document. (DeliveryCount=0)
Failed to process Batch task. There was an error generating the XML document. (DeliveryCount=0)
Here i need to get the data like ( need data which is eclosed in () )
00010068, BOND, CLOSE, ICT, TOK, EOD, Bond_EOD
00010068, BOND, CLOSE, ICT, TOK, EOD, Bond_EOD
and i don't want to other that above mentioned data.
apart from that have to split the row data into columns like
col1 col2 col3 col4 col5 col6 col7
-------------------------------------------------------------------------
00010068 BOND CLOSE ICT TOK EOD Bond_EOD
Can you please some on help me on this
with tab as
(select 'Failed to process Batch task. An exception occured while building Bond(00010068, BOND, CLOSE, ICT, TOK, EOD, Bond_EOD): You are trying to get DBond that doesn''t exist. (DeliveryCount=2)' s from dual
union all select 'Failed to process Batch task. An exception occured while building Bond(00010068, BOND, CLOSE, ICT, TOK, EOD, Bond_EOD): You are trying to get DBond that doesn''t exist. (DeliveryCount=0)' from dual
union all select 'Failed to process Batch task. There was an error generating the XML document. (DeliveryCount=0)' from dual
union all select 'Failed to process Batch task. There was an error generating the XML document. (DeliveryCount=0)' from dual
union all select 'Failed to process Batch task. There was an error generating the XML document. (DeliveryCount=0)' from dual
)
select trim(regexp_substr(parsed, '[^,]+', 1, 1)) col1
, trim(regexp_substr(parsed, '[^,]+', 1, 2)) col2
, trim(regexp_substr(parsed, '[^,]+', 1, 3)) col3
, trim(regexp_substr(parsed, '[^,]+', 1, 4)) col4
, trim(regexp_substr(parsed, '[^,]+', 1, 5)) col5
, trim(regexp_substr(parsed, '[^,]+', 1, 6)) col6
, trim(regexp_substr(parsed, '[^,]+', 1, 7)) col7
from
(
select substr(regexp_substr(s, 'bond\([^)]+', 1, 1, 'i'), 6) parsed
from tab where regexp_like(s, 'bond\(.+?\)', 'i')
);
regexp_like(s, 'bond\(.+?\)', 'i') returns true if a string s contains "bond(...)", case insensitive ("i" flag); .+? is a nongreedy at least one symbol - anything until the first ")"
substr(regexp_substr(s, 'bond\([^)]+', 1, 1, 'i'), 6) - get only the desired substring (... from "bond(...)"). Oracle10g doesn't support subexpressions so we have to make do with common substr to cut "bond("
Finally, get Nth "none-comma" sequence from the parsed string

Query works on database A but not on B

I'v got the following query:
SELECT
nr
, txt = info.result
FROM
dbo.anlagen AS a
CROSS APPLY
ocAuxiliary.splitString(
ISNULL(
ocAuxiliary.parseRTF(a.notiz)
,'')
,80)
AS info
which works fine on on database, but not on another. The functions / SPROCS are created by code and therefore deterministic.
Error on B is:
Meldung 102, Ebene 15, Status 1, Zeile 9
Falsche Syntax in der Nähe von '.'.
( Wrong Syntax near '.'.)
Just calling the used functions/SPROCS works fine also:
On DB A
SELECT * from ocAuxiliary.splitString('1234567890', 3)
returns
iteration result
1 123
2 456
3 789
4 0
as it does on DB B.
On DB A
select ocAuxiliary.parseRTF('{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\lang1031\fs20 12 ')
returns 12
as it does on DB B.
I simply don't see the mistake.

SQL Server 2005: Arithmetic overflow error converting int to data type numeric

I have to filter a column called [Order] (data type = decimal(3,1)) in my final view for 1.0.
List of unique values for [Order] are:
1.0
2.0
3.0
4.0
5.0
7.0
8.0
9.0
11.0
12.0
13.0
My SQL Statement is as follows:
SELECT
[Order]
FROM
[dbo].[vwCoreData_AllOtherCats]
WHERE
[MEDate] = '2/29/2008'
and [Order] = 1
-- and [Order] = 1.0
-- and [Order] = cast(1 as decimal(3,1))
-- and [Order] = cast(1.0 as decimal(3,1))
The commented-out lines shows the different methods I've tried. All 4 ways results in the same error message:
Msg 8115, Level 16, State 8, Line 1
Arithmetic overflow error int to data type numeric
Anyone know what is going on here?
Thanks for any help anyone can provide,
CTB