lustefaniak commented on issue #1563: URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1563#issuecomment-2585473535
Hi @alamb, what I did downstream couldn't be ported immediately as it is a much higher level testing, which I think might not work well in the low-level library. I work on the result of the AST analysis, storing locations into higher-level concepts like columns and dependency chains. Categorising locations into specific categories: ``` SOURCE_LOCATION_KIND_PROJECTION, SOURCE_LOCATION_KIND_IDENTIFIER, SOURCE_LOCATION_KIND_EXPRESSION, SOURCE_LOCATION_KIND_SELECTION etc. ``` I assert that the captured "location" is precisely a specific string. ``` assert_location_contains( sql, &get_column_dep_locations(&res, "t", "started_at"), &snip(LocationKind::Identifier, "started_at"), ); assert_location_contains( sql, &get_column_dep_locations(&res, "t", "started_at"), &snip( LocationKind::Expression, "GREATEST(finished_at, started_at)", ), ); assert_location_contains( sql, &get_column_dep_locations(&res, "t", "started_at"), &snip( LocationKind::Projection, "GREATEST(finished_at, started_at) as t", ), ); ``` On the one hand, it is a very high level without looking into details of all the AST nodes; on the other hand, I found working with line/char super hard to grasp and error-prone and led to not the level of testing I wanted. Ultimately, I wanted the best experience for our users, and snipped-based testing worked pretty well. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org