public Set<String> getAllFieldNames() { List<FieldSchema> fields = getColumns(); Set<String> columns = new HashSet<>(fields.size()); for (FieldSchema f : fields) { columns.add(f.getName().toLowerCase()); } return columns; }
public Set<String> getAllFieldNames() { List<FieldSchema> fields = getColumns(); Set<String> columns = new HashSet<>(fields.size()); for (FieldSchema f : fields) { columns.add(f.getName().toLowerCase()); } return columns; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractCubeTable other = (AbstractCubeTable) obj; if (!this.getName().equalsIgnoreCase(other.getName())) { return false; } if (this.getColumns() == null) { if (other.getColumns() != null) { return false; } } else { if (!this.getColumns().equals(other.getColumns())) { return false; } } if (this.weight() != other.weight()) { return false; } return true; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractCubeTable other = (AbstractCubeTable) obj; if (!this.getName().equalsIgnoreCase(other.getName())) { return false; } if (this.getColumns() == null) { if (other.getColumns() != null) { return false; } } else { if (!this.getColumns().equals(other.getColumns())) { return false; } } if (this.weight() != other.weight()) { return false; } return true; }
/** * * @param table table name * @param hiveTable hive table * @param cubeTable lens cube table * @return true if columns changed in alter * @throws LensException */ private boolean alterCubeTable(String table, Table hiveTable, AbstractCubeTable cubeTable) throws LensException { hiveTable.getParameters().putAll(cubeTable.getProperties()); boolean columnsChanged = !(hiveTable.getCols().equals(cubeTable.getColumns())); if (columnsChanged) { hiveTable.getTTable().getSd().setCols(cubeTable.getColumns()); } hiveTable.getTTable().getParameters().putAll(cubeTable.getProperties()); try { getClient().alterTable(table, hiveTable, null); } catch (Exception e) { throw new LensException(e); } return columnsChanged; }
/** * * @param table table name * @param hiveTable hive table * @param cubeTable lens cube table * @return true if columns changed in alter * @throws LensException */ private boolean alterCubeTable(String table, Table hiveTable, AbstractCubeTable cubeTable) throws LensException { hiveTable.getParameters().putAll(cubeTable.getProperties()); boolean columnsChanged = !(hiveTable.getCols().equals(cubeTable.getColumns())); if (columnsChanged) { hiveTable.getTTable().getSd().setCols(cubeTable.getColumns()); } hiveTable.getTTable().getParameters().putAll(cubeTable.getProperties()); try { getClient().alterTable(table, hiveTable, null); } catch (Exception e) { throw new LensException(e); } return columnsChanged; }
private Table createCubeHiveTable(AbstractCubeTable table) throws LensException { try { Table tbl = getClient().newTable(table.getName().toLowerCase()); tbl.setTableType(TableType.MANAGED_TABLE); tbl.getTTable().getSd().setCols(table.getColumns()); tbl.getTTable().getParameters().putAll(table.getProperties()); getClient().createTable(tbl); // do get to update cache getTable(tbl.getTableName()); return tbl; } catch (Exception e) { throw new LensException("Exception creating table", e); } }
private Table createCubeHiveTable(AbstractCubeTable table) throws LensException { try { Table tbl = getClient().newTable(table.getName().toLowerCase()); tbl.setTableType(TableType.MANAGED_TABLE); tbl.getTTable().getSd().setCols(table.getColumns()); tbl.getTTable().getParameters().putAll(table.getProperties()); getClient().createTable(tbl); // do get to update cache getTable(tbl.getTableName()); return tbl; } catch (Exception e) { throw new LensException("Exception creating table", e); } }