private static void extractColumnInfos(Table table, List<String> colNames, List<String> colTypes) { for (FieldSchema col : table.getAllCols()) { colNames.add(col.getName()); colTypes.add(col.getType()); } }
private String replaceDefaultKeywordForMerge(String valueClause, Table table, ASTNode columnListNode) throws SemanticException { if (!valueClause.toLowerCase().contains("`default`")) { return valueClause; } Map<String, String> colNameToDefaultConstraint = getColNameToDefaultValueMap(table); String[] values = valueClause.trim().split(","); String[] replacedValues = new String[values.length]; // the list of the column names may be set in the query String[] columnNames = columnListNode == null ? table.getAllCols().stream().map(f -> f.getName()).toArray(size -> new String[size]) : columnListNode.getChildren().stream().map(n -> ((ASTNode)n).toString()).toArray(size -> new String[size]); for (int i = 0; i < values.length; i++) { if (values[i].trim().toLowerCase().equals("`default`")) { replacedValues[i] = MapUtils.getString(colNameToDefaultConstraint, columnNames[i], "null"); } else { replacedValues[i] = values[i]; } } return StringUtils.join(replacedValues, ','); }
for (pkPos = 0; pkPos < parentTab.getAllCols().size(); pkPos++) { String pkColName = parentTab.getAllCols().get(pkPos).getName(); if (pkColName.equals(fkCol.parentColName)) { break; || pkPos == parentTab.getAllCols().size()) { LOG.error("Column for foreign key definition " + fkCol + " not found"); return ImmutableList.of();
/** * Variant of {@link #trimFields(RelNode, ImmutableBitSet, Set)} for * {@link org.apache.calcite.rel.logical.LogicalProject}. */ public TrimResult trimFields(Project project, ImmutableBitSet fieldsUsed, Set<RelDataTypeField> extraFields) { // set columnAccessInfo for ViewColumnAuthorization for (Ord<RexNode> ord : Ord.zip(project.getProjects())) { if (fieldsUsed.get(ord.i)) { if (this.columnAccessInfo != null && this.viewProjectToTableSchema != null && this.viewProjectToTableSchema.containsKey(project)) { Table tab = this.viewProjectToTableSchema.get(project); this.columnAccessInfo.add(tab.getCompleteName(), tab.getAllCols().get(ord.i).getName()); } } } return super.trimFields(project, fieldsUsed, extraFields); }
Set<String> constantCols = new HashSet<String>(); Table table = tableScanOp.getConf().getTableMetadata(); for (FieldSchema col : table.getAllCols()) { tableColsMapping.put(col.getName(), col.getName());
Set<String> constantCols = new HashSet<String>(); Table table = tableScanOp.getConf().getTableMetadata(); for (FieldSchema col : table.getAllCols()) { tableColsMapping.put(col.getName(), col.getName());
for (FieldSchema col : table.getAllCols()) { colNames.add(col.getName()); colTypes.add(col.getType());
tempTableObj.setFields(table.getAllCols());
List<FieldSchema> cols = t.getAllCols(); Map<String, FieldSchema> fieldSchemaMap = new HashMap<String, FieldSchema>(); for(FieldSchema col : cols) {
List<FieldSchema> cols = t.getAllCols(); Map<String, FieldSchema> fieldSchemaMap = new HashMap<String, FieldSchema>(); for(FieldSchema col : cols) {
validatePartitionValues(partSpecs); boolean sameColumns = MetaStoreUtils.compareFieldColumns( destTable.getAllCols(), sourceTable.getAllCols()); boolean samePartitions = MetaStoreUtils.compareFieldColumns( destTable.getPartitionKeys(), sourceTable.getPartitionKeys());
validatePartitionValues(partSpecs); boolean sameColumns = MetaStoreUtils.compareFieldColumns( destTable.getAllCols(), sourceTable.getAllCols()); boolean samePartitions = MetaStoreUtils.compareFieldColumns( destTable.getPartitionKeys(), sourceTable.getPartitionKeys());
if (table.isMaterializedView()) { this.createViewDesc = new CreateViewDesc(dbDotView, table.getAllCols(), } else { this.createViewDesc = new CreateViewDesc(dbDotView, table.getAllCols(),
if (table.isMaterializedView()) { this.createViewDesc = new CreateViewDesc(dbDotView, table.getAllCols(), } else { this.createViewDesc = new CreateViewDesc(dbDotView, table.getAllCols(),
private String getCreateTableString(Table table, String location){ String colString = ""; List<FieldSchema> colList = table.getAllCols(); if ( colList != null) { for (FieldSchema col : colList) { colString += col.getName() + " " + col.getType() + ","; } if (colList.size() > 0) { colString = colString.substring(0, colString.length() - 1); colString = "(" + colString + ")"; } } String query = "create external table " + table.getTableName() + colString + " location '" + location + "'"; return query; }
Hive metastoreClient = Hive.get(conf); Table tbl = (db == null) ? metastoreClient.getTable(inputTable) : metastoreClient.getTable(db, inputTable); columns = tbl.getAllCols(); columnNameToFieldSchema = new HashMap<String, FieldSchema>();
List<FieldSchema> allCols = tbl.getAllCols(); int f = 0; for (int i = 0; i < tbl.getAllCols().size(); i++) { String colName = allCols.get(i).getName(); if (features.contains(colName)) {
List<FieldSchema> oldColList = oldTable.getAllCols(); Table outputTbl = event.getOutputs().iterator().next().getTable(); outputTbl = dgiBridge.hiveClient.getTable(outputTbl.getDbName(), outputTbl.getTableName()); List<FieldSchema> newColList = outputTbl.getAllCols(); assert oldColList.size() == newColList.size();
List<FieldSchema> cols = t.getAllCols(); Map<String, FieldSchema> fieldSchemaMap = new HashMap<String, FieldSchema>(); for(FieldSchema col : cols) {
validatePartitionValues(partSpecs); boolean sameColumns = MetaStoreUtils.compareFieldColumns( destTable.getAllCols(), sourceTable.getAllCols()); boolean samePartitions = MetaStoreUtils.compareFieldColumns( destTable.getPartitionKeys(), sourceTable.getPartitionKeys());