public static TableInput convertTable(Table table) { TableInput input = new TableInput(); input.setName(table.getTableName()); input.setOwner(table.getOwner()); input.setTableType(table.getTableType()); input.setStorageDescriptor(convertStorage(table.getStorage(), table.getDataColumns())); input.setPartitionKeys(table.getPartitionColumns().stream().map(GlueInputConverter::convertColumn).collect(toList())); input.setParameters(table.getParameters()); table.getViewOriginalText().ifPresent(input::setViewOriginalText); table.getViewExpandedText().ifPresent(input::setViewExpandedText); return input; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getOwner() == null) ? 0 : getOwner().hashCode()); hashCode = prime * hashCode + ((getLastAccessTime() == null) ? 0 : getLastAccessTime().hashCode()); hashCode = prime * hashCode + ((getLastAnalyzedTime() == null) ? 0 : getLastAnalyzedTime().hashCode()); hashCode = prime * hashCode + ((getRetention() == null) ? 0 : getRetention().hashCode()); hashCode = prime * hashCode + ((getStorageDescriptor() == null) ? 0 : getStorageDescriptor().hashCode()); hashCode = prime * hashCode + ((getPartitionKeys() == null) ? 0 : getPartitionKeys().hashCode()); hashCode = prime * hashCode + ((getViewOriginalText() == null) ? 0 : getViewOriginalText().hashCode()); hashCode = prime * hashCode + ((getViewExpandedText() == null) ? 0 : getViewExpandedText().hashCode()); hashCode = prime * hashCode + ((getTableType() == null) ? 0 : getTableType().hashCode()); hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode()); return hashCode; }
@Test public void testConvertTable() { TableInput tblInput = GlueInputConverter.convertTable(testTbl); assertEquals(tblInput.getName(), testTbl.getTableName()); assertEquals(tblInput.getOwner(), testTbl.getOwner()); assertEquals(tblInput.getTableType(), testTbl.getTableType()); assertEquals(tblInput.getParameters(), testTbl.getParameters()); assertColumnList(tblInput.getStorageDescriptor().getColumns(), testTbl.getDataColumns()); assertColumnList(tblInput.getPartitionKeys(), testTbl.getPartitionColumns()); assertStorage(tblInput.getStorageDescriptor(), testTbl.getStorage()); assertEquals(tblInput.getViewExpandedText(), testTbl.getViewExpandedText().get()); assertEquals(tblInput.getViewOriginalText(), testTbl.getViewOriginalText().get()); }
public TableInput unmarshall(JsonUnmarshallerContext context) throws Exception { TableInput tableInput = new TableInput(); if (context.testExpression("Name", targetDepth)) { context.nextToken(); tableInput.setName(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setDescription(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setOwner(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setLastAccessTime(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context)); tableInput.setLastAnalyzedTime(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context)); tableInput.setRetention(context.getUnmarshaller(Integer.class).unmarshall(context)); tableInput.setStorageDescriptor(StorageDescriptorJsonUnmarshaller.getInstance().unmarshall(context)); tableInput.setPartitionKeys(new ListUnmarshaller<Column>(ColumnJsonUnmarshaller.getInstance()).unmarshall(context)); tableInput.setViewOriginalText(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setViewExpandedText(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setTableType(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setParameters(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context.getUnmarshaller(String.class)) .unmarshall(context));
/** * <p> * Name of the table. For Hive compatibility, this is folded to lowercase when it is stored. * </p> * * @param name * Name of the table. For Hive compatibility, this is folded to lowercase when it is stored. * @return Returns a reference to this object so that method calls can be chained together. */ public TableInput withName(String name) { setName(name); return this; }
@Test public void testConvertTable() { TableInput tblInput = GlueInputConverter.convertTable(testTbl); assertEquals(tblInput.getName(), testTbl.getTableName()); assertEquals(tblInput.getOwner(), testTbl.getOwner()); assertEquals(tblInput.getTableType(), testTbl.getTableType()); assertEquals(tblInput.getParameters(), testTbl.getParameters()); assertColumnList(tblInput.getStorageDescriptor().getColumns(), testTbl.getDataColumns()); assertColumnList(tblInput.getPartitionKeys(), testTbl.getPartitionColumns()); assertStorage(tblInput.getStorageDescriptor(), testTbl.getStorage()); assertEquals(tblInput.getViewExpandedText(), testTbl.getViewExpandedText().get()); assertEquals(tblInput.getViewOriginalText(), testTbl.getViewOriginalText().get()); }
public TableInput unmarshall(JsonUnmarshallerContext context) throws Exception { TableInput tableInput = new TableInput(); if (context.testExpression("Name", targetDepth)) { context.nextToken(); tableInput.setName(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setDescription(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setOwner(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setLastAccessTime(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context)); tableInput.setLastAnalyzedTime(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context)); tableInput.setRetention(context.getUnmarshaller(Integer.class).unmarshall(context)); tableInput.setStorageDescriptor(StorageDescriptorJsonUnmarshaller.getInstance().unmarshall(context)); tableInput.setPartitionKeys(new ListUnmarshaller<Column>(ColumnJsonUnmarshaller.getInstance()).unmarshall(context)); tableInput.setViewOriginalText(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setViewExpandedText(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setTableType(context.getUnmarshaller(String.class).unmarshall(context)); tableInput.setParameters(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context.getUnmarshaller(String.class)) .unmarshall(context));
/** * <p> * Name of the table. For Hive compatibility, this is folded to lowercase when it is stored. * </p> * * @param name * Name of the table. For Hive compatibility, this is folded to lowercase when it is stored. * @return Returns a reference to this object so that method calls can be chained together. */ public TableInput withName(String name) { setName(name); return this; }
return false; TableInput other = (TableInput) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getDescription() == null ^ this.getDescription() == null) return false; if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false) return false; if (other.getOwner() == null ^ this.getOwner() == null) return false; if (other.getOwner() != null && other.getOwner().equals(this.getOwner()) == false) return false; if (other.getLastAccessTime() == null ^ this.getLastAccessTime() == null) return false; if (other.getLastAccessTime() != null && other.getLastAccessTime().equals(this.getLastAccessTime()) == false) return false; if (other.getLastAnalyzedTime() == null ^ this.getLastAnalyzedTime() == null) return false; if (other.getLastAnalyzedTime() != null && other.getLastAnalyzedTime().equals(this.getLastAnalyzedTime()) == false) return false; if (other.getRetention() == null ^ this.getRetention() == null) return false; if (other.getRetention() != null && other.getRetention().equals(this.getRetention()) == false) return false; if (other.getStorageDescriptor() == null ^ this.getStorageDescriptor() == null) return false; if (other.getStorageDescriptor() != null && other.getStorageDescriptor().equals(this.getStorageDescriptor()) == false)
@Test public void testConvertTable() { TableInput tblInput = GlueInputConverter.convertTable(testTbl); assertEquals(tblInput.getName(), testTbl.getTableName()); assertEquals(tblInput.getOwner(), testTbl.getOwner()); assertEquals(tblInput.getTableType(), testTbl.getTableType()); assertEquals(tblInput.getParameters(), testTbl.getParameters()); assertColumnList(tblInput.getStorageDescriptor().getColumns(), testTbl.getDataColumns()); assertColumnList(tblInput.getPartitionKeys(), testTbl.getPartitionColumns()); assertStorage(tblInput.getStorageDescriptor(), testTbl.getStorage()); assertEquals(tblInput.getViewExpandedText(), testTbl.getViewExpandedText().get()); assertEquals(tblInput.getViewOriginalText(), testTbl.getViewOriginalText().get()); }
public static TableInput convertTable(Table table) { TableInput input = new TableInput(); input.setName(table.getTableName()); input.setOwner(table.getOwner()); input.setTableType(table.getTableType()); input.setStorageDescriptor(convertStorage(table.getStorage(), table.getDataColumns())); input.setPartitionKeys(table.getPartitionColumns().stream().map(GlueInputConverter::convertColumn).collect(toList())); input.setParameters(table.getParameters()); table.getViewOriginalText().ifPresent(input::setViewOriginalText); table.getViewExpandedText().ifPresent(input::setViewExpandedText); return input; }
StringBuilder sb = new StringBuilder(); sb.append("{"); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getDescription() != null) sb.append("Description: ").append(getDescription()).append(","); if (getOwner() != null) sb.append("Owner: ").append(getOwner()).append(","); if (getLastAccessTime() != null) sb.append("LastAccessTime: ").append(getLastAccessTime()).append(","); if (getLastAnalyzedTime() != null) sb.append("LastAnalyzedTime: ").append(getLastAnalyzedTime()).append(","); if (getRetention() != null) sb.append("Retention: ").append(getRetention()).append(","); if (getStorageDescriptor() != null) sb.append("StorageDescriptor: ").append(getStorageDescriptor()).append(","); if (getPartitionKeys() != null) sb.append("PartitionKeys: ").append(getPartitionKeys()).append(","); if (getViewOriginalText() != null) sb.append("ViewOriginalText: ").append(getViewOriginalText()).append(","); if (getViewExpandedText() != null) sb.append("ViewExpandedText: ").append(getViewExpandedText()).append(","); if (getTableType() != null) sb.append("TableType: ").append(getTableType()).append(","); if (getParameters() != null) sb.append("Parameters: ").append(getParameters()); sb.append("}"); return sb.toString();
@Test public void testConvertTable() { TableInput tblInput = GlueInputConverter.convertTable(testTbl); assertEquals(tblInput.getName(), testTbl.getTableName()); assertEquals(tblInput.getOwner(), testTbl.getOwner()); assertEquals(tblInput.getTableType(), testTbl.getTableType()); assertEquals(tblInput.getParameters(), testTbl.getParameters()); assertColumnList(tblInput.getStorageDescriptor().getColumns(), testTbl.getDataColumns()); assertColumnList(tblInput.getPartitionKeys(), testTbl.getPartitionColumns()); assertStorage(tblInput.getStorageDescriptor(), testTbl.getStorage()); assertEquals(tblInput.getViewExpandedText(), testTbl.getViewExpandedText().get()); assertEquals(tblInput.getViewOriginalText(), testTbl.getViewOriginalText().get()); }
/** * Marshall the given parameter object. */ public void marshall(TableInput tableInput, ProtocolMarshaller protocolMarshaller) { if (tableInput == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(tableInput.getName(), NAME_BINDING); protocolMarshaller.marshall(tableInput.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(tableInput.getOwner(), OWNER_BINDING); protocolMarshaller.marshall(tableInput.getLastAccessTime(), LASTACCESSTIME_BINDING); protocolMarshaller.marshall(tableInput.getLastAnalyzedTime(), LASTANALYZEDTIME_BINDING); protocolMarshaller.marshall(tableInput.getRetention(), RETENTION_BINDING); protocolMarshaller.marshall(tableInput.getStorageDescriptor(), STORAGEDESCRIPTOR_BINDING); protocolMarshaller.marshall(tableInput.getPartitionKeys(), PARTITIONKEYS_BINDING); protocolMarshaller.marshall(tableInput.getViewOriginalText(), VIEWORIGINALTEXT_BINDING); protocolMarshaller.marshall(tableInput.getViewExpandedText(), VIEWEXPANDEDTEXT_BINDING); protocolMarshaller.marshall(tableInput.getTableType(), TABLETYPE_BINDING); protocolMarshaller.marshall(tableInput.getParameters(), PARAMETERS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getOwner() == null) ? 0 : getOwner().hashCode()); hashCode = prime * hashCode + ((getLastAccessTime() == null) ? 0 : getLastAccessTime().hashCode()); hashCode = prime * hashCode + ((getLastAnalyzedTime() == null) ? 0 : getLastAnalyzedTime().hashCode()); hashCode = prime * hashCode + ((getRetention() == null) ? 0 : getRetention().hashCode()); hashCode = prime * hashCode + ((getStorageDescriptor() == null) ? 0 : getStorageDescriptor().hashCode()); hashCode = prime * hashCode + ((getPartitionKeys() == null) ? 0 : getPartitionKeys().hashCode()); hashCode = prime * hashCode + ((getViewOriginalText() == null) ? 0 : getViewOriginalText().hashCode()); hashCode = prime * hashCode + ((getViewExpandedText() == null) ? 0 : getViewExpandedText().hashCode()); hashCode = prime * hashCode + ((getTableType() == null) ? 0 : getTableType().hashCode()); hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode()); return hashCode; }
return false; TableInput other = (TableInput) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getDescription() == null ^ this.getDescription() == null) return false; if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false) return false; if (other.getOwner() == null ^ this.getOwner() == null) return false; if (other.getOwner() != null && other.getOwner().equals(this.getOwner()) == false) return false; if (other.getLastAccessTime() == null ^ this.getLastAccessTime() == null) return false; if (other.getLastAccessTime() != null && other.getLastAccessTime().equals(this.getLastAccessTime()) == false) return false; if (other.getLastAnalyzedTime() == null ^ this.getLastAnalyzedTime() == null) return false; if (other.getLastAnalyzedTime() != null && other.getLastAnalyzedTime().equals(this.getLastAnalyzedTime()) == false) return false; if (other.getRetention() == null ^ this.getRetention() == null) return false; if (other.getRetention() != null && other.getRetention().equals(this.getRetention()) == false) return false; if (other.getStorageDescriptor() == null ^ this.getStorageDescriptor() == null) return false; if (other.getStorageDescriptor() != null && other.getStorageDescriptor().equals(this.getStorageDescriptor()) == false)
StringBuilder sb = new StringBuilder(); sb.append("{"); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getDescription() != null) sb.append("Description: ").append(getDescription()).append(","); if (getOwner() != null) sb.append("Owner: ").append(getOwner()).append(","); if (getLastAccessTime() != null) sb.append("LastAccessTime: ").append(getLastAccessTime()).append(","); if (getLastAnalyzedTime() != null) sb.append("LastAnalyzedTime: ").append(getLastAnalyzedTime()).append(","); if (getRetention() != null) sb.append("Retention: ").append(getRetention()).append(","); if (getStorageDescriptor() != null) sb.append("StorageDescriptor: ").append(getStorageDescriptor()).append(","); if (getPartitionKeys() != null) sb.append("PartitionKeys: ").append(getPartitionKeys()).append(","); if (getViewOriginalText() != null) sb.append("ViewOriginalText: ").append(getViewOriginalText()).append(","); if (getViewExpandedText() != null) sb.append("ViewExpandedText: ").append(getViewExpandedText()).append(","); if (getTableType() != null) sb.append("TableType: ").append(getTableType()).append(","); if (getParameters() != null) sb.append("Parameters: ").append(getParameters()); sb.append("}"); return sb.toString();
/** * Marshall the given parameter object. */ public void marshall(TableInput tableInput, ProtocolMarshaller protocolMarshaller) { if (tableInput == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(tableInput.getName(), NAME_BINDING); protocolMarshaller.marshall(tableInput.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(tableInput.getOwner(), OWNER_BINDING); protocolMarshaller.marshall(tableInput.getLastAccessTime(), LASTACCESSTIME_BINDING); protocolMarshaller.marshall(tableInput.getLastAnalyzedTime(), LASTANALYZEDTIME_BINDING); protocolMarshaller.marshall(tableInput.getRetention(), RETENTION_BINDING); protocolMarshaller.marshall(tableInput.getStorageDescriptor(), STORAGEDESCRIPTOR_BINDING); protocolMarshaller.marshall(tableInput.getPartitionKeys(), PARTITIONKEYS_BINDING); protocolMarshaller.marshall(tableInput.getViewOriginalText(), VIEWORIGINALTEXT_BINDING); protocolMarshaller.marshall(tableInput.getViewExpandedText(), VIEWEXPANDEDTEXT_BINDING); protocolMarshaller.marshall(tableInput.getTableType(), TABLETYPE_BINDING); protocolMarshaller.marshall(tableInput.getParameters(), PARAMETERS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }