use of com.alibaba.datax.plugin.writer.adswriter.ads.ColumnInfo in project DataX by alibaba.
the class TableMetaHelper method createTempODPSTable.
/**
* Create temporary ODPS table.
*
* @param tableMeta table meta
* @param lifeCycle for temporary table
* @return ODPS temporary table meta
*/
public static TableMeta createTempODPSTable(TableInfo tableMeta, int lifeCycle) {
TableMeta tempTable = new TableMeta();
tempTable.setComment(tableMeta.getComments());
tempTable.setLifeCycle(lifeCycle);
String tableSchema = tableMeta.getTableSchema();
String tableName = tableMeta.getTableName();
tempTable.setTableName(generateTempTableName(tableSchema, tableName));
List<FieldSchema> tempColumns = new ArrayList<FieldSchema>();
List<ColumnInfo> columns = tableMeta.getColumns();
for (ColumnInfo column : columns) {
FieldSchema tempColumn = new FieldSchema();
tempColumn.setName(column.getName());
tempColumn.setType(toODPSDataType(column.getDataType()));
tempColumn.setComment(column.getComment());
tempColumns.add(tempColumn);
}
tempTable.setCols(tempColumns);
tempTable.setPartitionKeys(null);
return tempTable;
}
Aggregations