-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[pulsar-sql] Handle schema not found #4890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a6414d4
to
4801dd0
Compare
@@ -50,4 +51,11 @@ static SchemaHandler newPulsarSchemaHandler(SchemaInfo schemaInfo, | |||
} | |||
} | |||
|
|||
static SchemaInfo defaultSchema(String name) { | |||
return SchemaInfo.builder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can simplify with Schema.BYTES.getSchemaInfo()
. This also avoids creating a schema info object again and again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix it.
@@ -352,7 +352,7 @@ private ConnectorTableMetadata getTableMetadata(SchemaTableName schemaTableName, | |||
ColumnMetadata valueColumn = new PulsarColumnMetadata( | |||
"__value__", | |||
convertPulsarType(schemaInfo.getType()), | |||
null, null, false, false, | |||
"The value of the message with primary type schema", null, false, false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The value of the message with primitive schema type"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Minor spelling mistake. Possible to add any tests?
@jerrypeng I have added a unit test for getSplit while topic have no schema, PLAT. |
run cpp tests |
run java8 tests |
744c392
to
4f5bbeb
Compare
// org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called? run java8 tests |
I'm not sure it this is related but I'm seeing the "Table has no columns" error when running the Pulsar SQL tutorial here https://pulsar.apache.org/docs/en/sql-getting-started/. Steps to recreate the problem 2-Use Pulsar SQL to "consume" the data 3-Repeat steps 1 and 2. In step 2 I would see this error I can reproduce this error 100% of the time. |
Do you mean you stop the generator and rerun it again? Or did you just rerun step2? |
You have to have some data into to see the error therefore you have to repeat step 1, run the generator for a minute and then kill it before running step 2 again. My wild guess is that the schema got deleted and is not getting recreated by the generator because the topic already exist when running after the first time. If I change the topic name then it works again. |
* Handle get schema 404 in pulsar sql(table meta and get splits) * Fix unit test. * add defaultSchema() * use Schema.BYTES.getSchemaInfo() * add unit test * rebase and fix unit tests (cherry picked from commit 2069f76)
Motivation
Currently, pulsar does not store byte[] schema in schema registry, while use send message with byte[], use pulsar sql will cause
Modifications
Handle schema not found exception and use default schema.
Verifying this change
Unit tests passed
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation