I have a Text like below ,
Detailed Table Information Table(tableName:a1, dbName:default, owner:eedc_hdp_s_d-itm-e, createTime:1520514151, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:columna, type:string, comment:this is first column which has comment), FieldSchema(name:columnb, type:int, comment:null)], location:hdfs://DBDP-Dev/apps/hive/warehouse/a1, inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[], parameters:{totalSize=0, rawDataSize=0, numRows=0, COLUMN_STATS_ACCURATE={"BASIC_STATS":"true"}, numFiles=0, transient_lastDdlTime=1520514151}, viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE)
from the text i need to
1) Check whether we have comment:null
2) if yes identify the parent table of the column identified by string "Table(tableName:" and a1 is tablename . Then identify the Columnname for which comemnt is null that is columnb from this string "FieldSchema(name:columnb, type:int, comment:null)"
3) Once i have both column name and tablename print
There is no comment for Column Columnname for table Tablename
as output where both Colmnname and Tablenames are values we found in step2
Can you please help to achieve this.
Note:I have a linux distribution with awk version GNU Awk 3.1.8 and using Bash shell