duckdb 1.5.6.1 → 2.0.0.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +1 -1
- data/ext/duckdb/aggregate_function.c +40 -78
- data/ext/duckdb/appender.c +39 -126
- data/ext/duckdb/arrow_array_stream.c +10 -2
- data/ext/duckdb/connection.c +17 -54
- data/ext/duckdb/conveter.c +39 -76
- data/ext/duckdb/expression.c +1 -4
- data/ext/duckdb/function_executor.c +214 -248
- data/ext/duckdb/function_executor.h +10 -0
- data/ext/duckdb/function_vector.c +26 -0
- data/ext/duckdb/function_vector.h +18 -0
- data/ext/duckdb/logical_type.c +88 -170
- data/ext/duckdb/pending_result.c +53 -14
- data/ext/duckdb/prepared_statement.c +37 -138
- data/ext/duckdb/result.c +160 -162
- data/ext/duckdb/result.h +2 -0
- data/ext/duckdb/scalar_function.c +9 -69
- data/ext/duckdb/table_function.c +33 -82
- data/ext/duckdb/table_function_bind_info.c +2 -12
- data/ext/duckdb/util.c +53 -2
- data/ext/duckdb/value.c +46 -20
- data/ext/duckdb/value.h +1 -0
- data/lib/duckdb/appender.rb +7 -19
- data/lib/duckdb/config.rb +2 -2
- data/lib/duckdb/connection.rb +19 -17
- data/lib/duckdb/database.rb +1 -18
- data/lib/duckdb/interval.rb +2 -28
- data/lib/duckdb/pending_result.rb +7 -0
- data/lib/duckdb/prepared_statement.rb +5 -0
- data/lib/duckdb/result.rb +0 -29
- data/lib/duckdb/scalar_function_set.rb +1 -2
- data/lib/duckdb/table_description.rb +3 -3
- data/lib/duckdb/table_name_parser.rb +6 -36
- data/lib/duckdb/version.rb +1 -1
- data/lib/duckdb.rb +0 -14
- metadata +1 -1
data/lib/duckdb/result.rb
CHANGED
|
@@ -95,34 +95,5 @@ module DuckDB
|
|
|
95
95
|
end
|
|
96
96
|
values
|
|
97
97
|
end
|
|
98
|
-
|
|
99
|
-
private
|
|
100
|
-
|
|
101
|
-
def _enum_dictionary_size(idx)
|
|
102
|
-
warn(":_enum_dictionary_size is deprecated. use columns[#{idx}].logical_type.dictionary_size instead.")
|
|
103
|
-
|
|
104
|
-
raise ArgumentError, "Invalid index: #{idx}" if idx.negative?
|
|
105
|
-
|
|
106
|
-
columns[idx]&.logical_type&.dictionary_size
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
def _enum_dictionary_value(col_index, idx)
|
|
110
|
-
warn(":_enum_dictionary_value is deprecated.\
|
|
111
|
-
use columns[#{col_index}].logical_type.dictionary_value_at(#{idx}) instead.")
|
|
112
|
-
|
|
113
|
-
raise ArgumentError, "Invalid index: #{col_index}" if col_index.negative?
|
|
114
|
-
|
|
115
|
-
lt = columns[col_index]&.logical_type
|
|
116
|
-
|
|
117
|
-
raise DuckDB::Error, "Column[#{col_index}] type is not enum" if lt&.type != :enum
|
|
118
|
-
|
|
119
|
-
lt.dictionary_value_at(idx)
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def _column_type(idx)
|
|
123
|
-
warn(":_column_type is deprecated. use columns[#{idx}].send(:_type) instead.")
|
|
124
|
-
|
|
125
|
-
columns[idx].send(:_type)
|
|
126
|
-
end
|
|
127
98
|
end
|
|
128
99
|
end
|
|
@@ -11,8 +11,7 @@ module DuckDB
|
|
|
11
11
|
def initialize(name)
|
|
12
12
|
raise TypeError, "#{name.class} is not a String or Symbol" unless name.is_a?(String) || name.is_a?(Symbol)
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
_initialize(@name)
|
|
14
|
+
_initialize(name.to_s)
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
# @param scalar_function [DuckDB::ScalarFunction] the overload to add
|
|
@@ -28,9 +28,9 @@ module DuckDB
|
|
|
28
28
|
# +con+ must be a DuckDB::Connection. +table+ is the table name (String).
|
|
29
29
|
# Optionally pass +schema:+ and/or +catalog:+ to qualify the table.
|
|
30
30
|
#
|
|
31
|
-
# The +table+ argument
|
|
32
|
-
#
|
|
33
|
-
#
|
|
31
|
+
# The +table+ argument is used as a literal table name, even if it contains a dot.
|
|
32
|
+
# Use +schema:+ and +catalog:+ to qualify the table. Surrounding double or single
|
|
33
|
+
# quotes (<tt>'"a.b"'</tt> or <tt>"'a.b'"</tt>) are stripped.
|
|
34
34
|
#
|
|
35
35
|
# Raises DuckDB::Error if the connection is invalid, the table name is nil,
|
|
36
36
|
# or the table (or schema/catalog) does not exist.
|
|
@@ -4,23 +4,17 @@ module DuckDB
|
|
|
4
4
|
# DuckDB::TableNameParser provides shared table name parsing for classes that
|
|
5
5
|
# accept a table name argument, such as DuckDB::Appender and DuckDB::TableDescription.
|
|
6
6
|
#
|
|
7
|
-
# It handles:
|
|
8
|
-
#
|
|
9
|
-
#
|
|
7
|
+
# It handles quoting: <tt>'"a.b"'</tt> or <tt>"'a.b'"</tt> strips the quotes and treats the name literally.
|
|
8
|
+
# A name containing a dot (e.g. <tt>'a.b'</tt>) is used as-is, as a literal table name; it is
|
|
9
|
+
# never split into schema and table. Use the +schema:+ and +catalog:+ keyword arguments to qualify a table.
|
|
10
10
|
module TableNameParser
|
|
11
11
|
private
|
|
12
12
|
|
|
13
|
-
# Parses +table+, +schema+, and +catalog+, handling quoting
|
|
13
|
+
# Parses +table+, +schema+, and +catalog+, handling quoting.
|
|
14
14
|
# Returns <tt>[table, schema, catalog]</tt>.
|
|
15
15
|
def parse_table_name(table, schema, catalog)
|
|
16
|
-
if quoted_table_name?(table)
|
|
17
|
-
|
|
18
|
-
elsif table.include?('.')
|
|
19
|
-
warn_dot_notation_deprecated(table)
|
|
20
|
-
dot_notation_split(table, schema, catalog)
|
|
21
|
-
else
|
|
22
|
-
[table, schema, catalog]
|
|
23
|
-
end
|
|
16
|
+
table = unquote_table_name(table) if quoted_table_name?(table)
|
|
17
|
+
[table, schema, catalog]
|
|
24
18
|
end
|
|
25
19
|
|
|
26
20
|
def quoted_table_name?(name) # :nodoc:
|
|
@@ -30,29 +24,5 @@ module DuckDB
|
|
|
30
24
|
def unquote_table_name(name) # :nodoc:
|
|
31
25
|
name[1..-2]
|
|
32
26
|
end
|
|
33
|
-
|
|
34
|
-
# Splits a dot-notation string into [table, schema, catalog].
|
|
35
|
-
# Explicit keyword args take precedence over dot-notation parts.
|
|
36
|
-
def dot_notation_split(table, schema, catalog) # :nodoc:
|
|
37
|
-
parts = table.split('.')
|
|
38
|
-
raise ArgumentError, "Too many dot-separated segments in '#{table}'" if parts.length > 3
|
|
39
|
-
|
|
40
|
-
case parts.length
|
|
41
|
-
when 2 then [parts[1], schema || parts[0], catalog]
|
|
42
|
-
when 3 then [parts[2], schema || parts[1], catalog || parts[0]]
|
|
43
|
-
else raise ArgumentError, "Unexpected segment count in '#{table}'"
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def warn_dot_notation_deprecated(table) # :nodoc:
|
|
48
|
-
class_name = self.class.name
|
|
49
|
-
warn(
|
|
50
|
-
"Passing dot-notation '#{table}' to #{class_name}.new is deprecated. " \
|
|
51
|
-
"If '#{table}' is a schema-qualified table, use #{class_name}.new(con, table, schema: schema) instead. " \
|
|
52
|
-
"If '#{table}' is a literal table name containing a dot, " \
|
|
53
|
-
"use #{class_name}.new(con, '\"#{table}\"') instead.",
|
|
54
|
-
category: :deprecated
|
|
55
|
-
)
|
|
56
|
-
end
|
|
57
27
|
end
|
|
58
28
|
end
|
data/lib/duckdb/version.rb
CHANGED
data/lib/duckdb.rb
CHANGED
|
@@ -59,22 +59,8 @@ module DuckDB
|
|
|
59
59
|
|
|
60
60
|
@default_timezone = value
|
|
61
61
|
end
|
|
62
|
-
|
|
63
|
-
def const_missing(name)
|
|
64
|
-
deprecated = DEPRECATED_CONSTANTS[name]
|
|
65
|
-
return super unless deprecated
|
|
66
|
-
|
|
67
|
-
warn "DuckDB::#{name} is deprecated. Use #{deprecated} instead.", uplevel: 1
|
|
68
|
-
const_set(name, deprecated.split('::').reduce(Object) { |mod, part| mod.const_get(part) })
|
|
69
|
-
end
|
|
70
62
|
end
|
|
71
63
|
|
|
72
|
-
DEPRECATED_CONSTANTS = {
|
|
73
|
-
BindInfo: 'DuckDB::TableFunction::BindInfo',
|
|
74
|
-
InitInfo: 'DuckDB::TableFunction::InitInfo',
|
|
75
|
-
FunctionInfo: 'DuckDB::TableFunction::FunctionInfo'
|
|
76
|
-
}.freeze
|
|
77
|
-
|
|
78
64
|
# Default to local time to preserve existing behavior unless explicitly
|
|
79
65
|
# configured otherwise.
|
|
80
66
|
self.default_timezone = :local
|