Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-8782

GenerateOrdering fails for NullType (i.e. ORDER BY NULL crashes)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 1.5.0
    • 1.5.0
    • SQL
    • None

    Description

      Queries containing ORDER BY NULL currently result in a code generation exception:

            public SpecificOrdering generate(org.apache.spark.sql.catalyst.expressions.Expression[] expr) {
              return new SpecificOrdering(expr);
            }
      
            class SpecificOrdering extends org.apache.spark.sql.catalyst.expressions.codegen.BaseOrdering {
      
              private org.apache.spark.sql.catalyst.expressions.Expression[] expressions = null;
      
              public SpecificOrdering(org.apache.spark.sql.catalyst.expressions.Expression[] expr) {
                expressions = expr;
              }
      
              @Override
              public int compare(InternalRow a, InternalRow b) {
                InternalRow i = null;  // Holds current row being evaluated.
                
                i = a;
                final Object primitive1 = null;
                i = b;
                final Object primitive3 = null;
                if (true && true) {
                  // Nothing
                } else if (true) {
                  return -1;
                } else if (true) {
                  return 1;
                } else {
                  int comp = primitive1.compare(primitive3);
                  if (comp != 0) {
                    return comp;
                  }
                }
            
                return 0;
              }
            }
      org.codehaus.commons.compiler.CompileException: Line 29, Column 43: A method named "compare" is not declared in any enclosing class nor any supertype, nor through a static import
      	at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:10174)
      

      Attachments

        Activity

          People

            joshrosen Josh Rosen
            joshrosen Josh Rosen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: