forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.cursorrules
More file actions
177 lines (141 loc) · 5.53 KB
/
Copy path.cursorrules
File metadata and controls
177 lines (141 loc) · 5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# StarRocks Java Extensions Cursor Rules
## Overview
Java Extensions provide connectivity to external data sources and extend StarRocks functionality through Java-based components. These extensions enable StarRocks to read from various external systems and provide extensibility through user-defined functions.
## ⚠️ BUILD WARNING
**DO NOT attempt to build or run tests unless explicitly requested.** The Maven build system can be resource-intensive.
## Java Extensions Architecture
### External Data Connectors
#### Hadoop Ecosystem
- `hadoop-ext/` - Hadoop ecosystem integration
- Core Hadoop file system support
- Hadoop configuration management
- Security integration (Kerberos)
#### Data Lake Formats
- `hive-reader/` - Apache Hive data reader
- Hive metastore integration
- Hive table format support
- Partition handling
- `hudi-reader/` - Apache Hudi integration
- Copy-on-write and merge-on-read tables
- Timeline and metadata handling
- Incremental query support
- `iceberg-metadata-reader/` - Apache Iceberg metadata reader
- Iceberg table format support
- Snapshot and schema evolution
- Partition and file pruning
- `paimon-reader/` - Apache Paimon reader
- Paimon table format support
- Real-time and batch data access
- Schema evolution handling
#### NoSQL and Analytics
- `kudu-reader/` - Apache Kudu connector
- Kudu table scanning
- Predicate pushdown
- Column pruning
- `odps-reader/` - ODPS (MaxCompute) reader
- Alibaba Cloud MaxCompute integration
- Table and partition access
- Data type mapping
#### Connectivity
- `jdbc-bridge/` - JDBC connectivity bridge
- Generic JDBC data source support
- Connection pooling
- Query pushdown capabilities
- `jni-connector/` - JNI connectors for C++ integration
- Bridge between Java extensions and C++ backend
- Memory management for cross-language calls
- Type conversion utilities
### Runtime and Utilities
#### Core Runtime
- `common-runtime/` - Common runtime for Java extensions
- Shared utilities and base classes
- Configuration management
- Logging and error handling
#### Development Tools
- `java-utils/` - Java utilities and helper classes
- Common data structures
- Utility functions
- Helper methods for connector development
#### User-Defined Functions
- `udf-extensions/` - UDF extension framework
- UDF registration and lifecycle management
- Type system integration
- Performance optimization
- `udf-examples/` - User-defined function examples
- Sample UDF implementations
- Best practices and patterns
- Testing examples
### Dependencies
- `hadoop-lib/` - Hadoop library dependencies
- Hadoop client libraries
- Version management
- Compatibility handling
## Development Guidelines
### Project Structure
- Each extension follows Maven standard directory layout
- `src/main/java/` - Main source code
- `src/test/java/` - Unit tests
- `pom.xml` - Maven build configuration
### Key Interfaces
- `Connector` - Main connector interface
- `ConnectorMetadata` - Metadata operations
- `ConnectorScanRangeSource` - Data scanning
- `RemoteFileIO` - File I/O operations
### Common Patterns
- **Builder Pattern**: Used for configuration objects
- **Factory Pattern**: For creating connector instances
- **Template Method**: For common connector operations
- **Strategy Pattern**: For different data access strategies
### Data Type Mapping
- Consistent mapping between external system types and StarRocks types
- Handle nullable vs non-nullable types appropriately
- Support for complex types (arrays, maps, structs) where applicable
### Performance Considerations
- **Predicate Pushdown**: Push filters to external systems when possible
- **Column Pruning**: Only read required columns
- **Partition Pruning**: Skip unnecessary partitions
- **Parallel Processing**: Support parallel data reading
- **Memory Management**: Efficient memory usage for large datasets
### Error Handling
- Use StarRocks exception hierarchy
- Provide meaningful error messages
- Handle connection failures gracefully
- Implement retry mechanisms where appropriate
### Configuration
- Support both system-wide and per-table configuration
- Use consistent naming conventions for properties
- Provide sensible defaults
- Document all configuration options
### Testing
- Unit tests for core functionality
- Integration tests with external systems (when available)
- Mock external dependencies for reliable testing
- Performance benchmarks for critical paths
### Security
- Support authentication mechanisms of external systems
- Handle credentials securely
- Support encryption in transit
- Implement proper access control
## Build System
- Root `pom.xml` manages all extensions
- Each extension has its own Maven module
- Shared dependencies managed at parent level
- Profiles for different build configurations
## Contribution Guidelines
### PR Titles for Java Extensions Changes
Use appropriate prefixes for Java extensions PRs:
- `[BugFix] Fix Hive partition metadata reading issue`
- `[Feature] Add Delta Lake deletion vector support`
- `[Enhancement] Improve JDBC connector connection pooling`
- `[Performance] Optimize Iceberg metadata caching`
### Commit Message Examples for Java Extensions
```
[Feature] Add support for Kudu connector predicate pushdown
Implement predicate pushdown optimization for Kudu connector
to reduce data transfer and improve query performance.
- Add predicate conversion from StarRocks to Kudu format
- Implement column pruning optimization
- Add support for complex predicate expressions
- Include integration tests with Kudu test cluster
Closes: #12345
```