Skip to content

Commit cfa7ff7

Browse files
authored
Merge pull request #385 from wudidapaopao/support_arrow_scan
2 parents a3490a8 + c9797aa commit cfa7ff7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3252
-145
lines changed

.github/workflows/build_linux_arm64_wheels-gh.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ jobs:
217217
- name: Run libchdb stub in examples dir
218218
run: |
219219
bash -x ./examples/runStub.sh
220+
bash -x ./examples/runArrowTest.sh
220221
- name: Check ccache statistics
221222
run: |
222223
ccache -s

.github/workflows/build_linux_x86_wheels.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ jobs:
217217
- name: Run libchdb stub in examples dir
218218
run: |
219219
bash -x ./examples/runStub.sh
220+
bash -x ./examples/runArrowTest.sh
220221
- name: Check ccache statistics
221222
run: |
222223
ccache -s

.github/workflows/build_macos_arm64_wheels.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ jobs:
2424
name: Build Universal Wheel (macOS ARM64)
2525
runs-on: macos-14-xlarge
2626
steps:
27+
- name: Check machine architecture
28+
run: |
29+
echo "=== Machine Architecture Information ==="
30+
echo "Machine type: $(uname -m)"
31+
echo "Architecture: $(arch)"
32+
echo "System info: $(uname -a)"
33+
echo "Hardware info:"
34+
system_profiler SPHardwareDataType | grep "Chip\|Processor"
35+
if sysctl -n hw.optional.arm64 2>/dev/null | grep -q "1"; then
36+
echo "This is an ARM64 (Apple Silicon) machine"
37+
else
38+
echo "This is an x86_64 (Intel) machine"
39+
fi
2740
- name: Free up disk space (Initial)
2841
run: |
2942
# Clean Homebrew cache
@@ -201,6 +214,7 @@ jobs:
201214
- name: Run libchdb stub in examples dir
202215
run: |
203216
bash -x ./examples/runStub.sh
217+
bash -x ./examples/runArrowTest.sh
204218
- name: Build wheels
205219
run: |
206220
export PATH="$HOME/.pyenv/bin:$PATH"

.github/workflows/build_macos_x86_wheels.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ jobs:
2525
runs-on: macos-15-intel
2626
timeout-minutes: 600
2727
steps:
28+
- name: Check machine architecture
29+
run: |
30+
echo "=== Machine Architecture Information ==="
31+
echo "Machine type: $(uname -m)"
32+
echo "Architecture: $(arch)"
33+
echo "System info: $(uname -a)"
34+
echo "Hardware info:"
35+
system_profiler SPHardwareDataType | grep "Chip\|Processor"
36+
if sysctl -n hw.optional.arm64 2>/dev/null | grep -q "1"; then
37+
echo "This is an ARM64 (Apple Silicon) machine"
38+
else
39+
echo "This is an x86_64 (Intel) machine"
40+
fi
2841
- name: Setup pyenv
2942
run: |
3043
curl https://pyenv.run | bash
@@ -202,6 +215,7 @@ jobs:
202215
- name: Run libchdb stub in examples dir
203216
run: |
204217
bash -x ./examples/runStub.sh
218+
bash -x ./examples/runArrowTest.sh
205219
- name: Build wheels
206220
run: |
207221
export PATH="$HOME/.pyenv/bin:$PATH"

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,7 @@ chDB automatically converts Python dictionary objects to ClickHouse JSON types f
416416
```
417417
- Columns are converted to `String` if sampling finds non-dictionary values.
418418

419-
2. **Arrow Table**
420-
- `struct` type columns are automatically mapped to JSON columns.
421-
- Nested structures preserve type information.
422-
423-
3. **chdb.PyReader**
419+
2. **chdb.PyReader**
424420
- Implement custom schema mapping in `get_schema()`:
425421
```python
426422
def get_schema(self):

chdb/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ def to_arrowTable(res):
103103
raise ImportError("Failed to import pyarrow or pandas") from None
104104
if len(res) == 0:
105105
return pa.Table.from_batches([], schema=pa.schema([]))
106-
return pa.RecordBatchFileReader(res.bytes()).read_all()
106+
107+
memview = res.get_memview()
108+
return pa.RecordBatchFileReader(memview.view()).read_all()
107109

108110

109111
# return pandas dataframe

chdb/state/sqlitelike.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ def to_arrowTable(res):
6262
raise ImportError("Failed to import pyarrow or pandas") from None
6363
if len(res) == 0:
6464
return pa.Table.from_batches([], schema=pa.schema([]))
65-
return pa.RecordBatchFileReader(res.bytes()).read_all()
65+
66+
memview = res.get_memview()
67+
return pa.RecordBatchFileReader(memview.view()).read_all()
6668

6769

6870
# return pandas dataframe

0 commit comments

Comments
 (0)