Skip to content

Commit 0aa5aec

Browse files
authored
Handle DROP VIEW cleanup and robust SQL parser spans (#21)
* Handle DROP VIEW cleanup and parser span fixes * Fix parse_select SQL length handling
1 parent 19a6ccc commit 0aa5aec

7 files changed

Lines changed: 941 additions & 146 deletions

File tree

include/yardstick_ffi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ struct YardstickMeasureAggResult {
315315

316316
bool yardstick_has_as_measure(const char* sql);
317317
bool yardstick_has_aggregate(const char* sql);
318+
bool yardstick_drop_measure_view_from_sql(const char* sql);
318319
bool yardstick_has_curly_brace(const char* sql);
319320
bool yardstick_has_at_syntax(const char* sql);
320321

src/yardstick_extension.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ extern "C" {
4242
extern "C" {
4343
bool yardstick_has_as_measure(const char *sql);
4444
bool yardstick_has_aggregate(const char *sql);
45+
bool yardstick_drop_measure_view_from_sql(const char *sql);
4546
YardstickCreateViewResult yardstick_process_create_view(const char *sql);
4647
YardstickAggregateResult yardstick_expand_aggregate(const char *sql);
4748
void yardstick_free(char *ptr);
@@ -338,6 +339,10 @@ ParserExtensionParseResult yardstick_parse(ParserExtensionInfo *,
338339
sql_to_check = semantic_stripped;
339340
}
340341

342+
if (yardstick_drop_measure_view_from_sql(sql_to_check.c_str())) {
343+
return ParserExtensionParseResult();
344+
}
345+
341346
// Check for AGGREGATE() function
342347
if (yardstick_has_aggregate(sql_to_check.c_str())) {
343348
YardstickAggregateResult result = yardstick_expand_aggregate(sql_to_check.c_str());

0 commit comments

Comments
 (0)