Opened 5 years ago
Closed 5 years ago
#2170 closed defect (fixed)
Problem in induced complex constructor
Reported by: | Dimitar Misev | Owned by: | apercov |
---|---|---|---|
Priority: | minor | Milestone: | 10.0 |
Component: | qlparser | Version: | 9.8 |
Keywords: | Cc: | ||
Complexity: | Medium |
Description
This query works as expected:
rasql -q 'select encode(complex(a[80:90,80:90], 13c), "csv") from test_grey as a' --out string
But this does not anymore so should be fixed:
rasql -q 'select encode(complex(13c, a[80:90,80:90]), "csv") from test_grey as a' --out string
Both should be added to systemtest.
Attachments (1)
Change History (19)
comment:1 by , 5 years ago
comment:3 by , 5 years ago
Some more:
SELECT complex(-4888567l, 0ul) result (-4888567,4888567) SELECT complex(4888567ul, 0) result (32729,0) SELECT complex(4888567ul, 0ul) result (32729,32729) SELECT complex(4888567ul, 0) result (32729,0)
comment:4 by , 5 years ago
another weird case:
rasql -q 'SELECT avg_cells(complex((short)a, 1s)) FROM test_grey AS a' --out string Result element 1: (-0.201625,-0.21327)
comment:5 by , 5 years ago
Status: | new → accepted |
---|
comment:6 by , 5 years ago
Fixed:
SELECT complex(-4888567l, 0ul) result (-4888567,4888567) SELECT complex(4888567ul, 0) result (32729,0) SELECT complex(4888567ul, 0ul) result (32729,32729) SELECT complex(4888567ul, 0) result (32729,0) SELECT complex(-151s, 0us) SELECT complex(151us, 0us)
by , 5 years ago
Attachment: | 0001-ticket-2170-fixed-wrong-behaviour-of-complex-numbers.patch added |
---|
Patch fixing some of the mentioned problems. (See the comments for the list of fixed queries)
comment:8 by , 5 years ago
Replying to dmisev:
Was this patch applied?
Yes, the patch attached to this ticket is submitted and applied. However, the ticket still contains some unresolved problems.
comment:10 by , 5 years ago
Replying to dmisev:
Can you summarize which queries still fail?
rasql -q 'SELECT avg_cells(complex((short)a, 1s)) FROM test_grey AS a' --out string
rasql -q 'select encode(complex(13c, a[80:90,80:90]), "csv") from test_grey as a' --out string
comment:12 by , 5 years ago
Replying to dmisev:
Do they throw some error, can you post the output?
rasql -q 'SELECT avg_cells(complex((short)a, 1s)) FROM test_grey AS a' --out string Result element 1: (-0.201625,-0.21327)
rasql -q 'select encode(complex(13c, a[80:90,80:90]), "csv") from test_grey as a' --out string Executing retrieval query... rasdaman error 300: Parsing error 300 in line 1, column 28: Unexpected name a.
follow-up: 14 comment:13 by , 5 years ago
Does this work?
rasql -q 'select encode(complex(marray i in [80:90,80:90] values 13c, a[80:90,80:90]), "csv") from test_grey as a' --out string
this one should probably throw the same error (rasdaman error 300: Parsing error 300 in line 1, column 28: Unexpected name a.)
rasql -q 'SELECT avg_cells(complex((short)a, 1s)) FROM test_grey AS a' --out string
comment:14 by , 5 years ago
Replying to dmisev:
Does this work?
rasql -q 'select encode(complex(marray i in [80:90,80:90] values 13c, a[80:90,80:90]), "csv") from test_grey as a' --out stringthis one should probably throw the same error (rasdaman error 300: Parsing error 300 in line 1, column 28: Unexpected name a.)
rasql -q 'SELECT avg_cells(complex((short)a, 1s)) FROM test_grey AS a' --out string
First query works.
Regarding the second query the problem is different. The a is recognized, but the imaginary parts of elements are not created properly, and avg_cells doesn't work as it should in that case. If we want to throw the error (other option is to wait on fix), then I think it should be some different error. For example: avg_cells received unsupported type of argument.
comment:15 by , 5 years ago
Upon further investigation, I found out that the problem lays in the usage of short in the query. The collection is too big, for its sum to be stored in the short. Therefore, the sum wraps itself around short and becomes very small. This behavior is unique to the complex types.
comment:16 by , 5 years ago
Possible solution for this problem is to enforce the condense op to use CInt32 for storing the result of the sum.
comment:17 by , 5 years ago
Query
rasql -q 'SELECT avg_cells(complex((short)a, 1s)) FROM test_grey AS a' --out string
is fixed.
comment:18 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Ok so I think we can close this ticket.
Further problem:
Results in
(-151,151)