From b05d957ae2702632d8fab07ab0a46f7d72806d2d Mon Sep 17 00:00:00 2001 From: "jackdaw@loafle.com" Date: Tue, 25 Apr 2017 17:37:48 +0900 Subject: [PATCH 1/4] result set --- .../com/loafle/overflow/crawler/result/OFResultSetRow.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java index ccd5da5..63407b7 100644 --- a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java +++ b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java @@ -88,7 +88,8 @@ public class OFResultSetRow extends OFResultSet{ for (int i =0 ; i< arrayColumns.size() ; ++i) { // replace String k = "$" + i; - metric = metric.replace(k,data.get(this.meta.get(arrayColumns.get(i)))); + String replaceString = data.get(this.meta.get(arrayColumns.get(i))); + metric = metric.replace(k,"'" + replaceString + "'"); } return metric; From d25a2ee843e6c9d9c2401415a69373c879996c61 Mon Sep 17 00:00:00 2001 From: "jackdaw@loafle.com" Date: Tue, 25 Apr 2017 17:41:22 +0900 Subject: [PATCH 2/4] result set --- .../com/loafle/overflow/crawler/result/OFResultSetRow.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java index 63407b7..64d5602 100644 --- a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java +++ b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java @@ -88,7 +88,8 @@ public class OFResultSetRow extends OFResultSet{ for (int i =0 ; i< arrayColumns.size() ; ++i) { // replace String k = "$" + i; - String replaceString = data.get(this.meta.get(arrayColumns.get(i))); + int dataIndex = this.meta.get(arrayColumns.get(i); + String replaceString = data.get(dataIndex); metric = metric.replace(k,"'" + replaceString + "'"); } From ed29ad0ef1760f6cdb50548ce0b9f8415584832a Mon Sep 17 00:00:00 2001 From: "jackdaw@loafle.com" Date: Tue, 25 Apr 2017 17:42:54 +0900 Subject: [PATCH 3/4] result set --- .../java/com/loafle/overflow/crawler/result/OFResultSetRow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java index 64d5602..b0ade53 100644 --- a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java +++ b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java @@ -88,7 +88,7 @@ public class OFResultSetRow extends OFResultSet{ for (int i =0 ; i< arrayColumns.size() ; ++i) { // replace String k = "$" + i; - int dataIndex = this.meta.get(arrayColumns.get(i); + int dataIndex = this.meta.get(arrayColumns.get(i)); String replaceString = data.get(dataIndex); metric = metric.replace(k,"'" + replaceString + "'"); } From 10cc52f0f1e8b6bcb3c006e6f6fa1b8718044ed8 Mon Sep 17 00:00:00 2001 From: "jackdaw@loafle.com" Date: Tue, 25 Apr 2017 18:20:50 +0900 Subject: [PATCH 4/4] result set --- .../crawler/result/OFResultSetRow.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java index b0ade53..602d0b6 100644 --- a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java +++ b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java @@ -25,14 +25,20 @@ public class OFResultSetRow extends OFResultSet{ List arrayColumns = (List) this.item.getQuery().getQueryInfo().get("arrayColumns"); List keyColumns = (List) this.item.getQuery().getQueryInfo().get("keyColumns"); String valueColumn = (String) this.item.getQuery().getQueryInfo().get("valueColumn"); + if (arrayColumns != null) { + for (String c : arrayColumns) { + meta.add(c); + } + } - for (String c : arrayColumns) { - meta.add(c); + if (keyColumns != null) { + for (String c: keyColumns) { + meta.add(c); + } } - for (String c: keyColumns) { - meta.add(c); - } - meta.add(valueColumn); + + if (valueColumn != null && !valueColumn.equals("")) + meta.add(valueColumn); if(this.meta == null) { this.meta = new HashMap<>(); @@ -62,12 +68,13 @@ public class OFResultSetRow extends OFResultSet{ Query query = this.item.getQuery(); List metrics = this.item.getMetrics(); + // 동적 키인지 일반 키들인지 체크해야함 // 일단은 동적 키적용 + String metricsType = (String) query.getQueryInfo().get("metricsType"); + List arrayColumns = (List) this.item.getQuery().getQueryInfo().get("arrayColumns"); List keyColumns = (List) this.item.getQuery().getQueryInfo().get("keyColumns"); List keys = query.getKeys(); - // 동적 키인지 일반 키들인지 체크해야함 // 일단은 동적 키적용 - String metricsType = (String) query.getQueryInfo().get("metricsType"); boolean find = false; int findIndex = -1; @@ -94,6 +101,6 @@ public class OFResultSetRow extends OFResultSet{ } return metric; - } + }