Skip to content

Commit e16bdc4

Browse files
committed
Ruby/QL: only create dbscheme case-splits for columns on defining tables
1 parent 92ee0aa commit e16bdc4

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

ql/node-types/src/lib.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ pub enum Storage {
8181
},
8282
}
8383

84+
impl Storage {
85+
pub fn is_column(&self) -> bool {
86+
match self {
87+
Storage::Column { .. } => true,
88+
_ => false,
89+
}
90+
}
91+
}
8492
pub fn read_node_types(prefix: &str, node_types_path: &Path) -> std::io::Result<NodeTypeMap> {
8593
let file = fs::File::open(node_types_path)?;
8694
let node_types: Vec<NodeInfo> = serde_json::from_reader(file)?;
@@ -245,10 +253,11 @@ fn add_field(
245253
}
246254
};
247255
let converted_types = convert_types(&field_info.types);
248-
let type_info = if field_info
249-
.types
250-
.iter()
251-
.all(|t| !t.named && token_kinds.contains(&convert_type(t)))
256+
let type_info = if storage.is_column()
257+
&& field_info
258+
.types
259+
.iter()
260+
.all(|t| !t.named && token_kinds.contains(&convert_type(t)))
252261
{
253262
// All possible types for this field are reserved words. The db
254263
// representation will be an `int` with a `case @foo.field = ...` to

ruby/node-types/src/lib.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ pub enum Storage {
8181
},
8282
}
8383

84+
impl Storage {
85+
pub fn is_column(&self) -> bool {
86+
match self {
87+
Storage::Column { .. } => true,
88+
_ => false,
89+
}
90+
}
91+
}
8492
pub fn read_node_types(prefix: &str, node_types_path: &Path) -> std::io::Result<NodeTypeMap> {
8593
let file = fs::File::open(node_types_path)?;
8694
let node_types: Vec<NodeInfo> = serde_json::from_reader(file)?;
@@ -245,10 +253,11 @@ fn add_field(
245253
}
246254
};
247255
let converted_types = convert_types(&field_info.types);
248-
let type_info = if field_info
249-
.types
250-
.iter()
251-
.all(|t| !t.named && token_kinds.contains(&convert_type(t)))
256+
let type_info = if storage.is_column()
257+
&& field_info
258+
.types
259+
.iter()
260+
.all(|t| !t.named && token_kinds.contains(&convert_type(t)))
252261
{
253262
// All possible types for this field are reserved words. The db
254263
// representation will be an `int` with a `case @foo.field = ...` to

0 commit comments

Comments
 (0)