Git Product home page Git Product logo

Comments (1)

jayzhan211 avatar jayzhan211 commented on August 26, 2024

The current ideal state in my mind

Signature does 3 things

  1. Length check
  2. Type check
  3. Coercion

For length,
the common length check are

  1. Exact number
  2. Variadic (Any number)
  3. VariadicNonZero (Any number but at least one)
  4. VariadicEven (Less common, i.e. Map)

For types,
We have two style, Exact and Coercion. Exact rejects if the type mismatch, Coercion rejects if teh type is not coercible to the target type.

The combination of these are

  • Uniform(Vec<DataType>) // Exact Number with Exact type
  • UniformCoercion(Vec<DataType>) // Exact Number with coercion
  • Variadic(DataType)
  • VariadicCoercion(DataType)
    ...

For non-uniform length and more then on data type signature, we could use UserDefined.

The more tricky part is the DataType. We have many functions expect Numeric type that includes integer, float, ....
For function that expects string, there are Utf8, LargeUtf8, Utf8View.

For type checking, it would be nice to have more general Enum that includes more than one DataType to check against with.

enum ArgumentType {
 Numeric
 Integer
 Float
 List
 ...
}

Now, we have

  • Uniform(Vec<FunctionType>) // Exact Number with Exact type
  • UniformCoercion(Vec<FunctionType>) // Exact Number with coercion
  • Variadic(FunctionType)
  • VariadicCoercion(FunctionType)

TypeSignature::Numeric is one of the idea that comes out from it.
For other kinds of complex type check or length check, we fall back to UserDefined

from arrow-datafusion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.