2010YOUY01 commented on code in PR #18408:
URL: https://github.com/apache/datafusion/pull/18408#discussion_r2490019060
##########
datafusion/sqllogictest/test_files/set_variable.slt:
##########
@@ -244,3 +244,105 @@ SET TIME ZONE = 'Asia/Taipei2'
statement error Arrow error: Parser error: Invalid timezone "Asia/Taipei2":
failed to parse timezone
SELECT '2000-01-01T00:00:00'::TIMESTAMP::TIMESTAMPTZ
+
+# reset variable restores default
+statement ok
+set datafusion.catalog.information_schema = true
+
+statement ok
+SET datafusion.execution.batch_size = 1024
+
+query TT
+SHOW datafusion.execution.batch_size
+----
+datafusion.execution.batch_size 1024
+
+statement ok
+RESET datafusion.execution.batch_size
+
+query TT
+SHOW datafusion.execution.batch_size
+----
+datafusion.execution.batch_size 8192
+
+# reset variable with NULL default
+statement ok
+set datafusion.catalog.information_schema = true
+
+statement ok
+SET datafusion.execution.parquet.max_predicate_cache_size = '123'
+
+query TT
+SHOW datafusion.execution.parquet.max_predicate_cache_size
+----
+datafusion.execution.parquet.max_predicate_cache_size 123
+
+statement ok
+RESET datafusion.execution.parquet.max_predicate_cache_size
+
+query TT
+SHOW datafusion.execution.parquet.max_predicate_cache_size
+----
+datafusion.execution.parquet.max_predicate_cache_size NULL
+
+# reset time zone via aliases
+statement ok
+set datafusion.catalog.information_schema = true
+
+statement ok
+SET TIME ZONE = '+10:00'
+
+statement ok
+RESET TIME ZONE
+
+query TT
+SHOW TIME ZONE
+----
+datafusion.execution.time_zone +00:00
+
+statement ok
+SET TIMEZONE = '-03:00'
+
+statement ok
+RESET TIMEZONE
+
+query TT
+SHOW TIMEZONE
+----
+datafusion.execution.time_zone +00:00
+
+statement ok
+SET TIME ZONE = '+09:00'
+
+statement ok
+RESET timezone
+
+query TT
+SHOW TIME ZONE
+----
+datafusion.execution.time_zone +00:00
+
+# reset runtime variables
+statement ok
+SET datafusion.runtime.memory_limit = '1M'
+
+statement ok
+RESET datafusion.runtime.memory_limit
Review Comment:
Here is a hack way to test, we can ensure the below query succeed after
resetting.
```
> set datafusion.runtime.memory_limit = '1K';
0 row(s) fetched.
Elapsed 0.001 seconds.
> explain analyze select * from generate_series(1000) as t1(v1) order by v1;
Not enough memory to continue external sort. Consider increasing the memory
limit, or decreasing sort_spill_reservation_bytes
caused by
Resources exhausted: Additional allocation failed for ExternalSorterMerge[0]
with top memory consumers (across reservations) as:
DataFusion-Cli#89(can spill: false) consumed 0.0 B, peak 0.0 B,
ExternalSorter[0]#90(can spill: true) consumed 0.0 B, peak 0.0 B,
ExternalSorterMerge[0]#91(can spill: false) consumed 0.0 B, peak 0.0 B.
Error: Failed to allocate additional 10.0 MB for ExternalSorterMerge[0] with
0.0 B already allocated for this reservation - 1024.0 B remain available for
the total pool
```
##########
datafusion/sqllogictest/test_files/set_variable.slt:
##########
@@ -244,3 +244,105 @@ SET TIME ZONE = 'Asia/Taipei2'
statement error Arrow error: Parser error: Invalid timezone "Asia/Taipei2":
failed to parse timezone
SELECT '2000-01-01T00:00:00'::TIMESTAMP::TIMESTAMPTZ
+
Review Comment:
Can we add some test coverage for invalid `reset`s like
`reset dataexplosion.execution.batch_size`, `reset
datafusion.exec.batch_size`, `reset datafusion.execution.batches_size`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]