[jira] [Updated] (CALCITE-2659) Wrong plan In natural left/right join

2018-11-07 Thread yuqi (JIRA)


 [ 
https://issues.apache.org/jira/browse/CALCITE-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yuqi updated CALCITE-2659:
--
Description: 
The following is the code:


{code:java}
public static void main(String[] args) {
try {
SchemaPlus rootSchema = 
Frameworks.createRootSchema(true);

rootSchema.add("TABLE_RESULT", new AbstractTable() {
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t7 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BOOLEAN),
 true);
RelDataType t8 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DATE),
 true);
RelDataType t9 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIME),
 true);
RelDataType t10 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
 true);
RelDataType t11 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.VARCHAR),
 true);


builder.add("ID", t0);
builder.add("byte_test".toUpperCase(), 
t1);
builder.add("short_test".toUpperCase(), 
t2);
builder.add("int_test".toUpperCase(), 
t3);
builder.add("float_test".toUpperCase(), 
t4);

builder.add("double_test".toUpperCase(), t5);
builder.add("long_test".toUpperCase(), 
t6);

builder.add("boolean_test".toUpperCase(), t7);
builder.add("date_test".toUpperCase(), 
t8);
builder.add("time_test".toUpperCase(), 
t9);

builder.add("timestamp_test".toUpperCase(), t10);

builder.add("string_test".toUpperCase(), t11);

return builder.build();
}
});


rootSchema.add("TABLE_RESULT_COPY", new AbstractTable() 
{
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 

[jira] [Updated] (CALCITE-2659) Wrong plan In natural left/right join

2018-11-07 Thread yuqi (JIRA)


 [ 
https://issues.apache.org/jira/browse/CALCITE-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yuqi updated CALCITE-2659:
--
Description: 
The following is the code:


{code:java}
public static void main(String[] args) {
try {
SchemaPlus rootSchema = 
Frameworks.createRootSchema(true);

rootSchema.add("TABLE_RESULT", new AbstractTable() {
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t7 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BOOLEAN),
 true);
RelDataType t8 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DATE),
 true);
RelDataType t9 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIME),
 true);
RelDataType t10 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
 true);
RelDataType t11 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.VARCHAR),
 true);


builder.add("ID", t0);
builder.add("byte_test".toUpperCase(), 
t1);
builder.add("short_test".toUpperCase(), 
t2);
builder.add("int_test".toUpperCase(), 
t3);
builder.add("float_test".toUpperCase(), 
t4);

builder.add("double_test".toUpperCase(), t5);
builder.add("long_test".toUpperCase(), 
t6);

builder.add("boolean_test".toUpperCase(), t7);
builder.add("date_test".toUpperCase(), 
t8);
builder.add("time_test".toUpperCase(), 
t9);

builder.add("timestamp_test".toUpperCase(), t10);

builder.add("string_test".toUpperCase(), t11);

return builder.build();
}
});


rootSchema.add("TABLE_RESULT_COPY", new AbstractTable() 
{
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 

[jira] [Updated] (CALCITE-2659) Wrong plan In natural left/right join

2018-11-07 Thread yuqi (JIRA)


 [ 
https://issues.apache.org/jira/browse/CALCITE-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yuqi updated CALCITE-2659:
--
Description: 
The following is the code:


{code:java}
public static void main(String[] args) {
try {
SchemaPlus rootSchema = 
Frameworks.createRootSchema(true);

rootSchema.add("TABLE_RESULT", new AbstractTable() {
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t7 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BOOLEAN),
 true);
RelDataType t8 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DATE),
 true);
RelDataType t9 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIME),
 true);
RelDataType t10 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
 true);
RelDataType t11 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.VARCHAR),
 true);


builder.add("ID", t0);
builder.add("byte_test".toUpperCase(), 
t1);
builder.add("short_test".toUpperCase(), 
t2);
builder.add("int_test".toUpperCase(), 
t3);
builder.add("float_test".toUpperCase(), 
t4);

builder.add("double_test".toUpperCase(), t5);
builder.add("long_test".toUpperCase(), 
t6);

builder.add("boolean_test".toUpperCase(), t7);
builder.add("date_test".toUpperCase(), 
t8);
builder.add("time_test".toUpperCase(), 
t9);

builder.add("timestamp_test".toUpperCase(), t10);

builder.add("string_test".toUpperCase(), t11);

return builder.build();
}
});


rootSchema.add("TABLE_RESULT_COPY", new AbstractTable() 
{
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 

[jira] [Updated] (CALCITE-2659) Wrong plan In natural left/right join

2018-11-07 Thread yuqi (JIRA)


 [ 
https://issues.apache.org/jira/browse/CALCITE-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yuqi updated CALCITE-2659:
--
Description: 
The following is the code:


{code:java}
public static void main(String[] args) {
try {
SchemaPlus rootSchema = 
Frameworks.createRootSchema(true);

rootSchema.add("TABLE_RESULT", new AbstractTable() {
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t7 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BOOLEAN),
 true);
RelDataType t8 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DATE),
 true);
RelDataType t9 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIME),
 true);
RelDataType t10 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
 true);
RelDataType t11 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.VARCHAR),
 true);


builder.add("ID", t0);
builder.add("byte_test".toUpperCase(), 
t1);
builder.add("short_test".toUpperCase(), 
t2);
builder.add("int_test".toUpperCase(), 
t3);
builder.add("float_test".toUpperCase(), 
t4);

