You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by ev...@apache.org on 2017/07/21 20:21:20 UTC
[21/50] [abbrv] incubator-spot git commit: Removing double quotes
from DNS Edge
Removing double quotes from DNS Edge
Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/9d0b0917
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/9d0b0917
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/9d0b0917
Branch: refs/heads/master
Commit: 9d0b0917c694231039dc4018edd81e2acce6296b
Parents: a9b66c4
Author: Moy Valdovinos <mo...@gmail.com>
Authored: Tue Jul 4 00:15:04 2017 -0500
Committer: LedaLima <ga...@intel.com>
Committed: Tue Jul 4 18:55:44 2017 -0500
----------------------------------------------------------------------
spot-setup/migration/migrate_old_dns_data.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/9d0b0917/spot-setup/migration/migrate_old_dns_data.py
----------------------------------------------------------------------
diff --git a/spot-setup/migration/migrate_old_dns_data.py b/spot-setup/migration/migrate_old_dns_data.py
index 15c8741..1c903de 100755
--- a/spot-setup/migration/migrate_old_dns_data.py
+++ b/spot-setup/migration/migrate_old_dns_data.py
@@ -162,14 +162,21 @@ def main():
mn = int(parts[-1])
log.info("Processing File: {0} with HH: {1} and MN: {2}".format(file, hh, mn))
- filename = '{0}/{1}'.format(full_day_path, file)
+
+ log.info("Removing double quotes File: {0}".format(file))
+ fixed_file = '{0}.fixed'.format(file)
+ sed_cmd = "sed 's/\"//g' {0}/{1} > {0}/{2}".format(full_day_path, file, fixed_file)
+ util.execute_cmd(sed_cmd, log)
+ filename = '{0}/{1}'.format(full_day_path, fixed_file)
load_cmd = "LOAD DATA LOCAL INPATH '{0}' OVERWRITE INTO TABLE {1}.{2};".format(filename, staging_db, staging_table_name)
util.execute_hive_cmd(load_cmd, log)
- insert_cmd = "INSERT INTO {0}.{1} PARTITION (y={2}, m={3}, d={4}) SELECT unix_timestamp(regexp_replace(frame_time, '\"', ''), 'MMMMM dd yyyy H:mm:ss.SSS z'), frame_len, ip_dst, ip_src, dns_qry_name, '', '0', '0', dns_a, {5}, dns_qry_class, dns_qry_type, dns_qry_rcode, '0' FROM {6}.{7};".format(dest_db, dest_table_name, dt.year, dt.month, dt.day, hh, staging_db, staging_table_name)
+ insert_cmd = "INSERT INTO {0}.{1} PARTITION (y={2}, m={3}, d={4}) SELECT unix_timestamp(frame_time, 'MMMMM dd yyyy H:mm:ss.SSS z'), frame_len, ip_dst, ip_src, dns_qry_name, '', '0', '0', dns_a, {5}, dns_qry_class, dns_qry_type, dns_qry_rcode, '0' FROM {6}.{7};".format(dest_db, dest_table_name, dt.year, dt.month, dt.day, hh, staging_db, staging_table_name)
util.execute_hive_cmd(insert_cmd, log)
+ os.remove(filename)
+
##dns_storyboard
log.info("Processing Dns Storyboard")