[jira] [Created] (CALCITE-3504) allow empty ARRAY[] literals

2019-11-14 Thread Pressenna (Jira)
Pressenna created CALCITE-3504:
--

 Summary: allow empty ARRAY[] literals
 Key: CALCITE-3504
 URL: https://issues.apache.org/jira/browse/CALCITE-3504
 Project: Calcite
  Issue Type: Wish
Affects Versions: 1.21.0
Reporter: Pressenna


Currently an ARRAY expression requires at least one element.
Please allow empty ARRAY expressions.

{code:sql}
SELECT ARRAY[] FROM foo;

-- or more concise for updates:

UPDATE food set array_column = ARRAY[];
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (CALCITE-3230) Explicit CASTs by user are not applied.

2019-08-06 Thread Pressenna (JIRA)
Pressenna created CALCITE-3230:
--

 Summary: Explicit CASTs by user are not applied.
 Key: CALCITE-3230
 URL: https://issues.apache.org/jira/browse/CALCITE-3230
 Project: Calcite
  Issue Type: Bug
  Components: core
 Environment: For some reason casting is not working correctly with 
aggregate functions.

for example:
{code:java}
SELECT CAST(AVG(double_column) AS float) FROM foo GROUP BY group_coulmn;
{code}
does not apply the cast. We currently have to circumvent this by using 
following dummy construct.
{code:java}
SELECT CAST( (AVG(double_column) + 0.0) AS float) FROM foo GROUP BY 
group_coulmn;
{code}
 
Reporter: Pressenna






--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Created] (CALCITE-3219) allow finer control over which expressions get expanded in SqlToRelConverter

2019-07-29 Thread Pressenna (JIRA)
Pressenna created CALCITE-3219:
--

 Summary: allow finer control over which expressions get expanded 
in SqlToRelConverter
 Key: CALCITE-3219
 URL: https://issues.apache.org/jira/browse/CALCITE-3219
 Project: Calcite
  Issue Type: Improvement
Reporter: Pressenna


Currently one can control if sub-query expansion happens via 
SqlToRelConverter.Config.isExpand(). This flag is global to the query and 
causes expansion of all supported expression types. For some systems it is 
required that one can dynamically narrow the set of expressions that should be 
expanded.

In order to allow this, I would propose a new setter with a default 
implementation that returns the above flag.

{code}
// a BiPredicate in order to pass both the original query and the expression in 
question for expansion
java.util.function.BiPredicate 
SqlToRelConverter.Config.getExpandPredicate()
{code}


If this is OK, I would provide a PR with the relevant changes.




--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Created] (CALCITE-3186) IN expressions in UPDATE statements throwing Exceptions

2019-07-09 Thread Pressenna (JIRA)
Pressenna created CALCITE-3186:
--

 Summary: IN expressions in UPDATE statements throwing Exceptions
 Key: CALCITE-3186
 URL: https://issues.apache.org/jira/browse/CALCITE-3186
 Project: Calcite
  Issue Type: Bug
Affects Versions: 1.20.0
Reporter: Pressenna


The patch to get correlated sub-queries working in UPDATE statements had this 
side-effect.

 
{code:java}
CREATE TABLE t1 (id1 INT, val1 TEXT);
CREATE TABLE t2 (id2 INT, val2 TEXT);

UPDATE t1 SET val1 = 't2' WHERE id1 IN (1, 2, 3);

-- or

UPDATE t1 SET val1 = 't2' WHERE id1 IN (SELECT id2 FROM t2);{code}
 

These seem to raise exceptions now.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CALCITE-2978) sorting not applied in subqueries

2019-04-03 Thread Pressenna (JIRA)
Pressenna created CALCITE-2978:
--

 Summary: sorting not applied in subqueries
 Key: CALCITE-2978
 URL: https://issues.apache.org/jira/browse/CALCITE-2978
 Project: Calcite
  Issue Type: Bug
Affects Versions: 1.19.0
Reporter: Pressenna


{code:sql}
CREATE TABLE test (id INT, val INT);
INSERT INTO test VALUES (1,1);
INSERT INTO test VALUES (2,2);
INSERT INTO test VALUES (3,3);
INSERT INTO test VALUES (4,4);


SELECT id FROM (SELECT id, val FROM test ORDER BY val DESC);
 {code}

Looks like CALCITE-2798 removes the sorting in sub-queries too aggressively.
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CALCITE-2427) Subqueries not supported in DML statements

2018-07-24 Thread Pressenna (JIRA)
Pressenna created CALCITE-2427:
--

 Summary: Subqueries not supported in DML statements
 Key: CALCITE-2427
 URL: https://issues.apache.org/jira/browse/CALCITE-2427
 Project: Calcite
  Issue Type: Bug
  Components: core
Reporter: Pressenna
Assignee: Julian Hyde


It appears that subqueries are not supported in DML statements.
The yield in a NPE.

Respective 
[testcase|https://github.com/apache/calcite/blob/be3048300e140c5e9e5b4d23c0b27accd0af4c4d/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java#L1986]
 is disabled with reference to CALCITE-1527.

{code:java}
@Ignore("CALCITE-1527")
@Test public void testUpdateSubQuery() {
final String sql = "update emp\n"
+ "set empno = (\n"
+ " select min(empno) from emp as e where e.deptno = emp.deptno)";
sql(sql).ok();
}
{code}
 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CALCITE-2416) Assertion error when determining monotonicity

2018-07-16 Thread Pressenna (JIRA)
Pressenna created CALCITE-2416:
--

 Summary: Assertion error when determining monotonicity
 Key: CALCITE-2416
 URL: https://issues.apache.org/jira/browse/CALCITE-2416
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.16.0, 1.15.0, 1.17.0
Reporter: Pressenna
Assignee: Julian Hyde


{code:java}
CREATE TABLE test ( x integer, y integer);

SELECT 2 * 2 * x FROM test;{code}
 

Causes:

Exception in thread "main" java.lang.AssertionError: Internal error: invalid 
literal: 2 * 2

 

Re-raising CALCITE-1504 which was fixed via CALCITE-1486



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)