Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Will partition restrictions be applied before other restrictions on select query?

$
0
0

In an example scenario,

 

CREATE COLUMN TABLE TEST_TABLE      

       (      

        A INTEGER NOT NULL,      

        B INTEGER NOT NULL,

        C VARCHAR(10) NULL,

        PRIMARY KEY (A, B)

       );

     

INSERT INTO TEST_TABLE(A, B, C) VALUES(1,1,'one');

INSERT INTO TEST_TABLE(A, B, C) VALUES(2,2,'1.00');

INSERT INTO TEST_TABLE(A, B, C) VALUES(3,3,'1');

 

SELECT * FROM TEST_TABLE;

 

A     B     C

1     1     one

2     2     1.00

3     3     1

 

Now i am trying to partition the non partitioned TEST_TABLE.    

 

ALTER TABLE TEST_TABLE PARTITION BY RANGE (B) (PARTITION VALUE = 1, PARTITION VALUE = 2, PARTITION VALUE = 3, PARTITION OTHERS);

 

After partitioning i am doing a select restricting to partition 3

 

SELECT * FROM TEST_TABLE WHERE TO_INTEGER(C) = 1 AND B = 3;

 

But the query fails with the following error code.

 

Could not execute 'SELECT * FROM TEST_TABLE WHERE TO_INTEGER(C) = 1 AND B = 3' in 1.053 seconds .

SAP DBTech JDBC: [339]: invalid number:  [6930] Error during optimizer search

 

In theory, partition 3 has only one row, whose C value('1') is convertible to integer. If partition restrictions applied before other restrictions this query should have worked fine. I'm not sure why this query fails. Please guide on how to make this query work.

 

Thanks,

Suren.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>