Skip to content

Conversation

iPeluwa
Copy link
Contributor

@iPeluwa iPeluwa commented Sep 6, 2025

Fixed Parameter Type Issues: Resolved crashes from untyped parameters (e.g., $1 + $2) by setting them to default to TEXT, allowing DataFusion to handle type coercion.

Resolved Schema Consistency Problems: Unified VARCHAR and TEXT types to TEXT, ensuring compatibility with most Postgres tools and eliminating schema mismatches.

Improved Connection Stability: Implemented connection limiting to prevent server crashes from excessive concurrent connections, avoiding resource exhaustion.

Added Configurable Query Timeout: Introduced query timeout settings via ServerOptions::new().with_query_timeout_secs(30) for a 30-second timeout, or 0 for no timeout, to prevent runaway queries.

Enhanced Connection Control: Added .with_max_connections(500) to allow limiting connections, enabling the server to reject excess connections gracefully.

… query timeout

- Fixed parameter type inference for arithmetic operations with untyped parameters (defaults to TEXT instead of throwing fatal errors)
- Fixed Arrow schema mismatches by unifying all UTF8 variants to use TEXT type consistently
- Added configurable query timeout with ServerOptions.with_query_timeout_secs(0) for no timeout
- Added configurable max_connections with ServerOptions.with_max_connections(n)
- Added connection limiting with semaphore to prevent resource exhaustion under load
- Simplified API with single constructor that takes timeout parameter directly
- Added comprehensive unit tests for timeout and connection configuration functionality
- Fixed compiler warnings and clippy suggestions
- Updated test files to use new DfSessionService constructor signature
- Applied cargo fmt formatting across the codebase
- All tests now pass successfully
@iPeluwa
Copy link
Contributor Author

iPeluwa commented Sep 6, 2025

@sunng87 please take a look.

@sunng87
Copy link
Member

sunng87 commented Sep 9, 2025

Thank you.

Fixed Parameter Type Issues: Resolved crashes from untyped parameters (e.g., $1 + $2) by setting them to default to TEXT, allowing DataFusion to handle type coercion.

I'm also running into this issue with #149

pub fn new(
session_context: Arc<SessionContext>,
auth_manager: Arc<AuthManager>,
query_timeout: Option<std::time::Duration>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you to put this into a new pull request. Also it should be configured at per-session level using SET statement_timeout

port: 5432,
tls_cert_path: None,
tls_key_path: None,
max_connections: 1000,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default to 0, which means no restriction on this.

@iPeluwa
Copy link
Contributor Author

iPeluwa commented Sep 9, 2025

#149

I'd look into that and have it fixed

@sunng87
Copy link
Member

sunng87 commented Sep 9, 2025

Hi @iPeluwa , my suggestion is to split this into 3 different PR:

  1. Type inference for unknown type in extended query
  2. statement timeout support: using SET STATEMENT_TIMEOUT to configure at session level, default to disabled.
  3. max connection limit, default to disabled.

@iPeluwa
Copy link
Contributor Author

iPeluwa commented Sep 10, 2025

@sunng87 #152 , #153 and #154, I have broken it into 3 different PRs

@iPeluwa iPeluwa closed this Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants