@@ -30,19 +30,6 @@ class s3select_projections
30
30
std::vector<base_statement*> m_projections;
31
31
32
32
public:
33
- bool is_aggregate ()
34
- {
35
- // TODO iterate on projections , and search for aggregate
36
- // for(auto p : m_projections){}
37
-
38
- return false ;
39
- }
40
-
41
- bool semantic ()
42
- {
43
- // TODO check aggragtion function are not nested
44
- return false ;
45
- }
46
33
47
34
std::vector<base_statement*>* get ()
48
35
{
@@ -71,7 +58,6 @@ struct actionQ
71
58
std::vector<std::string> trimTypeQ;
72
59
projection_alias alias_map;
73
60
std::string from_clause;
74
- std::vector<std::string> schema_columns;
75
61
s3select_projections projections;
76
62
77
63
uint64_t in_set_count;
@@ -80,28 +66,28 @@ struct actionQ
80
66
81
67
actionQ ():in_set_count(0 ), when_than_count(0 ){}
82
68
83
- std::map<void *,std::vector<char *> *> x_map;
69
+ std::map<const void *,std::vector<const char *> *> x_map;
84
70
85
71
~actionQ ()
86
72
{
87
73
for (auto m : x_map)
88
74
delete m.second ;
89
75
}
90
76
91
- bool is_already_scanned (void *th,char *a)
77
+ bool is_already_scanned (const void *th,const char *a)
92
78
{
93
79
// purpose: caller get indication in the case a specific builder is scan more than once the same text(pointer)
94
80
auto t = x_map.find (th);
95
81
96
82
if (t == x_map.end ())
97
83
{
98
- auto v = new std::vector<char *>;// TODO delete
99
- x_map.insert (std::pair<void *,std::vector<char *> *>(th,v));
84
+ auto v = new std::vector<const char *>;// TODO delete
85
+ x_map.insert (std::pair<const void *,std::vector<const char *> *>(th,v));
100
86
v->push_back (a);
101
87
}
102
88
else
103
89
{
104
- for ( auto c : *(t->second ) )
90
+ for (auto & c : *(t->second ))
105
91
{
106
92
if ( strcmp (c,a) == 0 )
107
93
return true ;
@@ -384,7 +370,9 @@ struct s3select : public bsc::grammar<s3select>
384
370
int semantic ()
385
371
{
386
372
for (const auto &e : get_projections_list ())
387
- {// upon validate there is no aggregation-function nested calls, it validates legit aggregation call.
373
+ {
374
+ e->resolve_node ();
375
+ // upon validate there is no aggregation-function nested calls, it validates legit aggregation call.
388
376
if (e->is_nested_aggregate (aggr_flow))
389
377
{
390
378
error_description = " nested aggregation function is illegal i.e. sum(...sum ...)" ;
@@ -410,7 +398,7 @@ struct s3select : public bsc::grammar<s3select>
410
398
// in case projection column is not aggregate, the projection column must *not* contain reference to columns.
411
399
if (e->is_column_reference ())
412
400
{
413
- error_description = " illegal expression. /select sum(c1) + c1 ..../ is not allow type of query " ;
401
+ error_description = " illegal query; projection contains aggregation function is not allowed with projection contains column reference " ;
414
402
throw base_s3select_exception (error_description, base_s3select_exception::s3select_exp_en_t ::FATAL);
415
403
}
416
404
}
@@ -1453,7 +1441,7 @@ class csv_object : public base_s3object
1453
1441
m_where_clause->traverse_and_apply (m_sa, m_s3_select->get_aliases ());
1454
1442
}
1455
1443
1456
- for (auto p : m_projections)
1444
+ for (auto & p : m_projections)
1457
1445
{
1458
1446
p->traverse_and_apply (m_sa, m_s3_select->get_aliases ());
1459
1447
}
0 commit comments