Skip to content

Commit a54784e

Browse files
committed
Merge branch 'master' of https://github.com/apache/iotdb into feature/subscription-column-filter
2 parents 32a986e + 837711d commit a54784e

311 files changed

Lines changed: 16051 additions & 1446 deletions

File tree

Some content is hidden

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

.github/scripts/package-client-cpp-manylinux228.sh

100755100644
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,22 @@ fi
7171
cmake --version
7272
java -version
7373

74+
# manylinux_2_28 is AlmaLinux 8, whose system OpenSSL is 1.1.1 (EOL and not
75+
# Apache-2.0 - must not be bundled/redistributed in an ASF convenience binary).
76+
# Build OpenSSL 3.x from source instead (-Diotdb.openssl.from.source=ON), which
77+
# keeps the glibc 2.28 baseline. OpenSSL 3.x's Configure needs perl plus a few
78+
# modules (IPC::Cmd, Data::Dumper) that are not on the minimal image - install
79+
# them even when perl itself is already present.
80+
if command -v dnf >/dev/null 2>&1; then
81+
dnf install -y perl perl-IPC-Cmd perl-Data-Dumper
82+
else
83+
yum install -y perl perl-IPC-Cmd perl-Data-Dumper
84+
fi
85+
7486
cd "${GITHUB_WORKSPACE:?GITHUB_WORKSPACE is not set}"
7587
./mvnw clean package -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests \
7688
-Dspotless.skip=true \
89+
-Diotdb.openssl.from.source=ON \
7790
-Dclient.cpp.package.classifier="${PACKAGE_CLASSIFIER}"
7891

7992
SO="iotdb-client/client-cpp/target/install/lib/libiotdb_session.so"

.github/workflows/client-cpp-package.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,14 @@ jobs:
309309
shell: bash
310310
run: |
311311
set -euxo pipefail
312-
brew install boost openssl llvm@17 bison
312+
# Pin openssl@3 (Apache-2.0): the default 'openssl' formula will move to
313+
# OpenSSL 4.0, which drops the legacy TLS-method APIs Thrift still uses.
314+
brew install boost openssl@3 llvm@17 bison
313315
ln -sf "$(brew --prefix llvm@17)/bin/clang-format" "$(brew --prefix)/bin/clang-format"
314316
echo "$(brew --prefix bison)/bin" >> "$GITHUB_PATH"
315317
echo "$(brew --prefix llvm@17)/bin" >> "$GITHUB_PATH"
318+
# Homebrew OpenSSL is keg-only, so point find_package(OpenSSL) at it.
319+
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV"
316320
clang-format --version
317321
bison --version
318322
- name: Cache Maven packages
@@ -429,8 +433,16 @@ jobs:
429433
throw "Boost not found under C:\local after installing ${{ matrix.boost_choco }}"
430434
}
431435
echo $boostDir.FullName >> $env:GITHUB_PATH
432-
choco install openssl -y --no-progress
433-
$sslPath = (Get-ChildItem 'C:\Program Files\OpenSSL*' -Directory | Select-Object -First 1).FullName
436+
# Use a pinned OpenSSL 3.x (Apache-2.0). 'choco install openssl' now
437+
# installs OpenSSL 4.0, which removed the legacy TLS-method APIs that
438+
# Apache Thrift's TSSLSocket still calls. The FireDaemon zip is a clean
439+
# prebuilt OpenSSL 3.5.x that keeps them.
440+
$sslZip = "$env:RUNNER_TEMP\openssl-3.5.3.zip"
441+
$sslDir = "$env:RUNNER_TEMP\openssl-3"
442+
curl.exe -L --fail --retry 3 -o $sslZip 'https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-3.5.3.zip'
443+
Expand-Archive -Path $sslZip -DestinationPath $sslDir -Force
444+
$sslPath = (Get-ChildItem $sslDir -Recurse -Directory -Filter 'x64' | Select-Object -First 1).FullName
445+
if (-not $sslPath) { throw "OpenSSL x64 dir not found under $sslDir" }
434446
echo "$sslPath\bin" >> $env:GITHUB_PATH
435447
echo "OPENSSL_ROOT_DIR=$sslPath" >> $env:GITHUB_ENV
436448
- name: Cache Maven packages

