public FunctionDesc(String name, TapDataType datatype) { TapSchema.assertNotNull(FunctionDesc.class, "name", name); TapSchema.assertNotNull(FunctionDesc.class, "datatype", datatype); this.name = name; this.datatype = datatype; }
TapSchema ret = new TapSchema(); ret.getSchemaDescs().addAll(schemaDescs); ret.getFunctionDescs().addAll(getFunctionDescs()); return ret;
/** * @param ts * @return */ private Element toXmlElement(TapSchema ts) { if (ts.getSchemaDescs().isEmpty()) throw new IllegalArgumentException("Error: at least one schema is required."); Element eleTableset = new Element("tableset", vosi); for (SchemaDesc sd : ts.getSchemaDescs()) { eleTableset.addContent(toXmlElement(sd, Namespace.NO_NAMESPACE)); } return eleTableset; }
private TapSchema toTapSchema(Document doc) { TapSchema ret = new TapSchema(); Element root = doc.getRootElement(); Namespace xsi = root.getNamespace("xsi"); if ("tableset".equals(root.getName())) { // content is element-form unqualified List<Element> sels = root.getChildren("schema"); for (Element se : sels) { String sn = se.getChildTextTrim("name"); SchemaDesc sd = new SchemaDesc(sn); List<Element> tabs = se.getChildren("table"); for (Element te : tabs) { TableDesc td = TableReader.toTable(sn, te, xsi); String tn = td.getTableName(); sd.getTableDescs().add(td); } ret.getSchemaDescs().add(sd); } } return ret; } }
/** * Find the FunctionDesc for a given Function. * * @param tapSchema * @param function * @return FunctionDesc */ public static FunctionDesc findFunctionDesc(TapSchema tapSchema, Function function) { if (function == null || function.getName() == null) return null; for (FunctionDesc functionDesc : tapSchema.getFunctionDescs()) { log.debug("check: " + function.getName() + " vs " + functionDesc.getName()); if (function.getName().equalsIgnoreCase(functionDesc.getName())) return functionDesc; } return null; }
List<SchemaDesc> schemaDescs = tapSchema.getSchemaDescs(); for (SchemaDesc schemaDesc : schemaDescs)
@Override public void visit(Function function) { log.debug("visit(function)" + function); boolean found = false; for (FunctionDesc functionDesc : tapSchema.getFunctionDescs()) { if (functionDesc.getName().equalsIgnoreCase(function.getName())) { found = true; break; } } if (!found) throw new IllegalArgumentException("Function [" + function.getName() + "] is not found in TapSchema"); selectNavigator.enterFunctionCall(function); if (function.getParameters() != null) function.getParameters().accept(this); selectNavigator.leaveFunctionCall(); }
for (SchemaDesc sd : tapSchema.getSchemaDescs())
public ColumnDesc(String tableName, String columnName, TapDataType datatype) { TapSchema.assertNotNull(TableDesc.class, "tableName", tableName); TapSchema.assertNotNull(TableDesc.class, "columnName", columnName); TapSchema.assertNotNull(TableDesc.class, "datatype", datatype); this.tableName = tableName; this.columnName = columnName; this.datatype = datatype; }
SchemaDesc tapUploadSchema = new SchemaDesc(uploadManager.getUploadSchema()); tapUploadSchema.getTableDescs().addAll(tableDescs.values()); tapSchema.getSchemaDescs().add(tapUploadSchema);
public SchemaDesc(String schemaName) { TapSchema.assertNotNull(SchemaDesc.class, "schemaName", schemaName); this.schemaName = schemaName; }
public TableDesc(String schemaName, String tableName) { TapSchema.assertNotNull(TableDesc.class, "schemaName", schemaName); TapSchema.assertNotNull(TableDesc.class, "tableName", tableName); this.schemaName = schemaName; this.tableName = tableName; }
public TapDataType(String datatype) { TapSchema.assertNotNull(TapDataType.class, "datatype", datatype); this.datatype = datatype; }
/** * A new column created by some sort of expression. This could be a function call, algebraic * expression, case statement, etc. The calling code must set any additional column * metadata. * * @param name * @param datatype */ public TapSelectItem(String name, TapDataType datatype) { TapSchema.assertNotNull(TapSelectItem.class, "name", name); TapSchema.assertNotNull(TapSelectItem.class, "datatype", datatype); this.name = name; this.datatype = datatype; }