This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 0678a8b555 do not add column name separator on dowload (#14303)
0678a8b555 is described below
commit 0678a8b55588bb109ab599552caf8512e84f3565
Author: Johan Adami <[email protected]>
AuthorDate: Sun Oct 27 19:18:50 2024 -0400
do not add column name separator on dowload (#14303)
---
pinot-controller/src/main/resources/app/pages/Query.tsx | 2 +-
pinot-controller/src/main/resources/app/utils/Utils.tsx | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/pinot-controller/src/main/resources/app/pages/Query.tsx
b/pinot-controller/src/main/resources/app/pages/Query.tsx
index 349d5775be..cbb788bc8e 100644
--- a/pinot-controller/src/main/resources/app/pages/Query.tsx
+++ b/pinot-controller/src/main/resources/app/pages/Query.tsx
@@ -350,7 +350,7 @@ const QueryPage = () => {
};
const downloadData = (exportType) => {
- const data = Utils.tableFormat(resultData);
+ const data = Utils.tableFormat(resultData, false);
const fileName = 'Pinot Data Explorer';
exportFromJSON({ data, fileName, exportType });
diff --git a/pinot-controller/src/main/resources/app/utils/Utils.tsx
b/pinot-controller/src/main/resources/app/utils/Utils.tsx
index df88d50c45..bc4d836877 100644
--- a/pinot-controller/src/main/resources/app/utils/Utils.tsx
+++ b/pinot-controller/src/main/resources/app/utils/Utils.tsx
@@ -75,7 +75,7 @@ const pinotTableDetailsFromArray = (tableDetails:
Array<string | number | boolea
};
}
-const tableFormat = (data: TableData): Array<{ [key: string]: any }> => {
+const tableFormat = (data: TableData, withColumnNameSeparator: boolean =
true): Array<{ [key: string]: any }> => {
const rows = data.records;
const header = data.columns;
@@ -83,7 +83,14 @@ const tableFormat = (data: TableData): Array<{ [key:
string]: any }> => {
rows.forEach((singleRow) => {
const obj: { [key: string]: any } = {};
singleRow.forEach((val: any, index: number) => {
- obj[header[index]+app_state.columnNameSeparator+index] = val;
+ // The column name separator is added to avoid conflicts where 2 columns
+ // have the same name. But for cases where we download the raw data, we
+ // do not want the separate there.
+ if (withColumnNameSeparator) {
+ obj[header[index] + app_state.columnNameSeparator + index] = val;
+ } else {
+ obj[header[index]] = val;
+ }
});
results.push(obj);
});
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]