protected RelDataTypeFactory createTypeFactory() { return new SqlTypeFactoryImpl(); }
protected RelDataTypeFactory createTypeFactory() { return new SqlTypeFactoryImpl(); }
RelProtoDataType getRelDataType(DatabaseMetaData metaData, String catalogName, String schemaName, String tableName) throws SQLException { final ResultSet resultSet = metaData.getColumns(catalogName, schemaName, tableName, null); // Temporary type factory, just for the duration of this method. Allowable // because we're creating a proto-type, not a type; before being used, the // proto-type will be copied into a real type factory. final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); final RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder(); while (resultSet.next()) { final String columnName = resultSet.getString(4); final int dataType = resultSet.getInt(5); final String typeString = resultSet.getString(6); final int size = resultSet.getInt(7); final int scale = resultSet.getInt(9); RelDataType sqlType = sqlType(typeFactory, dataType, size, scale, typeString); boolean nullable = resultSet.getBoolean(11); fieldInfo.add(columnName, sqlType).nullable(nullable); } resultSet.close(); return RelDataTypeImpl.proto(fieldInfo.build()); }
public SqlValidator getValidator() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); return SqlValidatorUtil.newValidator( opTab, new MockCatalogReader(typeFactory), typeFactory); }
static RelOptCluster newCluster(VolcanoPlanner planner) { RelOptQuery query = new RelOptQuery(planner); RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); return query.createCluster( typeFactory, new RexBuilder(typeFactory)); }
static RelOptCluster newCluster(VolcanoPlanner planner) { RelOptQuery query = new RelOptQuery(planner); RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); return query.createCluster( typeFactory, new RexBuilder(typeFactory)); }
public SqlValidator getValidator() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); return new SqlAdvisorValidator( SqlStdOperatorTable.instance(), new MockCatalogReader(typeFactory), typeFactory, conformance); }
public SqlValidator getValidator() { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); return new FeatureValidator( SqlStdOperatorTable.instance(), new MockCatalogReader(typeFactory), typeFactory, getConformance()); } }
public SqlValidator getValidator(SqlTestFactory factory) { final SqlOperatorTable operatorTable = factory.createOperatorTable(); final boolean caseSensitive = (Boolean) factory.get("caseSensitive"); final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); return SqlValidatorUtil.newValidator(operatorTable, new MockCatalogReader(typeFactory, caseSensitive).init(), typeFactory); }
@Before public void setUp() { // create some reusable fixtures RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); intType = typeFactory.createSqlType(SqlTypeName.INTEGER); intType = typeFactory.createTypeWithNullability(intType, true); stringType = typeFactory.createSqlType(SqlTypeName.VARCHAR, 20); stringType = typeFactory.createTypeWithNullability(stringType, true); rexBuilder = new RexBuilder(typeFactory); intLiteral7 = rexBuilder.makeExactLiteral( BigDecimal.valueOf(7), intType); intLiteral490 = rexBuilder.makeExactLiteral( BigDecimal.valueOf(490), intType); intLiteral8point5 = rexBuilder.makeExactLiteral( new BigDecimal("8.5"), intType); sargFactory = new SargFactory(rexBuilder); }
@Before public void setUp() { // create some reusable fixtures RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); intType = typeFactory.createSqlType(SqlTypeName.INTEGER); intType = typeFactory.createTypeWithNullability(intType, true); stringType = typeFactory.createSqlType(SqlTypeName.VARCHAR, 20); stringType = typeFactory.createTypeWithNullability(stringType, true); rexBuilder = new RexBuilder(typeFactory); intLiteral7 = rexBuilder.makeExactLiteral( BigDecimal.valueOf(7), intType); intLiteral490 = rexBuilder.makeExactLiteral( BigDecimal.valueOf(490), intType); intLiteral8point5 = rexBuilder.makeExactLiteral( new BigDecimal("8.5"), intType); sargFactory = new SargFactory(rexBuilder); }
@Override public SqlValidator getValidator( SqlTestFactory factory) { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); final SqlConformance conformance = (SqlConformance) get("conformance"); final boolean caseSensitive = (Boolean) factory.get("caseSensitive"); return new SqlAdvisorValidator( SqlStdOperatorTable.instance(), new MockCatalogReader(typeFactory, caseSensitive).init(), typeFactory, conformance); }
@Override public SqlValidator getValidator(SqlTestFactory factory) { final RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); SqlConformance conformance = (SqlConformance) get("conformance"); final boolean caseSensitive = (Boolean) get("caseSensitive"); return new FeatureValidator( factory.createOperatorTable(), new MockCatalogReader(typeFactory, caseSensitive).init(), typeFactory, conformance); } }
@Test public void testTypeDump() { RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); RelDataType t1 = typeFactory.createStructType(
@Test public void testTypeDump() { RelDataTypeFactory typeFactory = new SqlTypeFactoryImpl(); RelDataType t1 = typeFactory.builder() .add("f0", SqlTypeName.DECIMAL, 5, 2) .add("f1", SqlTypeName.VARCHAR, 10) .build(); TestUtil.assertEqualsVerbose( TestUtil.fold( "f0 DECIMAL(5, 2) NOT NULL,", "f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL"), Util.toLinux(RelOptUtil.dumpType(t1) + "\n")); RelDataType t2 = typeFactory.builder() .add("f0", t1) .add("f1", typeFactory.createMultisetType(t1, -1)) .build(); TestUtil.assertEqualsVerbose( TestUtil.fold( "f0 RECORD (", " f0 DECIMAL(5, 2) NOT NULL,", " f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL) NOT NULL,", "f1 RECORD (", " f0 DECIMAL(5, 2) NOT NULL,", " f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL) NOT NULL MULTISET NOT NULL"), Util.toLinux(RelOptUtil.dumpType(t2) + "\n")); }