@@ -41,14 +41,6 @@ export const getGraphDataFrame = (data: any, target: MyQuery, app: string, times
41
41
42
42
let fields = [ 'zo_sql_key' , 'zo_sql_num' ] ;
43
43
44
- // if (app !== 'explore') {
45
- // const columns = getColumnsFromQuery(target.query);
46
-
47
- // if (columns.length) {
48
- // fields = columns;
49
- // }
50
- // }
51
-
52
44
for ( let i = 0 ; i < fields . length ; i ++ ) {
53
45
if ( isTimeField ( fields [ i ] , timestampColumn ) ) {
54
46
graphData . addField ( {
@@ -111,43 +103,3 @@ export const getDefaultDataFrame = (refId: string, visualisationType: PreferredV
111
103
fields : [ ] ,
112
104
} ) ;
113
105
} ;
114
-
115
- const getColumnsFromQuery = ( query : string ) => {
116
- // Regular expression pattern to find the select column statements with optional alias
117
- let pattern = / \b s e l e c t \b ( .+ ?) \b f r o m \b / i;
118
-
119
- // Get the selected columns
120
- let match = pattern . exec ( query ) ;
121
-
122
- // If there's no select statement, return an empty list
123
- if ( ! match ) {
124
- return [ ] ;
125
- }
126
-
127
- // Split the selected columns by comma, then trim extra whitespace
128
- let selectedColumns = match [ 1 ] . split ( ',' ) . map ( function ( column ) {
129
- return column . trim ( ) ;
130
- } ) ;
131
-
132
- // Prepare array to store final column names or aliases
133
- let columnNames : any = [ ] ;
134
-
135
- // Iterate over selected columns
136
- selectedColumns . forEach ( function ( column ) {
137
- // Regular expression pattern to find alias
138
- let aliasPattern = / \s + a s \s + ( .+ ) $ / i;
139
-
140
- // Get the alias
141
- let aliasMatch = aliasPattern . exec ( column ) ;
142
-
143
- // If alias exists, use that, otherwise use column name
144
- if ( aliasMatch ) {
145
- // SQL alias may have quotes, strip those.
146
- let stripped = aliasMatch [ 1 ] . replace ( / ^ [ ' " ] | [ ' " ] $ / g, '' ) ;
147
- columnNames . push ( stripped ) ;
148
- } else {
149
- columnNames . push ( column ) ;
150
- }
151
- } ) ;
152
- return columnNames ;
153
- } ;
0 commit comments