builder.add("double_test".toUpperCase(), t5);
builder.add("long_test".toUpperCase(), 
t6);

builder.add("boolean_test".toUpperCase(), t7);
builder.add("date_test".toUpperCase(), 
t8);
builder.add("time_test".toUpperCase(), 
t9);

builder.add("timestamp_test".toUpperCase(), t10);

builder.add("string_test".toUpperCase(), t11);

return builder.build();
}
});


rootSchema.add("TABLE_RESULT_COPY", new AbstractTable() 
{
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 

[jira] [Updated] (CALCITE-2659) Wrong plan In natural left/right join

2018-11-07 Thread yuqi (JIRA)


 [ 
https://issues.apache.org/jira/browse/CALCITE-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yuqi updated CALCITE-2659:
--
Description: 
The following is the code:


{code:java}
public static void main(String[] args) {
try {
SchemaPlus rootSchema = 
Frameworks.createRootSchema(true);

rootSchema.add("TABLE_RESULT", new AbstractTable() {
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t7 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BOOLEAN),
 true);
RelDataType t8 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DATE),
 true);
RelDataType t9 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIME),
 true);
RelDataType t10 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
 true);
RelDataType t11 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.VARCHAR),
 true);


builder.add("ID", t0);
builder.add("byte_test".toUpperCase(), 
t1);
builder.add("short_test".toUpperCase(), 
t2);
builder.add("int_test".toUpperCase(), 
t3);
builder.add("float_test".toUpperCase(), 
t4);

builder.add("double_test".toUpperCase(), t5);
builder.add("long_test".toUpperCase(), 
t6);

builder.add("boolean_test".toUpperCase(), t7);
builder.add("date_test".toUpperCase(), 
t8);
builder.add("time_test".toUpperCase(), 
t9);

builder.add("timestamp_test".toUpperCase(), t10);

builder.add("string_test".toUpperCase(), t11);

return builder.build();
}
});


rootSchema.add("TABLE_RESULT_COPY", new AbstractTable() 
{
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 

[jira] [Updated] (CALCITE-2659) Wrong plan In natural left/right join

2018-11-07 Thread yuqi (JIRA)


 [ 
https://issues.apache.org/jira/browse/CALCITE-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yuqi updated CALCITE-2659:
--
Description: 
public static void main(String[] args) {
try {
SchemaPlus rootSchema = 
Frameworks.createRootSchema(true);

rootSchema.add("TABLE_RESULT", new AbstractTable() {
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t7 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BOOLEAN),
 true);
RelDataType t8 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DATE),
 true);
RelDataType t9 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIME),
 true);
RelDataType t10 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
 true);
RelDataType t11 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.VARCHAR),
 true);


builder.add("ID", t0);
builder.add("byte_test".toUpperCase(), 
t1);
builder.add("short_test".toUpperCase(), 
t2);
builder.add("int_test".toUpperCase(), 
t3);
builder.add("float_test".toUpperCase(), 
t4);

builder.add("double_test".toUpperCase(), t5);
builder.add("long_test".toUpperCase(), 
t6);

builder.add("boolean_test".toUpperCase(), t7);
builder.add("date_test".toUpperCase(), 
t8);
builder.add("time_test".toUpperCase(), 
t9);

builder.add("timestamp_test".toUpperCase(), t10);

builder.add("string_test".toUpperCase(), t11);

return builder.build();
}
});


rootSchema.add("TABLE_RESULT_COPY", new AbstractTable() 
{
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
  

[jira] [Updated] (CALCITE-2659) Wrong plan In natural left/right join

2018-11-07 Thread yuqi (JIRA)


 [ 
https://issues.apache.org/jira/browse/CALCITE-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yuqi updated CALCITE-2659:
--
Environment: (was: 
{code:java}
public static void main(String[] args) {
try {
SchemaPlus rootSchema = 
Frameworks.createRootSchema(true);

rootSchema.add("TABLE_RESULT", new AbstractTable() {
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t7 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BOOLEAN),
 true);
RelDataType t8 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DATE),
 true);
RelDataType t9 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIME),
 true);
RelDataType t10 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
 true);
RelDataType t11 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.VARCHAR),
 true);


builder.add("ID", t0);
builder.add("byte_test".toUpperCase(), 
t1);
builder.add("short_test".toUpperCase(), 
t2);
builder.add("int_test".toUpperCase(), 
t3);
builder.add("float_test".toUpperCase(), 
t4);

builder.add("double_test".toUpperCase(), t5);
builder.add("long_test".toUpperCase(), 
t6);

builder.add("boolean_test".toUpperCase(), t7);
builder.add("date_test".toUpperCase(), 
t8);
builder.add("time_test".toUpperCase(), 
t9);

builder.add("timestamp_test".toUpperCase(), t10);

builder.add("string_test".toUpperCase(), t11);

return builder.build();
}
});


rootSchema.add("TABLE_RESULT_COPY", new AbstractTable() 
{
public RelDataType getRowType(final 
RelDataTypeFactory typeFactory) {
RelDataTypeFactory.FieldInfoBuilder 
builder = typeFactory.builder();

RelDataType t0 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);
RelDataType t1 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TINYINT),
 true);
RelDataType t2 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
 true);
RelDataType t3 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
 true);
RelDataType t4 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.FLOAT),
 true);
RelDataType t5 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.DOUBLE),
 true);
RelDataType t6 = 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
 true);