misc: Remove dead code in Iceberg connector#27336
Merged
amitkdutta merged 1 commit intoprestodb:masterfrom Mar 16, 2026
Merged
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideMakes TypeParser’s cached type map thread-safe using folly::Synchronized and removes unused date parsing parameter code in the IcebergPrestoToVeloxConnector. Sequence diagram for TypeParser::parse with thread-safe cache accesssequenceDiagram
actor Thread
participant TypeParser
participant Cache as SynchronizedCache
participant VeloxParser as PrestoSqlTypeParser
Thread->>TypeParser: parse(text)
TypeParser->>Cache: rlock()
Cache-->>TypeParser: lockedCache
TypeParser->>Cache: find(text)
alt type_in_cache
Cache-->>TypeParser: cached TypePtr
TypeParser-->>Thread: TypePtr
else type_not_in_cache
TypeParser->>VeloxParser: parseType(text)
VeloxParser-->>TypeParser: TypePtr result
TypeParser->>Cache: wlock()
Cache-->>TypeParser: lockedCache
TypeParser->>Cache: insert(text, result)
TypeParser-->>Thread: TypePtr result
end
Class diagram for updated TypeParser thread-safe cacheclassDiagram
class TypeParser {
+velox::TypePtr parse(std::string text) const
-mutable folly::Synchronized<std::unordered_map<std::string, velox::TypePtr>> cache_
}
class SynchronizedCache {
<<folly::Synchronized>>
+std::unordered_map<std::string, velox::TypePtr> data
+rlock() const
+wlock()
}
class VeloxType {
<<velox::TypePtr>>
}
TypeParser --> SynchronizedCache : uses cache_
SynchronizedCache --> VeloxType : stores
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
TypeParser::parse, you now take a read lock, release it, then take a write lock and unconditionally insert; consider a double-checked pattern under the write lock (re-check if the key was inserted while computing or usetry_emplace) to avoid duplicate parsing and to keep the cache semantics consistent under contention. - Holding the write lock while calling
velox::functions::prestosql::parseTypecould serialize all parses; you might want to compute the type outside the write lock and then insert with a short critical section, accepting the possibility of benign duplicate parses.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `TypeParser::parse`, you now take a read lock, release it, then take a write lock and unconditionally insert; consider a double-checked pattern under the write lock (re-check if the key was inserted while computing or use `try_emplace`) to avoid duplicate parsing and to keep the cache semantics consistent under contention.
- Holding the write lock while calling `velox::functions::prestosql::parseType` could serialize all parses; you might want to compute the type outside the write lock and then insert with a short critical section, accepting the possibility of benign duplicate parses.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
kewang1024
reviewed
Mar 14, 2026
Comment on lines
+32
to
+34
| // Cache of previously parsed types keyed by type signature string. | ||
| mutable folly::Synchronized<std::unordered_map<std::string, velox::TypePtr>> | ||
| cache_; |
Collaborator
There was a problem hiding this comment.
what is the performance implication for this new synchronization?
Contributor
Author
There was a problem hiding this comment.
Removed this change.
Summary: Remove unused `columnParseParameters` in `IcebergPrestoToVeloxConnector::toVeloxColumnHandle`. The variable was computed for date types but never passed to the `IcebergColumnHandle` constructor, which doesn't accept it — it already hardcodes `kDaysSinceEpoch` internally. Differential Revision: D96532833
150b67a to
c17b6d1
Compare
This was referenced Mar 31, 2026
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: Remove unused
columnParseParametersinIcebergPrestoToVeloxConnector::toVeloxColumnHandle. The variable was computed for date types but never passed to theIcebergColumnHandleconstructor, which doesn't accept it — it already hardcodeskDaysSinceEpochinternally.