.github/workflows/multi-language-client.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,13 @@ jobs:
144144
if: runner.os == 'macOS'
145145
shell: bash
146146
run: |
147-
brew install boost openssl llvm@17 bison
147+
# Pin openssl@3 (Apache-2.0); the default formula will move to OpenSSL 4.0.
148+
brew install boost openssl@3 llvm@17 bison
148149
ln -sf "$(brew --prefix llvm@17)/bin/clang-format" "$(brew --prefix)/bin/clang-format"
149150
echo "$(brew --prefix bison)/bin" >> "$GITHUB_PATH"
150151
echo "$(brew --prefix llvm@17)/bin" >> "$GITHUB_PATH"
152+
# Homebrew OpenSSL is keg-only, so point find_package(OpenSSL) at it.
153+
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV"
151154
clang-format --version
152155
bison --version
153156
sudo rm -rf /Applications/Xcode_14.3.1.app
@@ -163,8 +166,14 @@ jobs:
163166
$boost_path = (Get-ChildItem -Path 'C:\local\' -Filter 'boost_*').FullName
164167
echo $boost_path >> $env:GITHUB_PATH
165168
166-
choco install openssl -y
167-
$sslPath = (Get-ChildItem 'C:\Program Files\OpenSSL*' -Directory | Select-Object -First 1).FullName
169+
# Pinned OpenSSL 3.x (Apache-2.0): 'choco install openssl' now installs
170+
# OpenSSL 4.0, which removed the legacy TLS-method APIs Thrift uses.
171+
$sslZip = "$env:RUNNER_TEMP\openssl-3.5.3.zip"
172+
$sslDir = "$env:RUNNER_TEMP\openssl-3"
173+
curl.exe -L --fail --retry 3 -o $sslZip 'https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-3.5.3.zip'
174+
Expand-Archive -Path $sslZip -DestinationPath $sslDir -Force
175+
$sslPath = (Get-ChildItem $sslDir -Recurse -Directory -Filter 'x64' | Select-Object -First 1).FullName
176+
if (-not $sslPath) { throw "OpenSSL x64 dir not found under $sslDir" }
168177
echo "$sslPath\bin" >> $env:GITHUB_PATH
169178
echo "OPENSSL_ROOT_DIR=$sslPath" >> $env:GITHUB_ENV
170179
choco install llvm --version=17.0.6 --force -y
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.iotdb.db.query.udf.example.relational.iotdblocal;
21+
22+
/** Probes CREATE TABLE rejection for IoTDBLocal integration tests. */
23+
public class CreateTableProbeFunction extends MutatingQueryProbeFunction {
24+
25+
@Override
26+
protected String mutatingSql() {
27+
return "CREATE TABLE should_not_exist_local_probe (x INT32 FIELD)";
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.iotdb.db.query.udf.example.relational.iotdblocal;
21+
22+
import org.apache.iotdb.udf.api.IoTDBLocal;
23+
import org.apache.iotdb.udf.api.UDFResultSet;
24+
import org.apache.iotdb.udf.api.exception.UDFException;
25+
import org.apache.iotdb.udf.api.relational.TableFunction;
26+
import org.apache.iotdb.udf.api.relational.access.Record;
27+
import org.apache.iotdb.udf.api.relational.table.MapTableFunctionHandle;
28+
import org.apache.iotdb.udf.api.relational.table.TableFunctionAnalysis;
29+
import org.apache.iotdb.udf.api.relational.table.TableFunctionHandle;
30+
import org.apache.iotdb.udf.api.relational.table.TableFunctionProcessorProvider;
31+
import org.apache.iotdb.udf.api.relational.table.argument.Argument;
32+
import org.apache.iotdb.udf.api.relational.table.argument.DescribedSchema;
33+
import org.apache.iotdb.udf.api.relational.table.argument.ScalarArgument;
34+
import org.apache.iotdb.udf.api.relational.table.processor.TableFunctionLeafProcessor;
35+
import org.apache.iotdb.udf.api.relational.table.specification.ParameterSpecification;
36+
import org.apache.iotdb.udf.api.relational.table.specification.ScalarParameterSpecification;
37+
import org.apache.iotdb.udf.api.type.Type;
38+
39+
import org.apache.tsfile.block.column.ColumnBuilder;
40+
import org.apache.tsfile.common.conf.TSFileConfig;
41+
import org.apache.tsfile.utils.Binary;
42+
43+
import java.util.Collections;
44+
import java.util.List;
45+
import java.util.Map;
46+
47+
/**
48+
* Leaf table function: loads device_id via {@link IoTDBLocal#query(String)} in {@link
49+
* TableFunctionLeafProcessor#process(List, IoTDBLocal)}.
50+
*/
51+
public class DeviceIdListInProcessTableFunction implements TableFunction {
52+
53+
private static final String PREFIX_PARAMETER_NAME = "prefix";
54+
55+
@Override
56+
public List<ParameterSpecification> getArgumentsSpecifications() {
57+
return Collections.singletonList(
58+
ScalarParameterSpecification.builder()
59+
.name(PREFIX_PARAMETER_NAME)
60+
.type(Type.STRING)
61+
.defaultValue("")
62+
.build());
63+
}
64+
65+
@Override
66+
public TableFunctionAnalysis analyze(Map<String, Argument> arguments) throws UDFException {
67+
DescribedSchema schema = DescribedSchema.builder().addField("device_id", Type.STRING).build();
68+
MapTableFunctionHandle handle =
69+
new MapTableFunctionHandle.Builder()
70+
.addProperty(
71+
PREFIX_PARAMETER_NAME,
72+
((ScalarArgument) arguments.get(PREFIX_PARAMETER_NAME)).getValue())
73+
.build();
74+
return TableFunctionAnalysis.builder().properColumnSchema(schema).handle(handle).build();
75+
}
76+
77+
@Override
78+
public TableFunctionHandle createTableFunctionHandle() {
79+
return new MapTableFunctionHandle();
80+
}
81+
82+
@Override
83+
public TableFunctionProcessorProvider getProcessorProvider(
84+
TableFunctionHandle tableFunctionHandle) {
85+
return new TableFunctionProcessorProvider() {
86+
@Override
87+
public TableFunctionLeafProcessor getSplitProcessor() {
88+
return new InProcessProcessor(
89+
(String)
90+
((MapTableFunctionHandle) tableFunctionHandle).getProperty(PREFIX_PARAMETER_NAME));
91+
}
92+
};
93+
}
94+
95+
private static class InProcessProcessor implements TableFunctionLeafProcessor {
96+
private final String prefix;
97+
private boolean finish;
98+
99+
InProcessProcessor(String prefix) {
100+
this.prefix = prefix == null ? "" : prefix;
101+
}
102+
103+
@Override
104+
public void process(List<ColumnBuilder> columnBuilders) {
105+
throw new UnsupportedOperationException("framework invokes process(List, IoTDBLocal)");
106+
}
107+
108+
@Override
109+
public void process(List<ColumnBuilder> columnBuilders, IoTDBLocal local) {
110+
if (finish) {
111+
return;
112+
}
113+
try (UDFResultSet rs = local.query("SELECT device_id FROM device_info ORDER BY device_id")) {
114+
while (rs.hasNext()) {
115+
Record row = rs.next();
116+
columnBuilders
117+
.get(0)
118+
.writeBinary(new Binary(prefix + row.getString(0), TSFileConfig.STRING_CHARSET));
119+
}
120+
} catch (UDFException e) {
121+
throw new IllegalStateException(e);
122+
}
123+
finish = true;
124+
}
125+
126+
@Override
127+
public boolean isFinish() {
128+
return finish;
129+
}
130+
}
131+
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.iotdb.db.query.udf.example.relational.iotdblocal;
21+
22+
import org.apache.iotdb.udf.api.IoTDBLocal;
23+
import org.apache.iotdb.udf.api.UDFResultSet;
24+
import org.apache.iotdb.udf.api.exception.UDFException;
25+
import org.apache.iotdb.udf.api.relational.TableFunction;
26+
import org.apache.iotdb.udf.api.relational.access.Record;
27+
import org.apache.iotdb.udf.api.relational.table.MapTableFunctionHandle;
28+
import org.apache.iotdb.udf.api.relational.table.TableFunctionAnalysis;
29+
import org.apache.iotdb.udf.api.relational.table.TableFunctionHandle;
30+
import org.apache.iotdb.udf.api.relational.table.TableFunctionProcessorProvider;
31+
import org.apache.iotdb.udf.api.relational.table.argument.Argument;
32+
import org.apache.iotdb.udf.api.relational.table.argument.DescribedSchema;
33+
import org.apache.iotdb.udf.api.relational.table.argument.ScalarArgument;
34+
import org.apache.iotdb.udf.api.relational.table.processor.TableFunctionLeafProcessor;
35+
import org.apache.iotdb.udf.api.relational.table.specification.ParameterSpecification;
36+
import org.apache.iotdb.udf.api.relational.table.specification.ScalarParameterSpecification;
37+
import org.apache.iotdb.udf.api.type.Type;
38+
39+
import org.apache.tsfile.block.column.ColumnBuilder;
40+
import org.apache.tsfile.common.conf.TSFileConfig;
41+
import org.apache.tsfile.utils.Binary;
42+
43+
import java.util.ArrayList;
44+
import java.util.Collections;
45+
import java.util.List;
46+
import java.util.Map;
47+
48+
/**
49+
* Leaf table function: loads device_id via {@link IoTDBLocal#query(String)} in {@link
50+
* TableFunctionLeafProcessor#beforeStart(IoTDBLocal)}.
51+
*/
52+
public class DeviceIdListTableFunction implements TableFunction {
53+
54+
private static final String PREFIX_PARAMETER_NAME = "prefix";
55+
56+
@Override
57+
public List<ParameterSpecification> getArgumentsSpecifications() {
58+
return Collections.singletonList(
59+
ScalarParameterSpecification.builder()
60+
.name(PREFIX_PARAMETER_NAME)
61+
.type(Type.STRING)
62+
.defaultValue("")
63+
.build());
64+
}
65+
66+
@Override
67+
public TableFunctionAnalysis analyze(Map<String, Argument> arguments) throws UDFException {
68+
DescribedSchema schema = DescribedSchema.builder().addField("device_id", Type.STRING).build();
69+
MapTableFunctionHandle handle =
70+
new MapTableFunctionHandle.Builder()
71+
.addProperty(
72+
PREFIX_PARAMETER_NAME,
73+
((ScalarArgument) arguments.get(PREFIX_PARAMETER_NAME)).getValue())
74+
.build();
75+
return TableFunctionAnalysis.builder().properColumnSchema(schema).handle(handle).build();
76+
}
77+
78+
@Override
79+
public TableFunctionHandle createTableFunctionHandle() {
80+
return new MapTableFunctionHandle();
81+
}
82+
83+
@Override
84+
public TableFunctionProcessorProvider getProcessorProvider(
85+
TableFunctionHandle tableFunctionHandle) {
86+
return new TableFunctionProcessorProvider() {
87+
@Override
88+
public TableFunctionLeafProcessor getSplitProcessor() {
89+
return new BeforeStartProcessor(
90+
(String)
91+
((MapTableFunctionHandle) tableFunctionHandle).getProperty(PREFIX_PARAMETER_NAME));
92+
}
93+
};
94+
}
95+
96+
private static class BeforeStartProcessor implements TableFunctionLeafProcessor {
97+
private final String prefix;
98+
private final List<String> deviceIds = new ArrayList<>();
99+
private boolean finish;
100+
101+
BeforeStartProcessor(String prefix) {
102+
this.prefix = prefix == null ? "" : prefix;
103+
}
104+
105+
@Override
106+
public void beforeStart(IoTDBLocal local) throws UDFException {
107+
try (UDFResultSet rs = local.query("SELECT device_id FROM device_info ORDER BY device_id")) {
108+
while (rs.hasNext()) {
109+
Record row = rs.next();
110+
deviceIds.add(row.getString(0));
111+
}
112+
}
113+
}
114+
115+
@Override
116+
public void process(List<ColumnBuilder> columnBuilders) {
117+
writeDeviceIds(columnBuilders);
118+
}
119+
120+
@Override
121+
public void process(List<ColumnBuilder> columnBuilders, IoTDBLocal local) {
122+
writeDeviceIds(columnBuilders);
123+
}
124+
125+
private void writeDeviceIds(List<ColumnBuilder> columnBuilders) {
126+
if (finish) {
127+
return;
128+
}
129+
for (String deviceId : deviceIds) {
130+
columnBuilders
131+
.get(0)
132+
.writeBinary(new Binary(prefix + deviceId, TSFileConfig.STRING_CHARSET));
133+
}
134+
finish = true;
135+
}
136+
137+
@Override
138+
public boolean isFinish() {
139+
return finish;
140+
}
141+
}
142+
}

0 commit comments

Comments
 (0)