for (Type type : typeManager.getTypes()) { if (type.isComparable()) { if (!functions.canResolveOperator(HASH_CODE, BIGINT, ImmutableList.of(type))) {
for (Type type : typeManager.getTypes()) { if (type.isComparable()) { if (!functions.canResolveOperator(HASH_CODE, BIGINT, ImmutableList.of(type))) {
private static List<Type> getTypes() { List<Type> simpleTypes = METADATA.getTypeManager().getTypes(); return new ImmutableList.Builder<Type>() .addAll(simpleTypes) .add(VARCHAR) .add(DecimalType.createDecimalType(1)) .add(RowType.anonymous(ImmutableList.of(BIGINT, VARCHAR, DOUBLE))) .build(); }
private static List<Type> getTypes() { List<Type> simpleTypes = METADATA.getTypeManager().getTypes(); return new ImmutableList.Builder<Type>() .addAll(simpleTypes) .add(VARCHAR) .add(DecimalType.createDecimalType(1)) .add(RowType.anonymous(ImmutableList.of(BIGINT, VARCHAR, DOUBLE))) .build(); }
@Override public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession connectorSession, TupleDomain<Integer> constraint) { Builder table = InMemoryRecordSet.builder(METADATA); for (Type type : typeManager.getTypes()) { addTypeRow(table, type); } addParametricTypeRows(table, typeManager.getParametricTypes()); return table.build().cursor(); }
private Set<Type> getStandardPrimitiveTypes() { ImmutableSet.Builder<Type> builder = ImmutableSet.builder(); // add unparametrized types builder.addAll(typeRegistry.getTypes()); // add corner cases for parametrized types builder.add(createDecimalType(1, 0)); builder.add(createDecimalType(17, 0)); builder.add(createDecimalType(38, 0)); builder.add(createDecimalType(17, 17)); builder.add(createDecimalType(38, 38)); builder.add(createVarcharType(0)); builder.add(createUnboundedVarcharType()); builder.add(createCharType(0)); builder.add(createCharType(42)); return builder.build(); }
@Override public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession connectorSession, TupleDomain<Integer> constraint) { Builder table = InMemoryRecordSet.builder(METADATA); for (Type type : typeManager.getTypes()) { addTypeRow(table, type); } addParametricTypeRows(table, typeManager.getParametricTypes()); return table.build().cursor(); }
@Test public void testAllRegistered() { Set<Type> allTypes = metadata.getTypeManager().getTypes().stream().collect(toImmutableSet()); for (Type valueType : allTypes) { assertNotNull(metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature("arbitrary", AGGREGATE, valueType.getTypeSignature(), valueType.getTypeSignature()))); } }
private Set<Type> getStandardPrimitiveTypes() { ImmutableSet.Builder<Type> builder = ImmutableSet.builder(); // add unparametrized types builder.addAll(typeRegistry.getTypes()); // add corner cases for parametrized types builder.add(createDecimalType(1, 0)); builder.add(createDecimalType(17, 0)); builder.add(createDecimalType(38, 0)); builder.add(createDecimalType(17, 17)); builder.add(createDecimalType(38, 38)); builder.add(createVarcharType(0)); builder.add(createUnboundedVarcharType()); builder.add(createCharType(0)); builder.add(createCharType(42)); return builder.build(); }
@Test public void testAllRegistered() { Set<Type> allTypes = metadata.getTypeManager().getTypes().stream().collect(toImmutableSet()); for (Type valueType : allTypes) { assertNotNull(metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature("arbitrary", AGGREGATE, valueType.getTypeSignature(), valueType.getTypeSignature()))); } }
@Test public void testOperatorsImplemented() { for (Type type : typeRegistry.getTypes()) { if (type.isComparable()) { functionRegistry.resolveOperator(EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(NOT_EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(IS_DISTINCT_FROM, ImmutableList.of(type, type)); functionRegistry.resolveOperator(HASH_CODE, ImmutableList.of(type)); } if (type.isOrderable()) { functionRegistry.resolveOperator(LESS_THAN, ImmutableList.of(type, type)); functionRegistry.resolveOperator(LESS_THAN_OR_EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(GREATER_THAN_OR_EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(GREATER_THAN, ImmutableList.of(type, type)); } } }
@Test public void testOperatorsImplemented() { for (Type type : typeRegistry.getTypes()) { if (type.isComparable()) { functionRegistry.resolveOperator(EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(NOT_EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(IS_DISTINCT_FROM, ImmutableList.of(type, type)); functionRegistry.resolveOperator(HASH_CODE, ImmutableList.of(type)); } if (type.isOrderable()) { functionRegistry.resolveOperator(LESS_THAN, ImmutableList.of(type, type)); functionRegistry.resolveOperator(LESS_THAN_OR_EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(GREATER_THAN_OR_EQUAL, ImmutableList.of(type, type)); functionRegistry.resolveOperator(GREATER_THAN, ImmutableList.of(type, type)); } } }