FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
datafusion-python/python/datafusion/record_batch.py at main · nirnayroy/datafusion-python · GitHub
nirnayroy
/
datafusion-python
Public
forked from
apache/datafusion-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
datafusion-python
/
python
/
datafusion
/
record_batch.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
81 lines (61 loc) · 2.67 KB
Breadcrumbs
datafusion-python
/
python
/
datafusion
/
record_batch.py
Copy path
File metadata and controls
81 lines (61 loc) · 2.67 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""This module provides the classes for handling record batches.
These are typically the result of dataframe
:py:func:`datafusion.dataframe.execute_stream` operations.
"""
from
__future__
import
annotations
from
typing
import
TYPE_CHECKING
if
TYPE_CHECKING
:
import
pyarrow
as
pa
import
typing_extensions
import
datafusion
.
_internal
as
df_internal
class
RecordBatch
:
"""This class is essentially a wrapper for :py:class:`pa.RecordBatch`."""
def
__init__
(
self
,
record_batch
:
df_internal
.
RecordBatch
)
->
None
:
"""This constructor is generally not called by the end user.
See the :py:class:`RecordBatchStream` iterator for generating this class.
"""
self
.
record_batch
=
record_batch
def
to_pyarrow
(
self
)
->
pa
.
RecordBatch
:
"""Convert to :py:class:`pa.RecordBatch`."""
return
self
.
record_batch
.
to_pyarrow
()
class
RecordBatchStream
:
"""This class represents a stream of record batches.
These are typically the result of a
:py:func:`~datafusion.dataframe.DataFrame.execute_stream` operation.
"""
def
__init__
(
self
,
record_batch_stream
:
df_internal
.
RecordBatchStream
)
->
None
:
"""This constructor is typically not called by the end user."""
self
.
rbs
=
record_batch_stream
def
next
(
self
)
->
RecordBatch
:
"""See :py:func:`__next__` for the iterator function."""
return
next
(
self
)
async
def
__anext__
(
self
)
->
RecordBatch
:
"""Async iterator function."""
next_batch
=
await
self
.
rbs
.
__anext__
()
return
RecordBatch
(
next_batch
)
def
__next__
(
self
)
->
RecordBatch
:
"""Iterator function."""
next_batch
=
next
(
self
.
rbs
)
return
RecordBatch
(
next_batch
)
def
__aiter__
(
self
)
->
typing_extensions
.
Self
:
"""Async iterator function."""
return
self
def
__iter__
(
self
)
->
typing_extensions
.
Self
:
"""Iterator function."""
return
self
Back
|
FazBrowse Home
|
New Git URL