chdb 3.7.1__cp38-abi3-musllinux_1_2_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of chdb might be problematic. Click here for more details.

chdb/udf/__init__.py ADDED
@@ -0,0 +1,10 @@
1
+ """User-defined functions module for chDB.
2
+
3
+ This module provides functionality for creating and managing user-defined functions (UDFs)
4
+ in chDB. It allows you to extend chDB's capabilities by writing custom Python functions
5
+ that can be called from SQL queries.
6
+ """
7
+
8
+ from .udf import chdb_udf, generate_udf
9
+
10
+ __all__ = ["chdb_udf", "generate_udf"]
chdb/udf/udf.py ADDED
@@ -0,0 +1,122 @@
1
+ import functools
2
+ import inspect
3
+ import os
4
+ import sys
5
+ import tempfile
6
+ import atexit
7
+ import shutil
8
+ import textwrap
9
+ from xml.etree import ElementTree as ET
10
+ import chdb
11
+
12
+
13
+ def generate_udf(func_name, args, return_type, udf_body):
14
+ """Generate UDF configuration and executable script files.
15
+
16
+ This function creates the necessary files for a User Defined Function (UDF) in chDB:
17
+ 1. A Python executable script that processes input data
18
+ 2. An XML configuration file that registers the UDF with ClickHouse
19
+
20
+ Args:
21
+ func_name (str): Name of the UDF function
22
+ args (list): List of argument names for the function
23
+ return_type (str): ClickHouse return type for the function
24
+ udf_body (str): Python source code body of the UDF function
25
+
26
+ Note:
27
+ This function is typically called by the @chdb_udf decorator and should not
28
+ be called directly by users.
29
+ """
30
+ # generate python script
31
+ with open(f"{chdb.g_udf_path}/{func_name}.py", "w") as f:
32
+ f.write(f"#!{sys.executable}\n")
33
+ f.write("import sys\n")
34
+ f.write("\n")
35
+ for line in udf_body.split("\n"):
36
+ f.write(f"{line}\n")
37
+ f.write("\n")
38
+ f.write("if __name__ == '__main__':\n")
39
+ f.write(" for line in sys.stdin:\n")
40
+ f.write(" args = line.strip().split('\t')\n")
41
+ for i, arg in enumerate(args):
42
+ f.write(f" {arg} = args[{i}]\n")
43
+ f.write(f" print({func_name}({', '.join(args)}))\n")
44
+ f.write(" sys.stdout.flush()\n")
45
+ os.chmod(f"{chdb.g_udf_path}/{func_name}.py", 0o755)
46
+ # generate xml file
47
+ xml_file = f"{chdb.g_udf_path}/udf_config.xml"
48
+ root = ET.Element("functions")
49
+ if os.path.exists(xml_file):
50
+ tree = ET.parse(xml_file)
51
+ root = tree.getroot()
52
+ function = ET.SubElement(root, "function")
53
+ ET.SubElement(function, "type").text = "executable"
54
+ ET.SubElement(function, "name").text = func_name
55
+ ET.SubElement(function, "return_type").text = return_type
56
+ ET.SubElement(function, "format").text = "TabSeparated"
57
+ ET.SubElement(function, "command").text = f"{func_name}.py"
58
+ for arg in args:
59
+ argument = ET.SubElement(function, "argument")
60
+ # We use TabSeparated format, so assume all arguments are strings
61
+ ET.SubElement(argument, "type").text = "String"
62
+ ET.SubElement(argument, "name").text = arg
63
+ tree = ET.ElementTree(root)
64
+ tree.write(xml_file)
65
+
66
+
67
+ def chdb_udf(return_type="String"):
68
+ """Decorator for chDB Python UDF(User Defined Function).
69
+
70
+ Args:
71
+ return_type (str): Return type of the function. Default is "String".
72
+ Should be one of the ClickHouse data types.
73
+
74
+ Notes:
75
+ 1. The function should be stateless. Only UDFs are supported, not UDAFs.
76
+ 2. Default return type is String. The return type should be one of the ClickHouse data types.
77
+ 3. The function should take in arguments of type String. All arguments are strings.
78
+ 4. The function will be called for each line of input.
79
+ 5. The function should be pure python function. Import all modules used IN THE FUNCTION.
80
+ 6. Python interpreter used is the same as the one used to run the script.
81
+
82
+ Example:
83
+ .. code-block:: python
84
+
85
+ @chdb_udf()
86
+ def sum_udf(lhs, rhs):
87
+ return int(lhs) + int(rhs)
88
+
89
+ @chdb_udf()
90
+ def func_use_json(arg):
91
+ import json
92
+ # ... use json module
93
+ """
94
+
95
+ def decorator(func):
96
+ func_name = func.__name__
97
+ sig = inspect.signature(func)
98
+ args = list(sig.parameters.keys())
99
+ src = inspect.getsource(func)
100
+ src = textwrap.dedent(src)
101
+ udf_body = src.split("\n", 1)[1] # remove the first line "@chdb_udf()"
102
+ # create tmp dir and make sure the dir is deleted when the process exits
103
+ if chdb.g_udf_path == "":
104
+ chdb.g_udf_path = tempfile.mkdtemp()
105
+
106
+ # clean up the tmp dir on exit
107
+ @atexit.register
108
+ def _cleanup():
109
+ try:
110
+ shutil.rmtree(chdb.g_udf_path)
111
+ except: # noqa
112
+ pass
113
+
114
+ generate_udf(func_name, args, return_type, udf_body)
115
+
116
+ @functools.wraps(func)
117
+ def wrapper(*args, **kwargs):
118
+ return func(*args, **kwargs)
119
+
120
+ return wrapper
121
+
122
+ return decorator
chdb/utils/__init__.py ADDED
@@ -0,0 +1,15 @@
1
+ """Utility functions and helpers for chDB.
2
+
3
+ This module contains various utility functions for working with chDB, including
4
+ data type inference, data conversion helpers, and debugging utilities.
5
+ """
6
+
7
+ from .types import * # noqa: F403
8
+
9
+ __all__ = [ # noqa: F405
10
+ "flatten_dict",
11
+ "convert_to_columnar",
12
+ "infer_data_type",
13
+ "infer_data_types",
14
+ "trace",
15
+ ]
chdb/utils/trace.py ADDED
@@ -0,0 +1,105 @@
1
+ import functools
2
+ import inspect
3
+ import sys
4
+ import linecache
5
+ from datetime import datetime
6
+
7
+ enable_print = False
8
+
9
+
10
+ def trace(func):
11
+ """Trace function execution with line-by-line debugging information.
12
+
13
+ This decorator enables line-by-line tracing of function execution, printing
14
+ each executed line along with local variable values. Tracing is only enabled
15
+ when the global `enable_print` variable is True.
16
+
17
+ Args:
18
+ func: The function to be traced
19
+
20
+ Returns:
21
+ The wrapped function with tracing capabilities
22
+
23
+ Note:
24
+ Set `enable_print = True` to enable tracing output. When disabled,
25
+ the function executes normally without any performance overhead.
26
+
27
+ Example:
28
+ .. code-block:: python
29
+
30
+ import chdb.utils.trace
31
+ chdb.utils.trace.enable_print = True
32
+
33
+ @chdb.utils.trace.trace
34
+ def my_function(x, y):
35
+ z = x + y
36
+ return z * 2
37
+ """
38
+ return print_lines(func)
39
+
40
+
41
+ def print_lines(func):
42
+ if not enable_print:
43
+ return func
44
+
45
+ @functools.wraps(func)
46
+ def wrapper(*args, **kwargs):
47
+ # Get function name and determine if it's a method
48
+ is_method = inspect.ismethod(func) or (
49
+ len(args) > 0 and hasattr(args[0].__class__, func.__name__)
50
+ )
51
+ class_name = args[0].__class__.__name__ if is_method else None # type: ignore
52
+
53
+ # Get the source code of the function
54
+ try:
55
+ source_lines, start_line = inspect.getsourcelines(func)
56
+ except OSError:
57
+ # Handle cases where source might not be available
58
+ print(f"Warning: Could not get source for {func.__name__}")
59
+ return func(*args, **kwargs)
60
+
61
+ def trace(frame, event, arg):
62
+ if event == "line":
63
+ # Get the current line number and code
64
+ line_no = frame.f_lineno
65
+ line = linecache.getline(frame.f_code.co_filename, line_no).strip()
66
+
67
+ # Don't print decorator lines or empty lines
68
+ if line and not line.startswith("@"):
69
+ # Get local variables
70
+ local_vars = frame.f_locals.copy()
71
+ if is_method:
72
+ # Remove 'self' from local variables for clarity
73
+ local_vars.pop("self", None)
74
+
75
+ # Format timestamp
76
+ timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
77
+
78
+ # Create context string (class.method or function)
79
+ context = (
80
+ f"{class_name}.{func.__name__}" if class_name else func.__name__
81
+ )
82
+
83
+ # Print execution information
84
+ print(f"[{timestamp}] {context} line {line_no}: {line}")
85
+
86
+ # Print local variables if they exist and have changed
87
+ if local_vars:
88
+ vars_str = ", ".join(
89
+ f"{k}={repr(v)}" for k, v in local_vars.items()
90
+ )
91
+ print(f" Variables: {vars_str}")
92
+ return trace
93
+
94
+ # Set the trace function
95
+ sys.settrace(trace)
96
+
97
+ # Call the original function
98
+ result = func(*args, **kwargs)
99
+
100
+ # Disable tracing
101
+ sys.settrace(None)
102
+
103
+ return result
104
+
105
+ return wrapper
chdb/utils/types.py ADDED
@@ -0,0 +1,232 @@
1
+ from collections import defaultdict
2
+ from typing import List, Dict, Any
3
+ import json
4
+ import decimal
5
+
6
+
7
+ def convert_to_columnar(items: List[Dict[str, Any]]) -> Dict[str, List[Any]]:
8
+ """Converts a list of dictionaries into a columnar format.
9
+
10
+ This function takes a list of dictionaries and converts it into a dictionary
11
+ where each key corresponds to a column and each value is a list of column values.
12
+ Missing values in the dictionaries are represented as None.
13
+
14
+ Args:
15
+ items (List[Dict[str, Any]]): A list of dictionaries to convert.
16
+
17
+ Returns:
18
+ Dict[str, List[Any]]: A dictionary with keys as column names and values as lists
19
+ of column values.
20
+
21
+ Example:
22
+ >>> items = [
23
+ ... {"name": "Alice", "age": 30, "city": "New York"},
24
+ ... {"name": "Bob", "age": 25},
25
+ ... {"name": "Charlie", "city": "San Francisco"}
26
+ ... ]
27
+ >>> convert_to_columnar(items)
28
+ {
29
+ 'name': ['Alice', 'Bob', 'Charlie'],
30
+ 'age': [30, 25, None],
31
+ 'city': ['New York', None, 'San Francisco']
32
+ }
33
+ """
34
+ if not items:
35
+ return {}
36
+
37
+ flattened_items = [flatten_dict(item) for item in items]
38
+ columns = defaultdict(list)
39
+ keys = set()
40
+
41
+ # Collect all possible keys
42
+ for flattened_item in flattened_items:
43
+ keys.update(flattened_item.keys())
44
+
45
+ # Fill the column lists
46
+ for flattened_item in flattened_items:
47
+ for key in keys:
48
+ columns[key].append(flattened_item.get(key, None))
49
+
50
+ return dict(columns)
51
+
52
+
53
+ def flatten_dict(
54
+ d: Dict[str, Any], parent_key: str = "", sep: str = "_"
55
+ ) -> Dict[str, Any]:
56
+ """Flattens a nested dictionary.
57
+
58
+ This function takes a nested dictionary and flattens it, concatenating nested keys
59
+ with a separator. Lists of dictionaries are serialized to JSON strings.
60
+
61
+ Args:
62
+ d (Dict[str, Any]): The dictionary to flatten.
63
+ parent_key (str, optional): The base key to prepend to each key. Defaults to "".
64
+ sep (str, optional): The separator to use between concatenated keys. Defaults to "_".
65
+
66
+ Returns:
67
+ Dict[str, Any]: A flattened dictionary.
68
+
69
+ Example:
70
+ >>> nested_dict = {
71
+ ... "a": 1,
72
+ ... "b": {
73
+ ... "c": 2,
74
+ ... "d": {
75
+ ... "e": 3
76
+ ... }
77
+ ... },
78
+ ... "f": [4, 5, {"g": 6}],
79
+ ... "h": [{"i": 7}, {"j": 8}]
80
+ ... }
81
+ >>> flatten_dict(nested_dict)
82
+ {
83
+ 'a': 1,
84
+ 'b_c': 2,
85
+ 'b_d_e': 3,
86
+ 'f_0': 4,
87
+ 'f_1': 5,
88
+ 'f_2_g': 6,
89
+ 'h': '[{"i": 7}, {"j": 8}]'
90
+ }
91
+ """
92
+ items = []
93
+ for k, v in d.items():
94
+ new_key = f"{parent_key}{sep}{k}" if parent_key else k
95
+ if isinstance(v, dict):
96
+ items.extend(flatten_dict(v, new_key, sep=sep).items())
97
+ elif isinstance(v, list):
98
+ if all(isinstance(i, dict) for i in v):
99
+ items.append((new_key, json.dumps(v)))
100
+ else:
101
+ for i, item in enumerate(v):
102
+ if isinstance(item, dict):
103
+ items.extend(
104
+ flatten_dict(item, f"{new_key}{sep}{i}", sep=sep).items()
105
+ )
106
+ else:
107
+ items.append((f"{new_key}{sep}{i}", item))
108
+ else:
109
+ items.append((new_key, v))
110
+ return dict(items)
111
+
112
+
113
+ def infer_data_types(
114
+ column_data: Dict[str, List[Any]], n_rows: int = 10000
115
+ ) -> List[tuple]:
116
+ """Infers data types for each column in a columnar data structure.
117
+
118
+ This function analyzes the values in each column and infers the most suitable
119
+ data type for each column, based on a sample of the data.
120
+
121
+ Args:
122
+ column_data (Dict[str, List[Any]]): A dictionary where keys are column names
123
+ and values are lists of column values.
124
+ n_rows (int, optional): The number of rows to sample for type inference.
125
+ Defaults to 10000.
126
+
127
+ Returns:
128
+ List[tuple]: A list of tuples, each containing a column name and its
129
+ inferred data type.
130
+ """
131
+ data_types = []
132
+ for column, values in column_data.items():
133
+ sampled_values = values[:n_rows]
134
+ inferred_type = infer_data_type(sampled_values)
135
+ data_types.append((column, inferred_type))
136
+ return data_types
137
+
138
+
139
+ def infer_data_type(values: List[Any]) -> str:
140
+ """Infers the most suitable data type for a list of values.
141
+
142
+ This function examines a list of values and determines the most appropriate
143
+ data type that can represent all the values in the list. It considers integer,
144
+ unsigned integer, decimal, and float types, and defaults to "string" if the
145
+ values cannot be represented by any numeric type or if all values are None.
146
+
147
+ Args:
148
+ values (List[Any]): A list of values to analyze. The values can be of any type.
149
+
150
+ Returns:
151
+ str: A string representing the inferred data type. Possible return values are:
152
+ "int8", "int16", "int32", "int64", "int128", "int256", "uint8", "uint16",
153
+ "uint32", "uint64", "uint128", "uint256", "decimal128", "decimal256",
154
+ "float32", "float64", or "string".
155
+
156
+ Notes:
157
+ - If all values in the list are None, the function returns "string".
158
+ - If any value in the list is a string, the function immediately returns "string".
159
+ - The function assumes that numeric values can be represented as integers,
160
+ decimals, or floats based on their range and precision.
161
+ """
162
+
163
+ int_range = {
164
+ "int8": (-(2**7), 2**7 - 1),
165
+ "int16": (-(2**15), 2**15 - 1),
166
+ "int32": (-(2**31), 2**31 - 1),
167
+ "int64": (-(2**63), 2**63 - 1),
168
+ "int128": (-(2**127), 2**127 - 1),
169
+ "int256": (-(2**255), 2**255 - 1),
170
+ }
171
+ uint_range = {
172
+ "uint8": (0, 2**8 - 1),
173
+ "uint16": (0, 2**16 - 1),
174
+ "uint32": (0, 2**32 - 1),
175
+ "uint64": (0, 2**64 - 1),
176
+ "uint128": (0, 2**128 - 1),
177
+ "uint256": (0, 2**256 - 1),
178
+ }
179
+
180
+ max_val = float("-inf")
181
+ min_val = float("inf")
182
+ is_int = True
183
+ is_decimal = True
184
+ is_float = True
185
+
186
+ all_none = True
187
+
188
+ for val in values:
189
+ if val is None:
190
+ continue
191
+ all_none = False
192
+ if isinstance(val, str):
193
+ return "string"
194
+
195
+ try:
196
+ num = int(val)
197
+ max_val = max(max_val, num)
198
+ min_val = min(min_val, num)
199
+ except (ValueError, TypeError):
200
+ is_int = False
201
+ try:
202
+ num = decimal.Decimal(val)
203
+ max_val = max(max_val, float(num))
204
+ min_val = min(min_val, float(num))
205
+ except (decimal.InvalidOperation, TypeError):
206
+ is_decimal = False
207
+ try:
208
+ num = float(val)
209
+ max_val = max(max_val, num)
210
+ min_val = min(min_val, num)
211
+ except (ValueError, TypeError):
212
+ is_float = False
213
+ return "string"
214
+
215
+ if all_none:
216
+ return "string"
217
+
218
+ if is_int:
219
+ for dtype, (min_val_dtype, max_val_dtype) in int_range.items():
220
+ if min_val_dtype <= min_val and max_val <= max_val_dtype:
221
+ return dtype
222
+ for dtype, (_, max_val_dtype) in uint_range.items():
223
+ if max_val <= max_val_dtype:
224
+ return dtype
225
+
226
+ if is_decimal:
227
+ return "decimal128" if abs(max_val) < 10**38 else "decimal256"
228
+
229
+ if is_float:
230
+ return "float32" if abs(max_val) < 3.4e38 else "float64"
231
+
232
+ return "string"
@@ -0,0 +1,203 @@
1
+ Copyright 2023 chDB, Inc.
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright 2023 chDB, Inc.
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.