alex-plekhanov commented on code in PR #13037:
URL: https://github.com/apache/ignite/pull/13037#discussion_r3131538871
##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDdlIntegrationTest.java:
##########
@@ -489,57 +489,81 @@ private void doTestAlterTableOnFlatValue(String tblName) {
}
/**
- * Test single column PK without wrapping calculate correct inline size.
+ * Test single column PK with different wrapping params calculate correct
inline size.
+ * PK index is always unwrapped if table was created via DDL.
*/
@Test
- public void testInlineSizeNoWrap() {
- try {
- sql("CREATE TABLE IF NOT EXISTS T ( " +
- " id varchar(15), " +
- " col varchar(100), " +
- " PRIMARY KEY(id) ) ");
- assertEquals(18, sql(
- "select INLINE_SIZE from SYS.INDEXES where TABLE_NAME = 'T'
and IS_PK = true").get(0).get(0));
- }
- finally {
- sql("DROP TABLE IF EXISTS T");
+ public void testInlineSizeKeyWrapParam() {
+ String query = "CREATE TABLE IF NOT EXISTS T ( " +
+ " id varchar(15), " +
+ " col varchar(100), " +
+ " PRIMARY KEY(id) ) ";
+
+ {
+ try {
+ sql(query);
Review Comment:
Block duplicated 3 times, instead let's do something like:
```
for (String ddl : F.asList(qry, qry + "WITH \"wrap_key=true\"",
qry + "WITH \"wrap_key=false\"")) {
sql(ddl);
}
```
##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDdlIntegrationTest.java:
##########
@@ -489,57 +489,81 @@ private void doTestAlterTableOnFlatValue(String tblName) {
}
/**
- * Test single column PK without wrapping calculate correct inline size.
+ * Test single column PK with different wrapping params calculate correct
inline size.
+ * PK index is always unwrapped if table was created via DDL.
*/
@Test
- public void testInlineSizeNoWrap() {
- try {
- sql("CREATE TABLE IF NOT EXISTS T ( " +
- " id varchar(15), " +
- " col varchar(100), " +
- " PRIMARY KEY(id) ) ");
- assertEquals(18, sql(
- "select INLINE_SIZE from SYS.INDEXES where TABLE_NAME = 'T'
and IS_PK = true").get(0).get(0));
- }
- finally {
- sql("DROP TABLE IF EXISTS T");
+ public void testInlineSizeKeyWrapParam() {
+ String query = "CREATE TABLE IF NOT EXISTS T ( " +
+ " id varchar(15), " +
+ " col varchar(100), " +
+ " PRIMARY KEY(id) ) ";
+
+ {
+ try {
+ sql(query);
+ assertEquals(18, sql(
+ "select INLINE_SIZE from SYS.INDEXES where TABLE_NAME =
'T' and IS_PK = true").get(0).get(0));
+ }
+ finally {
+ sql("DROP TABLE IF EXISTS T");
+ }
}
- }
- /**
- * Test single column PK with wrapping calculate correct inline size.
- */
- @Test
- public void testInlineSizeWrap() {
- try {
- sql("CREATE TABLE IF NOT EXISTS T ( " +
- " id varchar(15), " +
- " col varchar(100), " +
- " PRIMARY KEY(id) ) WITH \"wrap_key=true\"");
- assertEquals(18, sql(
- "select INLINE_SIZE from SYS.INDEXES where TABLE_NAME = 'T'
and IS_PK = true").get(0).get(0));
+ {
+ try {
+ sql(query + "WITH \"wrap_key=true\"");
+ assertEquals(18, sql(
+ "select INLINE_SIZE from SYS.INDEXES where TABLE_NAME =
'T' and IS_PK = true").get(0).get(0));
+ }
+ finally {
+ sql("DROP TABLE IF EXISTS T");
+ }
}
- finally {
- sql("DROP TABLE IF EXISTS T");
+
+ {
+ try {
+ sql(query + "WITH \"wrap_key=false\"");
+ assertEquals(18, sql(
+ "select INLINE_SIZE from SYS.INDEXES where TABLE_NAME =
'T' and IS_PK = true").get(0).get(0));
+ }
+ finally {
+ sql("DROP TABLE IF EXISTS T");
+ }
}
}
/**
- * Test two column PK with wrapping calculate correct inline size.
+ * Test two column PK with different wrapping params calculate correct
inline size.
+ * PK index is always unwrapped if table was created via DDL.
*/
@Test
- public void testInlineSizeWrapMultiPk() {
- try {
- sql("CREATE TABLE IF NOT EXISTS T ( " +
- " id varchar(15), " +
- " id2 uuid, " +
- " col varchar(100), " +
- " PRIMARY KEY(id, id2) ) WITH \"wrap_key=true\"");
- assertEquals(35, sql(
- "select INLINE_SIZE from SYS.INDEXES where TABLE_NAME = 'T'
and IS_PK = true").get(0).get(0));
+ public void testInlineSizeMultiKeyWrapParam() {
+ String query = "CREATE TABLE IF NOT EXISTS T ( " +
+ " id varchar(15), " +
+ " id2 uuid, " +
+ " col varchar(100), " +
+ " PRIMARY KEY(id, id2) )";
+ {
+ try {
+ sql(query);
Review Comment:
The same, duplication here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]