for (Column column: tableDesc.getLogicalSchema().getColumns()) {
if (column.getSimpleName().matches(regcolumnNamePattern)) {
MetaDataTuple tuple = new MetaDataTuple(22);
int index = 0;
tuple.put(index++, new TextDatum(databaseName)); // TABLE_CAT
tuple.put(index++, new TextDatum(DEFAULT_SCHEMA_NAME)); // TABLE_SCHEM
tuple.put(index++, new TextDatum(table)); // TABLE_NAME
tuple.put(index++, new TextDatum(column.getSimpleName())); // COLUMN_NAME
// TODO - DATA_TYPE
tuple.put(index++, new TextDatum("" + ResultSetUtil.tajoTypeToSqlType(column.getDataType())));
tuple.put(index++, new TextDatum(ResultSetUtil.toSqlType(column.getDataType()))); //TYPE_NAME
tuple.put(index++, new TextDatum("0")); // COLUMN_SIZE
tuple.put(index++, new TextDatum("0")); // BUFFER_LENGTH
tuple.put(index++, new TextDatum("0")); // DECIMAL_DIGITS
tuple.put(index++, new TextDatum("0")); // NUM_PREC_RADIX
tuple.put(index++, new TextDatum("" + DatabaseMetaData.columnNullable)); // NULLABLE
tuple.put(index++, NullDatum.get()); // REMARKS
tuple.put(index++, NullDatum.get()); // COLUMN_DEF
tuple.put(index++, NullDatum.get()); // SQL_DATA_TYPE
tuple.put(index++, NullDatum.get()); // SQL_DATETIME_SUB
tuple.put(index++, new TextDatum("0")); // CHAR_OCTET_LENGTH
tuple.put(index++, new TextDatum("" + pos)); // ORDINAL_POSITION
tuple.put(index++, new TextDatum("YES")); // IS_NULLABLE
tuple.put(index++, NullDatum.get()); // SCOPE_CATLOG
tuple.put(index++, NullDatum.get()); // SCOPE_SCHEMA
tuple.put(index++, NullDatum.get()); // SCOPE_TABLE
tuple.put(index++, new TextDatum("0")); // SOURCE_DATA_TYPE
columns.add(tuple);
}
pos++;
}
}