adriangb commented on PR #21807:
URL: https://github.com/apache/datafusion/pull/21807#issuecomment-4352688936

   @jayshrivastava since both Lía and Stu suggested the same thing (use a 
deterministic incrementing counter) wdyt of adding something like:
   
   ```rust
   use std::sync::atomic::{AtomicUsize, Ordering};
   
   struct ExpressionIdCounter {
       inner: AtomicUsize,
   }
   
   impl ExpressionIdCounter {
       pub const fn new(initial_value: usize) -> Self {
           Self {
               inner: AtomicUsize::new(initial_value),
           }
       }
   
     pub fn get_next(&self) -> usize {
             self.inner.fetch_add(1, Ordering::Relaxed)
         }
   }
   
   static EXPR_ID: ExpressionIdCounter = ExpressionIdCounter::new(0);
   ```
   
   I'd keep it private for now, but if we want to re-use it we just make it pub 
and move it.
   
   I don't see any other blockers to merging this!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to