use of com.hazelcast.sql.impl.schema.TableField in project hazelcast by hazelcast.
the class HazelcastTable method computeRowType.
private RelDataType computeRowType(List<RexNode> projects) {
List<RelDataTypeField> typeFields = new ArrayList<>(projects.size());
for (int i = 0; i < projects.size(); i++) {
RexNode project = projects.get(i);
RelDataTypeField fieldType;
if (project instanceof RexInputRef) {
TableField field = target.getField(((RexInputRef) project).getIndex());
fieldType = new RelDataTypeFieldImpl(field.getName(), i, project.getType());
if (field.isHidden()) {
hiddenFieldNames.add(field.getName());
}
} else {
fieldType = new RelDataTypeFieldImpl("EXPR$" + i, i, project.getType());
}
typeFields.add(fieldType);
}
return new RelRecordType(StructKind.PEEK_FIELDS, typeFields, false);
}
use of com.hazelcast.sql.impl.schema.TableField in project hazelcast by hazelcast.
the class FileTableTest method test_objectKeyEquality.
@Test
@Parameters(method = "keys")
@SuppressWarnings("checkstyle:ParameterNumber")
public void test_objectKeyEquality(String schema1, String name1, String field1, FileFormat<?> format1, String schema2, String name2, String field2, FileFormat<?> format2, boolean expected) {
FilePlanObjectKey k1 = new FilePlanObjectKey(schema1, name1, ImmutableList.of(new TableField(field1, QueryDataType.INT, false)), new ProcessorMetaSupplierProvider(ImmutableMap.of("key", "value"), format1));
FilePlanObjectKey k2 = new FilePlanObjectKey(schema2, name2, singletonList(new TableField(field2, QueryDataType.INT, false)), new ProcessorMetaSupplierProvider(singletonMap("key", "value"), format2));
assertThat(k1.equals(k2)).isEqualTo(expected);
assertThat(k1.hashCode() == k2.hashCode()).isEqualTo(expected);
}
Aggregations