Commit e7ec694
committed
Replace comment preservation with simple comment stripping for format tests
Instead of adding complex comment handling to the AST (Comment struct,
StatementWithComments wrapper), use a simple comment-stripping function
in the test to normalize expected output. This approach:
- Removes 57 lines from ast/ast.go (Comment, StatementWithComments)
- Simplifies the parser by just skipping comments instead of tracking them
- Removes comment formatting code from the format package
- Adds a simple stripComments() function in tests for expected output normalization
The format tests now compare the formatted output against the original
query with comments stripped, which is simpler and achieves the same goal.1 parent 01eed7c commit e7ec694
197 files changed
Lines changed: 267 additions & 314 deletions
File tree
- ast
- internal
- explain
- format
- parser
- testdata
- 00091_prewhere_two_conditions
- 00098_primary_key_memory_allocated
- 00106_totals_after_having
- 00182_functions_higher_order_and_consts
- 00386_has_column_in_table
- 00396_uuid_v7
- 00646_weird_mmx
- 00692_if_exception_code
- 00734_timeslot
- 00741_client_comment_multiline
- 00765_locate
- 00808_array_enumerate_segfault
- 00833_sleep_overflow
- 00842_array_with_constant_overflow
- 00913_many_threads
- 00927_disable_hyperscan
- 00930_max_partitions_per_insert_block
- 00976_max_execution_speed
- 00979_yandex_consistent_hash_fpe
- 00987_distributed_stack_overflow
- 00988_expansion_aliases_limit
- 01014_function_repeat_corner_cases
- 01045_array_zip
- 01052_array_reduce_exception
- 01074_h3_range_check
- 01082_bit_test_out_of_bound
- 01097_cyclic_defaults
- 01134_max_rows_to_group_by
- 01134_set_overflow_mode
- 01202_arrayROCAUC_special
- 01213_point_in_Myanmar
- 01256_negative_generate_random
- 01273_h3EdgeAngle_range_check
- 01277_convert_field_to_type_logical_error
- 01278_random_string_utf8
- 01281_parseDateTime64BestEffort
- 01288_shard_max_network_bandwidth
- 01291_unsupported_conversion_from_decimal
- 01311_comparison_with_constant_string
- 01313_parse_date_time_best_effort_null_zero
- 01329_compare_tuple_string_constant
- 01330_array_join_in_higher_order_function
- 01340_datetime64_fpe
- 01362_year_of_ISO8601_week_modificators_for_formatDateTime
- 01372_remote_table_function_empty_table
- 01402_cast_nullable_string_to_enum
- 01421_assert_in_in
- 01425_decimal_parse_big_negative_exponent
- 01428_h3_range_check
- 01435_lcm_overflow
- 01455_optimize_trivial_insert_select
- 01459_default_value_of_argument_type_nullptr_dereference
- 01472_toBoundsOfInterval_disallow_empty_tz_field
- 01491_nested_multiline_comments
- 01527_bad_aggregation_in_lambda
- 01535_decimal_round_scale_overflow_check
- 01544_errorCodeToName
- 01548_with_totals_having
- 01621_decode_XML
- 01634_uuid_fuzz
- 01658_values_ubsan
- 01667_aes_args_check
- 01682_gather_utils_ubsan
- 01760_modulo_negative
- 01768_extended_range
- 01776_decrypt_aead_size_check
- 01777_map_populate_series_ubsan
- 01780_range_msan
- 01782_field_oom
- 01801_dateDiff_DateTime64
- 01802_formatDateTime_DateTime64_century
- 01942_dateTimeToSnowflake
- 01943_non_deterministic_order_key
- 01944_range_max_elements
- 02018_multiple_with_fill_for_the_same_column
- 02101_sql_user_defined_functions_drop_if_exists
- 02102_sql_user_defined_functions_create_if_not_exists
- 02123_MySQLWire_regression
- 02125_recursive_sql_user_defined_functions
- 02126_identity_user_defined_function
- 02165_h3_num_hexagons
- 02212_h3_get_res0_indexes
- 02310_uuid_v7
- 02317_functions_with_nothing
- 02319_timeslots_dt64
- 02346_text_index_bug88080
- 02353_translate
- 02357_file_default_value
- 02372_nowInBlock
- 02379_analyzer_subquery_depth
- 02384_decrypt_bad_arguments
- 02388_analyzer_recursive_lambda
- 02388_conversion_from_string_with_datetime64_to_date_and_date32
- 02419_contingency_array_nullable
- 02426_create_suspicious_fixed_string
- 02430_bitmap_transform_exception_code
- 02458_datediff_date32
- 02469_interval_msan
- 02474_timeDiff_UTCTimestamp
- 02477_age_date32
- 02483_cuturlparameter_with_arrays
- 02494_query_cache_events
- 02494_query_cache_exception_handling
- 02494_query_cache_metrics
- 02494_query_cache_min_query_duration
- 02494_query_cache_min_query_runs
- 02494_query_cache_nondeterministic_functions
- 02494_query_cache_normalize_ast
- 02494_query_cache_query_log
- 02494_query_cache_secrets
- 02494_query_cache_tag
- 02494_query_cache_ttl_long
- 02494_query_cache_user_quotas_after_drop
- 02507_to_unix_timestamp_overflow
- 02552_check_referential_table_dependencies
- 02554_rewrite_count_distinct_if_with_count_distinct_implementation
- 02559_multiple_read_steps_in_prewhere_reuse_computation
- 02668_ulid_decoding
- 02676_to_decimal_string
- 02681_comparsion_tuple_elimination_ast
- 02688_long_aggregate_function_names
- 02722_log_profile_events
- 02725_sleep_max_time
- 02732_transform_fuzz
- 02813_starting_in_text_log
- 02814_age_datediff
- 02816_s2_invalid_point
- 02831_regexp_analyze_recursion
- 02834_add_sub_date_functions
- 02834_timestamp_function
- 02845_domain_rfc_support_ipv6
- 02874_analysis_of_variance_overflow
- 02874_toDaysSinceYearZero
- 02896_illegal_sampling
- 02900_date_time_check_overflow
- 02906_interval_comparison
- 02935_date_trunc_case_unsensitiveness
- 02963_invalid_identifier
- 02963_msan_agg_addBatchLookupTable8
- 02970_visible_width_behavior
- 02976_system_zookeeper_filters
- 02992_settings_overflow
- 03002_int_div_decimal_with_date_bug
- 03003_analyzer_setting
- 03003_arrayEnumerate_crash
- 03014_msan_parse_date_time
- 03033_tupleIntXYZ_and_tupleModulo
- 03129_serial_test_zookeeper
- 03157_negative_positional_arguments_ubsan
- 03161_ipv4_ipv6_equality
- 03174_least_greatest_ignore_null_input_values
- 03198_bit_shift_throws_error_for_out_of_bounds
- 03213_distributed_analyzer
- 03214_bitslice_argument_evaluation
- 03217_json_merge_patch_stack_overflow
- 03243_lower_utf8_msan
- 03253_getMaxTableNameLength
- 03254_timeseries_range
- 03272_bad_aggregate_function
- 03275_count_digits_argument_evaluation
- 03333_merge_table_total_rows_no_database_system_tables_exception
- 03365_parsing_time_time64_short
- 03365_time64_from_datetime_timezone_respect
- 03365_time_parsing_msan_issue
- 03365_time_time64_comparison
- 03365_time_time64_extreme_values
- 03365_time_time64_operations
- 03365_time_time64_parsing
- 03392_inconsistent_formatting_of_lambda
- 03393_max_read_buffer_size_non_zero
- 03394_naive_bayes_classifier_negative
- 03405_non_zero_batch_mode
- 03443_alias_with_asterisk
- 03444_case_with_expression_exception
- 03518_bad_sql_udf
- 03518_table_function_remote_no_replicas
- 03519_zero_filesystem_prefetch_max_memory_usage
- 03529_quantile_deterministic_ubsan
- 03537_kusto_ubsan
- 03549_conv_function
- 03550_s3queue_no_settings
- 03567_nowInBlock64
- 03594_is_valid_ascii_errors
- 03623_datetime64_preepoch_fractional_precision
- 03624_csv_empty_array_from_empty_string
- 03647_morton_encode_empty_tuple
- 03653_keeper_histogram_metrics
- 03711_json_skip_invalid_fields
- 03716_topk_bad_data
- 03756_mongodb_secret_arguments
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | 17 | | |
75 | 18 | | |
76 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 35 | | |
41 | 36 | | |
42 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | 23 | | |
40 | 24 | | |
41 | 25 | | |
42 | 26 | | |
43 | 27 | | |
44 | 28 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 29 | | |
54 | 30 | | |
55 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 39 | + | |
| 40 | + | |
49 | 41 | | |
50 | 42 | | |
51 | 43 | | |
52 | 44 | | |
53 | 45 | | |
54 | 46 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 47 | | |
63 | 48 | | |
64 | 49 | | |
| |||
104 | 89 | | |
105 | 90 | | |
106 | 91 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 92 | | |
111 | 93 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 94 | | |
124 | 95 | | |
125 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
36 | 103 | | |
37 | 104 | | |
38 | 105 | | |
| |||
199 | 266 | | |
200 | 267 | | |
201 | 268 | | |
202 | | - | |
| 269 | + | |
| 270 | + | |
203 | 271 | | |
204 | 272 | | |
205 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
0 commit comments