Skip to content

Commit

Permalink
Merge branch 'main' into zp/pg_is_in_recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
yezizp2012 committed Jul 10, 2024
2 parents f079eb2 + b9ad21b commit 1b024ee
Show file tree
Hide file tree
Showing 109 changed files with 2,569 additions and 2,185 deletions.
54 changes: 11 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ license = "Apache-2.0"
repository = "https://github.com/risingwavelabs/risingwave"

[workspace.dependencies]
foyer = { version = "0.10.0", features = ["nightly", "mtrace"] }
foyer = { version = "0.10.1", features = ["nightly", "mtrace"] }
apache-avro = { git = "https://github.com/risingwavelabs/avro", rev = "25113ba88234a9ae23296e981d8302c290fdaa4b", features = [
"snappy",
"zstandard",
Expand Down Expand Up @@ -143,6 +143,7 @@ arrow-cast-iceberg = { package = "arrow-cast", version = "52" }
# After apache/iceberg-rust#411 is merged, we move to the upstream version.
iceberg = { git = "https://github.com/risingwavelabs/iceberg-rust.git", rev = "0c6e133e6f4655ff9ce4ad57b577dc7f692dd902" }
iceberg-catalog-rest = { git = "https://github.com/risingwavelabs/iceberg-rust.git", rev = "0c6e133e6f4655ff9ce4ad57b577dc7f692dd902" }
opendal = "0.47"
arrow-array = "50"
arrow-arith = "50"
arrow-cast = "50"
Expand Down Expand Up @@ -171,7 +172,7 @@ deltalake = { git = "https://github.com/risingwavelabs/delta-rs", rev = "5c2dccd
itertools = "0.12.0"
jsonbb = "0.1.4"
lru = { git = "https://github.com/risingwavelabs/lru-rs.git", rev = "2682b85" }
parquet = "50"
parquet = { version = "52", features = ["async"] }
thiserror-ext = "0.1.2"
tikv-jemalloc-ctl = { git = "https://github.com/risingwavelabs/jemallocator.git", rev = "64a2d9" }
tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", features = [
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ RisingWave is distributed under the Apache License (Version 2.0). Please refer t

## Contributing

Thanks for your interest in contributing to the project! Please refer to [contribution guidelines](CONTRIBUTING.md) for more information.
Thanks for your interest in contributing to the project! Please refer to [RisingWave Developer Guide](https://risingwavelabs.github.io/risingwave/)for more information.
4 changes: 2 additions & 2 deletions ci/scripts/docker-hdfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ BUILDKITE_COMMIT="HDFS_$(echo $RANDOM | md5sum | head -c 20;)"

java_home_path=$(uname -m)
if [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
java_home_path="/usr/lib/jvm/java-11-openjdk-arm64"
java_home_path="/usr/lib/jvm/java-17-openjdk-arm64"
else
# x86_64
java_home_path="/usr/lib/jvm/java-11-openjdk-amd64"
java_home_path="/usr/lib/jvm/java-17-openjdk-amd64"
fi
echo $java_home_path

Expand Down
2 changes: 1 addition & 1 deletion docker/dashboards/risingwave-dev-dashboard.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker/dashboards/risingwave-user-dashboard.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dev/src/intro.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Introduction

This guide is intended to be used by contributors to learn about how to develop RisingWave. The instructions about how to submit code changes are included in [contributing guidelines](./contributing.md).
This guide is intended to be used by contributors to learn about how to develop RisingWave. The instructions about how to submit code changes are included in [contribution guidelines](./contributing.md).

If you have questions, you can search for existing discussions or start a new discussion in the [Discussions forum of RisingWave](https://github.com/risingwavelabs/risingwave/discussions), or ask in the RisingWave Community channel on Slack. Please use the [invitation link](https://risingwave.com/slack) to join the channel.

Expand Down
27 changes: 27 additions & 0 deletions e2e_test/commands/sr_register
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -euo pipefail

# Register a schema to schema registry
#
# Usage: sr_register <subject> <schema>
#
# https://docs.confluent.io/platform/current/schema-registry/develop/api.html#post--subjects-(string-%20subject)-versions

# Validate arguments
if [[ $# -ne 2 ]]; then
echo "Usage: sr_register <subject> <schema>"
exit 1
fi

subject="$1"
schema="$2"


if [[ -z $subject || -z $schema ]]; then
echo "Error: Arguments cannot be empty"
exit 1
fi

echo "$schema" | jq '{"schema": tojson}' \
| curl -X POST -H 'content-type:application/vnd.schemaregistry.v1+json' -d @- "${RISEDEV_SCHEMA_REGISTRY_URL}/subjects/${subject}/versions"
6 changes: 2 additions & 4 deletions e2e_test/source_inline/kafka/avro/alter_source.slt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ system ok
rpk topic create 'avro_alter_source_test'

system ok
echo '{"type":"record","name":"Root","fields":[{"name":"foo","type":"string"}]}' | jq '{"schema": tojson}' \
| curl -X POST -H 'content-type:application/json' -d @- "${RISEDEV_SCHEMA_REGISTRY_URL}/subjects/avro_alter_source_test-value/versions"
sr_register avro_alter_source_test-value '{"type":"record","name":"Root","fields":[{"name":"foo","type":"string"}]}'

statement ok
create source s
Expand All @@ -27,8 +26,7 @@ FORMAT PLAIN ENCODE AVRO (

# create a new version of schema and produce a message
system ok
echo '{"type":"record","name":"Root","fields":[{"name":"bar","type":"int","default":0},{"name":"foo","type":"string"}]}' | jq '{"schema": tojson}' \
| curl -X POST -H 'content-type:application/json' -d @- "${RISEDEV_SCHEMA_REGISTRY_URL}/subjects/avro_alter_source_test-value/versions"
sr_register avro_alter_source_test-value '{"type":"record","name":"Root","fields":[{"name":"bar","type":"int","default":0},{"name":"foo","type":"string"}]}'

system ok
echo '{"foo":"ABC", "bar":1}' | rpk topic produce --schema-id=topic avro_alter_source_test
Expand Down
175 changes: 175 additions & 0 deletions e2e_test/source_inline/kafka/avro/union.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
control substitution on

system ok
rpk topic delete 'avro-union' || true; \
(rpk sr subject delete 'avro-union-value' && rpk sr subject delete 'avro-union-value' --permanent) || true;
rpk topic create avro-union

system ok
sr_register avro-union-value '
{
"type": "record",
"name": "Root",
"fields": [
{
"name": "unionType",
"type": ["int", "string"]
},
{
"name": "unionTypeComplex",
"type": [
"null",
{"type": "record", "name": "Email","fields": [{"name":"inner","type":"string"}]},
{"type": "record", "name": "Fax","fields": [{"name":"inner","type":"int"}]},
{"type": "record", "name": "Sms","fields": [{"name":"inner","type":"int"}]}
]
},
{
"name": "enumField",
"type": ["null", "int", {
"type": "enum",
"name": "myEnum",
"namespace": "my.namespace",
"symbols": ["A", "B", "C", "D"]
}],
"default": null
}
]
}
'

system ok
cat<<EOF | rpk topic produce avro-union --schema-id=topic
{"unionType": {"int":1}, "unionTypeComplex": {"Sms": {"inner":6}}, "enumField": {"my.namespace.myEnum": "A"}}
{"unionType": {"string":"2"}, "unionTypeComplex": {"Fax": {"inner":6}}}
{"unionType": {"int":3}, "unionTypeComplex": {"Email": {"inner":"[email protected]"}}, "enumField": {"int":66}}
EOF

statement error
create source avro_union
WITH (
${RISEDEV_KAFKA_WITH_OPTIONS_COMMON},
topic = 'avro-union'
)
FORMAT PLAIN ENCODE AVRO (
schema.registry = '${RISEDEV_SCHEMA_REGISTRY_URL}'
);
----
db error: ERROR: Failed to run the query

Caused by these errors (recent errors listed first):
1: connector error
2: failed to convert Avro union to struct
3: Feature is not yet implemented: Avro named type used in Union type: Record(RecordSchema { name: Name { name: "Email", namespace: None }, aliases: None, doc: None, fields: [RecordField { name: "inner", doc: None, aliases: None, default: None, schema: String, order: Ascending, position: 0, custom_attributes: {} }], lookup: {"inner": 0}, attributes: {} })
Tracking issue: https://github.com/risingwavelabs/risingwave/issues/17632


# FIXME: The following is the current buggy result.


# query ? rowsort
# select * from avro_union
# ----
# ("([email protected])",,)
# (,"(6)",)
# (,"(6)",)

# # Demonstrate how to access union variants (struct fields) below:
# # Note that we need to use quotes.

# query ? rowsort
# select ("enumField")."my.namespace.myEnum" from avro_union;
# ----
# A
# NULL
# NULL

# # To output the union’s tag (i.e. case in protobuf), a case-when can be used.
# query ? rowsort
# select
# case
# when ("unionTypeComplex")."Sms" is not null then 'Sms'
# when ("unionTypeComplex")."Fax" is not null then 'Fax'
# when ("unionTypeComplex")."Email" is not null then 'Email'
# else null -- optional
# end
# from avro_union;
# ----
# Email
# Fax
# Fax



system ok
rpk topic delete 'avro-union-simple' || true; \
(rpk sr subject delete 'avro-union-simple-value' && rpk sr subject delete 'avro-union-simple-value' --permanent) || true;
rpk topic create avro-union-simple

system ok
sr_register avro-union-simple-value '
{
"type": "record",
"name": "Root",
"fields": [
{
"name": "unionType",
"type": ["int", "string", "null", "boolean"]
}
]
}
'

system ok
cat<<EOF | rpk topic produce avro-union-simple --schema-id=topic
{"unionType": {"int":1}}
{"unionType": {"string":"2"}}
{"unionType": {"boolean": true}}
{"unionType": null}
EOF

statement ok
create source avro_union
WITH (
${RISEDEV_KAFKA_WITH_OPTIONS_COMMON},
topic = 'avro-union-simple'
)
FORMAT PLAIN ENCODE AVRO (
schema.registry = '${RISEDEV_SCHEMA_REGISTRY_URL}'
);


query ? rowsort
select * from avro_union
----
(,,t)
(,2,)
(1,,)
NULL

# Demonstrate how to access union variants (struct fields) below:
# Note that we need to use quotes.

query ? rowsort
select ("unionType")."string" from avro_union;
----
2
NULL
NULL
NULL

# To output the union’s tag (i.e. case in protobuf), a case-when can be used.
query ? rowsort
select
case
when ("unionType")."int" is not null then 'int'
when ("unionType")."string" is not null then 'string'
when ("unionType")."boolean" is not null then 'boolean'
else null -- optional
end
from avro_union;
----
NULL
boolean
int
string
Loading

0 comments on commit 1b024ee

Please sign in to comment.