Skip to content
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

feat: default value for source/(table with conn) #17374

Open
st1page opened this issue Jun 20, 2024 · 3 comments
Open

feat: default value for source/(table with conn) #17374

st1page opened this issue Jun 20, 2024 · 3 comments
Assignees
Milestone

Comments

@st1page
Copy link
Contributor

st1page commented Jun 20, 2024

Currently, the definition on the source/table with conn will not take effect

create table t (
  x int,
  y int default 1,
  z timestamptz default now(),
) with (
  connector = 'kafka',
  topic = 't',
  properties.bootstrap.server = 'localhost:29092',
  scan.startup.mode = 'earliest'
) FORMAT PLAIN ENCODE JSON;

when insert {"x":"1"} to the topic, it will be resolved as

dev=> select * from mv;
 x | y | z 
---+---+---
 1 |   | 
(1 row)

using create source will get the same result.

@BugenZhao
Copy link
Member

If we're going to support it, we should also update this to pad the specified default values for parsing failures.

// TODO: figure out a way to fill in not-null default value if user specifies one

@xiangjinwu
Copy link
Contributor

To clarify, does it only apply to json / csv where columns are listed in SQL?

For protobuf and avro, columns are derived and each encoding has their own specification about default values: protobuf avro

@st1page
Copy link
Contributor Author

st1page commented Jun 21, 2024

To clarify, does it only apply to json / csv where columns are listed in SQL?

For protobuf and avro, columns are derived and each encoding has their own specification about default values: protobuf avro

Good point. I think for protobuf or avro, we need to give user an error to tell them the default value declared in the create statement does not take effect.

@st1page st1page self-assigned this Jul 10, 2024
@st1page st1page modified the milestones: release-1.10, release-1.11 Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants